Skip to content
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

feat(grpc-instrumentation): migrate grpc to instrumentation #1656 #1744

Merged
merged 12 commits into from
Jan 6, 2021

Conversation

vmarchaud
Copy link
Member

I needed few modifications of the base instrumentation to got the grpc plugin, they should be backward compatible except for the InstrumentationModuleFile constructor where i added supportedVersions as the second arguemnt to match InstrumentationNodeModuleFile.

As asked here, i think it would make sense to have both grpc/grpc-js in the same instrumentation, so i added the test suite from the grpc-utils package into this one while waiting to migrate grpc-js.

@codecov
Copy link

codecov bot commented Dec 12, 2020

Codecov Report

Merging #1744 (be1f987) into master (042a99a) will decrease coverage by 0.14%.
The diff coverage is 85.13%.

@@            Coverage Diff             @@
##           master    #1744      +/-   ##
==========================================
- Coverage   92.30%   92.16%   -0.15%     
==========================================
  Files         163      167       +4     
  Lines        5510     5845     +335     
  Branches     1188     1256      +68     
==========================================
+ Hits         5086     5387     +301     
- Misses        424      458      +34     
Impacted Files Coverage Δ
...strumentation/src/platform/node/instrumentation.ts 6.66% <0.00%> (-0.19%) ⬇️
...atform/node/instrumentationNodeModuleDefinition.ts 14.28% <0.00%> (ø)
...src/platform/node/instrumentationNodeModuleFile.ts 20.00% <0.00%> (-5.00%) ⬇️
...ges/opentelemetry-instrumentation-grpc/src/grpc.ts 92.52% <92.52%> (ø)
...es/opentelemetry-instrumentation-grpc/src/utils.ts 93.93% <93.93%> (ø)
...emetry-core/src/platform/node/RandomIdGenerator.ts 87.50% <0.00%> (-6.25%) ⬇️
...es/opentelemetry-context-zone-peer-dep/src/util.ts 100.00% <0.00%> (ø)
...ry-context-zone-peer-dep/src/ZoneContextManager.ts 85.18% <0.00%> (ø)

@obecny
Copy link
Member

obecny commented Dec 14, 2020

@vmarchaud should we wait until you add grpc-js too ?

@vmarchaud
Copy link
Member Author

@obecny I prefer to split this into two PR

@obecny
Copy link
Member

obecny commented Dec 14, 2020

@obecny I prefer to split this into two PR

whatever will be easier.

@vmarchaud vmarchaud force-pushed the grpc-instrumentation branch 2 times, most recently from dac7eed to 1e1eef4 Compare December 19, 2020 09:47
@vmarchaud vmarchaud linked an issue Dec 19, 2020 that may be closed by this pull request
@vmarchaud vmarchaud force-pushed the grpc-instrumentation branch 2 times, most recently from 4a9f735 to d14b40c Compare December 19, 2020 14:26
Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few issue with status code, other than that lgtm


private _getInternalPatchs() {
return [
new InstrumentationNodeModuleFile<GrpcInternalClientTypes>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: split this into 2 new internal function for better readability for example

private _getInternalPatchs() {
    return [
      this.patchClientVerTill1_6,
      this.patchClientVerAbove1_6,
    ]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since both patches were using the same duplicated code, i prefered to declare both onPatch and onUnPatch and just re-use them. PTAL

packages/opentelemetry-instrumentation-grpc/src/grpc.ts Outdated Show resolved Hide resolved
packages/opentelemetry-instrumentation-grpc/src/grpc.ts Outdated Show resolved Hide resolved
packages/opentelemetry-instrumentation-grpc/src/grpc.ts Outdated Show resolved Hide resolved
Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dyladan dyladan added the enhancement New feature or request label Jan 5, 2021
@dyladan dyladan merged commit b4c9e40 into open-telemetry:master Jan 6, 2021
dyladan added a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
…metry#1656 (open-telemetry#1744)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
dyladan added a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
…metry#1656 (open-telemetry#1744)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert grpc plugin to instrumentation
3 participants