-
Notifications
You must be signed in to change notification settings - Fork 518
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
fix(net.peer.port): net.peer.port needs to be a number not a string #1916
Conversation
5f1372f
to
c9b3671
Compare
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.
Looks good! 🙂
Thanks for taking care of this. 🙂
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1916 +/- ##
==========================================
- Coverage 91.02% 91.00% -0.03%
==========================================
Files 146 146
Lines 7478 7491 +13
Branches 1497 1502 +5
==========================================
+ Hits 6807 6817 +10
- Misses 671 674 +3
|
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.
Ah looks like the tests also need to be updated (they assert that the values are string
s, instead of number
)
@pichlermarc let me know if the test look better now |
45cdd3d
to
6c7e62e
Compare
Signed-off-by: esara <endresara@gmail.com>
@esara, please don't force-push. It makes it hard to review the PR because the history disappears every time I check back 😅 (also makes it hard to see if the tests were passing as I have to dig into old workflow runs to find the run that was associated with the commit before the force-push) |
I noticed that a number of contrib instrumentation populated the net.peer.port as a string parsed out of the connection string. This not only violates the semantic convensations, but in same cases causes and exception the the span attributes are parsed. https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/semantic_conventions/database.md#connection-level-attributes
Which problem is this PR solving?
This is related to #781
More specifically, there is an inconsistency, where the port variable is a string in multiple instrumentation (memcached, mongodb, mysql/mysql2, mongodb) for example
https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-mongodb/src/instrumentation.ts#L802
compared to other instrumentation, where is correctly defined as an int (cassandra and others)
https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/plugins/node/opentelemetry-instrumentation-cassandra/src/instrumentation.ts#L179
Short description of the changes
Making sure that the net.peer.port attribute is a number instead of a string
BEGIN_COMMIT_OVERRIDE
fix(instrumentation-memcached): parse attribute value for net.peer.port to a number
fix(instrumentation-mongodb): parse attribute value for net.peer.port to a number
fix(instrumentation-mysql): parse attribute value for net.peer.port to a number
fix(instrumentation-mysql2): parse attribute value for net.peer.port to a number
END_COMMIT_OVERRIDE