Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Error handling for closure parameters #1102

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

akats7
Copy link
Contributor

@akats7 akats7 commented Nov 17, 2023

In #960 we discussed the way we handle attributes that do not exist when extracted from user defined closures, currently this will throw an AttributeNotFoundException, which does not seem like the correct pattern. This should should just be handled gracefully and in the case if the transformation just avoid creating the metric and in the case of the labels, omit that label.

Existing Issue(s):

N/A

Testing:

@akats7 akats7 requested a review from a team November 17, 2023 03:41
Copy link

linux-foundation-easycla bot commented Nov 17, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: akats7 / name: Alex Kats (9d47952)

Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. @akats7 it looks like you need to sign the CLA, also please format using ./gradlew spotlessApply. Thanks!

@@ -123,7 +123,16 @@ class MBeanHelper {

Object getBeanAttributeWithTransform(GroovyMBean bean, String attribute){
def transformationClosure = attributeTransformation.get(attribute);
return transformationClosure != null ? transformationClosure(bean) : getBeanAttribute(bean, attribute)
if (transformationClosure != null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I like inverting this and returning null early because it helps to reduce the indent levels (reader burden).

@akats7
Copy link
Contributor Author

akats7 commented Nov 21, 2023

Looks good to me. @akats7 it looks like you need to sign the CLA, also please format using ./gradlew spotlessApply. Thanks!

Hey @breedx-splk, thanks will do, I must be missing some metadata on a commit, I’ll rebase.

@trask trask merged commit 50dc6a2 into open-telemetry:main Dec 13, 2023
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants