-
Notifications
You must be signed in to change notification settings - Fork 867
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
Update net semantic convention changes #6268
Update net semantic convention changes #6268
Conversation
...java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java
Outdated
Show resolved
Hide resolved
Just my 2c
I think it's more important to have the API be easy to use (to make instrumenting things easier), rather than make it as close to semantic conventions. It's kind of the point to hide the complexities, different cases and requirements of the semantic conventions behind a very simple getter interface. The HTTP attributes extractors (the server one in particular) are a good example of that, as they add a significant chunk of very much needed logic over the raw values provided by a getter.
We could always have 2 different getter interfaces for different scenarios, and have separate factory methods for raw data/ |
...java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java
Outdated
Show resolved
Hide resolved
it seems the post-processing (beyond setting attributes) is checking if sock attributes are not the same as net.peer. attributes, which doesn't seem too bad or magical, does it? BTW, since we now have conditionally required attributes defined, it's a common pattern to guard attribute setting by something: default value, different from another attribute, another attribute set/not set. |
thx both, I'm sold on this approach 👍 |
if (peerService == null) { | ||
String peerIp = attributesGetter.peerIp(request, response); | ||
peerService = mapToPeerService(peerIp); | ||
} |
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.
alternatively we could check both net.sock.peer.addr
and net.sock.peer.name
, but now that we are putting IP address into net.peer.name
when there's no hostname I don't think there is a need(?)
...in/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java
Outdated
Show resolved
Hide resolved
...in/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java
Outdated
Show resolved
Hide resolved
...in/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesGetter.java
Show resolved
Hide resolved
...java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...in/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java
Show resolved
Hide resolved
...java/io/opentelemetry/instrumentation/api/instrumenter/net/NetClientAttributesExtractor.java
Outdated
Show resolved
Hide resolved
...in/java/io/opentelemetry/instrumentation/api/instrumenter/net/NetServerAttributesGetter.java
Outdated
Show resolved
Hide resolved
@trask do you think this is ready for merge? Should we add it to 1.17? |
oops, I thought I had merged this! just fixed merge conflicts, yes I think we should merge it for 1.17 |
* New net conventions: option a * Feedback + sock.family + sock.peer.name * peer.service + tests * server net attributes attempt 1 * server net attributes attempt 2 * Javadoc * Revisions * Apply to instrumentations * Feedback * One more default method * Spotless * Fix javadoc
* New net conventions: option a * Feedback + sock.family + sock.peer.name * peer.service + tests * server net attributes attempt 1 * server net attributes attempt 2 * Javadoc * Revisions * Apply to instrumentations * Feedback * One more default method * Spotless * Fix javadoc
* New net conventions: option a * Feedback + sock.family + sock.peer.name * peer.service + tests * server net attributes attempt 1 * server net attributes attempt 2 * Javadoc * Revisions * Apply to instrumentations * Feedback * One more default method * Spotless * Fix javadoc
Pros:
Cons:
NetClientAttributesGetter
and the semantic attributes feels a little magic because of the post-processing done inNetClientAttributesExtractor
Option B: don't do any post-processing in
NetClientAttributesExtractor
Pros:
NetClientAttributesGetter
and semantic attributesCons:
InetSocketAddressNetClientAttributesGetter
methods, which starts to feel inefficient since they are all called:Option C: introduce
InetSocketAddressNetClientAttributesExtractor
...and change
InetSocketAddressNetClientAttributesGetter
to only exposeaddress
andtransport
Pros:
Cons:
NetClientAttributesGetter
that is always used for net client attributes, which is currently useful inPeerServiceAttributesExtractor
and could be useful in other places in the future