-
Notifications
You must be signed in to change notification settings - Fork 1k
add nullaway to spring jms (part 2) #15409
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
base: main
Are you sure you want to change the base?
Conversation
...lemetry/javaagent/instrumentation/spring/jms/v6_0/JmsDestinationAccessorInstrumentation.java
Outdated
Show resolved
Hide resolved
| return null; | ||
| } | ||
| // suppress receive span creation in jms instrumentation | ||
| @SuppressWarnings("NullAway") // request is typed as Void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder if it would make sense to add @Nullable to the parameter in suppressSpan (and all the other downstream effects of that) to avoid having to suppress this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that - and it's not working (have to look up the details if required)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you check? I'm asking because the reason "request is typed as Void" doesn't really seem correct here. Rather the reason seems that the method really does accept Nullable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
InstrumenterUtil.suppressSpan() calls spanKindExtractor.extract(request) which doesn't accept a null request. Here it works because the instrumenter uses SpanKindExtractor.alwaysConsumer() that doesn't use the request.
The comment // request is typed as Void is misleading as here request is MessageWithDestination and the response is Void.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @laurit - I really got it wrong and fixed the comment now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like the honest thing to do:
i wonder if it would make sense to add
@Nullableto the parameter insuppressSpan(and all the other downstream effects of that) to avoid having to suppress this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like the honest thing to do:
i wonder if it would make sense to add
@Nullableto the parameter insuppressSpan(and all the other downstream effects of that) to avoid having to suppress this?
Then we'd need to make SpanKindExtractor#extract accept nullable. I'm not sure sure it is justified given suppressSpan is an internal method. What if we introduced a second suppressSpan method that accepted span kind instead of the request suppressSpan(Instrumenter<REQUEST, RESPONSE> instrumenter, Context parentContext, SpanKind spanKind) Since we know what the span kind is going to be we can avoid extracting it from the instrumenter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laurit that's an elegant solution! Added.
No description provided.