-
Notifications
You must be signed in to change notification settings - Fork 821
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
Grpc instrumentation attributes fix #3089
Grpc instrumentation attributes fix #3089
Conversation
|
@@ -19,7 +19,9 @@ | |||
*/ | |||
export enum AttributeNames { | |||
GRPC_KIND = 'grpc.kind', // SERVER or CLIENT | |||
GRPC_METHOD = 'grpc.method', | |||
GRPC_METHOD = 'rpc.method', |
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 think the RPC_METHOD
of @opentelemetry/semantic-convention
could be used for 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.
See:
opentelemetry-js/packages/opentelemetry-semantic-conventions/src/trace/SemanticAttributes.ts
Line 676 in 747c404
RPC_METHOD: 'rpc.method', |
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.
nice point, will update
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.
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.
LGTM
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.
Thank you for your contribution!
experimental/packages/opentelemetry-instrumentation-grpc/src/enums/AttributeNames.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc/index.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts
Outdated
Show resolved
Hide resolved
@legendecas |
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.
Thank you for your contribution!
|
||
export const AttributeNames: Readonly<AttributesType> = { | ||
RPC_SYSTEM: RPC_SYSTEM, | ||
GRPC_METHOD: RPC_METHOD, |
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.
Nit: might be worth preventing introducing new names for existing semantic attributes.
GRPC_METHOD: RPC_METHOD, | |
RPC_METHOD, |
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.
might be worth directy using SemanticAttributes.RPC_METHOD
directly and removing it them from AttributeNames
IMO
CLA check is still not green: #3089 (comment). You may need to revisit your commit author to ensure all your commits were authorized. |
experimental/packages/opentelemetry-instrumentation-grpc/src/utils.ts
Outdated
Show resolved
Hide resolved
|
||
export const AttributeNames: Readonly<AttributesType> = { | ||
RPC_SYSTEM: RPC_SYSTEM, | ||
GRPC_METHOD: RPC_METHOD, |
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.
might be worth directy using SemanticAttributes.RPC_METHOD
directly and removing it them from AttributeNames
IMO
Codecov Report
@@ Coverage Diff @@
## main #3089 +/- ##
==========================================
- Coverage 93.07% 92.67% -0.41%
==========================================
Files 195 174 -21
Lines 6384 5513 -871
Branches 1347 1165 -182
==========================================
- Hits 5942 5109 -833
+ Misses 442 404 -38
|
…ewzenkov/opentelemetry-js into grpc-instrumentation-attributes-fix
I can see they are not authorized |
Looks like some of the commits have a different author email which is making them miss out on the CLA. A rebase is probably fine since the PR squashes anyway so individual commits aren't that important. |
@andrewzenkov I would squash the commits and reset the author email of the commits to the one correctly authorized. I'm not sure about the policy regarding merging unauthorized commits. I'd be happy to defer to @dyladan's opinion. |
The policy is that no unauthorized commits will be merged |
I created new PR as extended from it with authorized commit and all necessary changes Please add necessary labels, and mark current PR as closed or draft :) |
Which problem is this PR solving?
Opentelemtry grpc instrumentation is not consistent in terms of creating grpc attributes in requests.
For example in Java/Python instrumentations it contains necessary attributes for grpc connection:
But these attributes are missed in js grpc instrumentation. It doesn't set attributes.
Additionally, if compare Python/Java and Nodejs attributes.
Already existing attribute
rpc.method
is implemented incorrectly in Nodejs.opentelemetry-js/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Line 131 in 747c404
Fixes # (issue)
Short description of the changes
rpc.method
fromgrpc.method
torpc.method
attribute (Client, Server)rpc.service
attribute (Client, Server)rpc.system
attribute (Client, Server)rpc.method
value calculating for some use case. (it should be method, but value is just full path)Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Create GRPC example, run opentelemetry SDK using authoinstrumentation, or manually set
new GrpcInstrumentation()
, you will see that Grpc instrumentation detects grpc connection and creates spans but with missing attributes:And for client rpc.method has incorrect value.
opentelemetry-js/experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Line 131 in 747c404
Before:
Client/server
After:
Client/Server