-
Notifications
You must be signed in to change notification settings - Fork 871
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
Messaging convention reviewed #1297
Conversation
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 didn't get through everything, but have a couple of initial comments
public enum Operation { | ||
send, | ||
receive, | ||
process | ||
} |
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.
Are these only used as string constants? If so string constants in JMSTracer
seems more natural
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.
Having string input parameter allows for passing any string. In this case only these 3 values are allowed by convention.
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.
Makes sense 👍
Btw, the lowercase enum names are throwing me a bit, can we change to SEND("send")
? I think that's more conventional.
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 I answer you "no"? :) The "convention" to have enum elements all in uppercase baffles me. Why should we wrap desired values (lowercase in this case as per spec) in identical uppercase strings? What benefit that brings?
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.
The "convention" to have enum elements all in uppercase baffles me
Curious if you disagree that it is conventional for enums to be uppercase in Java? Or if you disagree that we should follow this convention?
The point of following convention is that it helps people reading the code. When I see Operation.send
in code, it looks like direct non-constant field access, and takes me more time to understand than it's worth.
Also we document in CONTRIBUTING.md that we follow Google Java Style Guide so would suggest we lean on that for style / convention questions where possible.
Happy to accept @anuraaga as tie-breaker vote either way though 👍😄
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 find strange the notion "constants should be UPPERCASE in Java". But in general that is indeed, not important and we should just follow coding style.
But it is more important, IMO, when such coding style forces clumsier design. And I think that SEND("send")
is clumsy.
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.
Generally LGTM
...11/src/main/java/io/opentelemetry/instrumentation/auto/kafkaclients/KafkaConsumerTracer.java
Outdated
Show resolved
Hide resolved
cdebeaf
to
bef7b0e
Compare
Closes #983 |
@trask I have filed open-telemetry/opentelemetry-specification#1085. It also contains my proposal, how parent-child relationship should be modelled for messaging spans. |
b79511d
to
89dfb39
Compare
@trask Updated parents as well. I mostly agreed with you, as you can probably see from my spec issue :) |
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.
👍
Last remaining comment is about the uppercase enums.
Yeah, I still don't like the idea of wrapping actual values just to have uppercase names. |
It's not "just to have uppercase names". It's to make your code easier for other people to read. When you go against a widely followed convention like this, you make your code harder for other people to read. E.g. when I was reviewing this PR and ran across the first reference, |
(grumpy) ok-ok, make sense :( will do |
@trask No, I still don't like. You suggested to have And I don't like the idea of always doing |
Also, do you have any suggestions, how to merge your packages changes into this? :) |
How about just using |
Removed enum altogether, will replace with open-telemetry/opentelemetry-java#1783 after we switch to 0.10.0 |
@iNikem I will fix the conflicts later today since I caused them 😁 |
…y-java-instrumentation into messaging-convention
Closes #983
Closes #1031