-
Notifications
You must be signed in to change notification settings - Fork 825
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(instrumentation-grpc): instrument @grpc/grpc-js Client methods #3804
fix(instrumentation-grpc): instrument @grpc/grpc-js Client methods #3804
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3804 +/- ##
==========================================
+ Coverage 92.31% 92.35% +0.03%
==========================================
Files 321 321
Lines 9189 9249 +60
Branches 1953 1962 +9
==========================================
+ Hits 8483 8542 +59
- Misses 706 707 +1
|
7e1976f
to
f0448f4
Compare
Anything blocking getting this merged? Ive run into this issue also |
Currently, this is just missing reviews from @open-telemetry/javascript-approvers - we'll need to get at least one green check to merge, though I'd like to have at least two as this is quite a significant change. I don't know if the original authors of this instrumentation are still around, which further complicates the process. |
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Outdated
Show resolved
Hide resolved
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.
left a few comments but as I'm not an grpc expert may review doesn't cover all these inner grpc details.
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/index.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/test/grpc-protobuf-ts.test.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/tsconfig.json
Outdated
Show resolved
Hide resolved
1b468aa
to
4b681f4
Compare
1bbe68d
to
6e38f0f
Compare
Sorry for the force-push - I must've messed up my history somewhere and there were too many commits to figure out where it went wrong. 😞 |
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.
@Flarna, thank you for the review; it has been extremely helpful as I'm not as familiar with writing instrumentations as I'd like to be - I made some quite substantial changes since the last review based on your suggestions. 🙂
I added a few questions to your comments - mostly regarding modifying the pre-existing code that I moved to helper functions.
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-instrumentation-grpc/src/grpc-js/clientUtils.ts
Outdated
Show resolved
Hide resolved
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.
Really large change and I'm also not a grpc expert but it looks ok to me
Hey @pichlermarc, would it be possible to merge this soon? |
Yes, sorry @beeme1mr, I was out for a while and did not notice we already have enough approvals now. Failing EOL tests are unrelated (see #4030) |
/easycla Edit: looks like easycla is broken right now. communitybridge/easycla#4071, we'll have to wait until it's back. |
I think this lead to #4053 (but not sure, just digging around a bit)! |
Which problem is this PR solving?
Traces when using the
@openfeature/flagd-provider
are not connected as the@grpc/grpc-js
Client
methods used by@protobuf-ts/grpc-transport
are not instrumented, (see instance creation, makeUnaryRequest, makeServerStreamRequest, makeClientStreamRequest, makeBidiStreamRequest) .This was presumably not added initially as the
Client
class is only used via its prototype in clients generated bymakeGenericClientConstructor()
/makeClientConstructor()
, which means that patching the methods on theClient
class would not cause the patched method ever to be used.Because clients generated by
makeGenericClientConstructor()
/makeClientConstructor()
do not use the patched methods, it is possible to add instrumentation to those methods and not affect telemetry generated by the existing instrumentation code. This PR patches these un-instrumented client methods to provide context propagation and telemetry generation when theClient
is used directly.Fixes #3775
Short description of the changes
Adds instrumentation for the client methods
makeUnaryRequest
makeClientStreamRequest
makeServerStreamRequest
makeBidiStreamRequest
Type of change
I'm unsure whether to categorize this as a bugfix or a new feature. The
Client
class in@grpc/grpc-js
is public, therefore I think it is entirely possible that people would use the class directly, as is the case in@protobuf-ts/grpc-transport
How Has This Been Tested?
@grpc/grpc-js
@openfeature/flagd-provider
Checklist: