GRPC instrumentation. Added new attributes according to the OpenTelemetry rpc convention #3127
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is extending old one. Feel free to check it if needs comments
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