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: add gRPC Census propagator #39

Merged
merged 9 commits into from
Jun 2, 2020
Merged

feat: add gRPC Census propagator #39

merged 9 commits into from
Jun 2, 2020

Conversation

nkelly75
Copy link
Contributor

Signed-off-by: Kelly, Niall [email protected]

Which problem is this PR solving?

Aims to address issue #35 i.e. creation of a binary gRPC census propagator. This is intended to provide interoperability with existing services that use gRPC and are instrumented with OpenCensus. I have tested this using a fork of the microservices-demo where most services were already instrumented using OpenCensus but I had modified one node service to use direct OpenTelemetry instrumentation.

Short description of the changes

The new propagator, GrpcCensusPropagator, implements the existing HttpTextPropagator interface allowing its inject/extract implementations to be called from the existing GrpcPlugin in @opentelemetry/plugin-grpc. The binary encoding/decoding actually happens in BinaryTraceContext.ts which is derived from previous work by @mayurkale22 (more details in README.md).

The commit includes unit tests with full coverage of the two main src files.

The new Propagator should compile, lint and test successfully e.g. using lerna bootstrap and lerna run test --scope @opentelemetry/propagator-grpc.

However, I encountered some issues elsewhere in the monorepo e.g.

  • typescript compiler errors for packages/opentelemetry-test-utils (which impacted unit tests elsewhere)
  • test failures for `plugins/node/opentelemetry-plugin-mongodb'

I anticipate these may come up as part of the merge checks.

Signed-off-by: Kelly, Niall <[email protected]>
Signed-off-by: Kelly, Niall <[email protected]>
@nkelly75
Copy link
Contributor Author

I signed it

Copy link
Member

@mayurkale22 mayurkale22 left a comment

Choose a reason for hiding this comment

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

Welcome to OpenTelemetry Community!

Added first pass comments, did you get a chance to verify this propagator in sample example or somewhere else?

@@ -0,0 +1,69 @@
{
"name": "@opentelemetry/propagator-grpc-census-binary",
"version": "0.0.2",
Copy link
Member

Choose a reason for hiding this comment

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

s/0.0.2/0.7.0: this is the current ongoing version of contrib packages (generally, we tried to keep versions in the sync).

"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"typescript": "3.7.2",
"webpack": "^4.35.2"
Copy link
Member

Choose a reason for hiding this comment

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

I think this is unused dependency.

"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
"@types/webpack-env": "1.13.9",
Copy link
Member

Choose a reason for hiding this comment

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

same here.

"devDependencies": {
"@types/mocha": "^7.0.0",
"@types/node": "^12.6.8",
"@types/sinon": "^7.0.13",
Copy link
Member

Choose a reason for hiding this comment

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

same here.

"codecov": "^3.6.1",
"grpc": "^1.24.2",
"gts": "^1.1.0",
"istanbul-instrumenter-loader": "^3.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

same here.

* limitations under the License.
*/

// This file is the webpack entry point for the browser Karma tests. It requires
Copy link
Member

Choose a reason for hiding this comment

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

This propagator is not applicable for browser, please remove this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @mayurkale22. I will address your comments tomorrow.

Yes, I did verify this propagator (both inbound and outbound gRPC, from/to services instrumented with OpenCensus) as part of the fork of microservices-demo mentioned in the description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Latest commit should hopefully cover your first pass @mayurkale22. (FYI, next "I signed it" comment is related to CLA for CNCF).

@nkelly75
Copy link
Contributor Author

I signed it

@WillsonHG
Copy link

/check-cla

@dyladan
Copy link
Member

dyladan commented May 29, 2020

@WillsonHG I believe @nkelly75 needs to be the one to comment to get the cla rechecked

@nkelly75
Copy link
Contributor Author

/check-cla

@nkelly75
Copy link
Contributor Author

I signed it

Signed-off-by: Kelly, Niall <[email protected]>
*
* @param context - Context to be injected
* @param carrier - Carrier in which to inject (for gRPC this will
* be a grpc.Metadata object)
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest to add 4 spaces to show the continuation of previous comment.

* @param carrier - Carrier in which to inject (for gRPC this will
* be a grpc.Metadata object)
* @param setter - setter function that sets the correct key in
* the carrier
Copy link
Member

Choose a reason for hiding this comment

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

same here.

@codecov
Copy link

codecov bot commented May 31, 2020

Codecov Report

Merging #39 into master will increase coverage by 0.15%.
The diff coverage is 97.00%.

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage   94.32%   94.47%   +0.15%     
==========================================
  Files          57       62       +5     
  Lines        3294     3494     +200     
  Branches      351      376      +25     
==========================================
+ Hits         3107     3301     +194     
- Misses        187      193       +6     
Impacted Files Coverage Δ
...metry-propagator-grpc-census-binary/src/version.ts 0.00% <0.00%> (ø)
...pc-census-binary/test/GrpcCensusPropagator.test.ts 94.50% <94.50%> (ø)
...gator-grpc-census-binary/src/BinaryTraceContext.ts 100.00% <100.00%> (ø)
...tor-grpc-census-binary/src/GrpcCensusPropagator.ts 100.00% <100.00%> (ø)
...grpc-census-binary/test/BinaryTraceContext.test.ts 100.00% <100.00%> (ø)

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 to me

Signed-off-by: Kelly, Niall <[email protected]>
@mayurkale22 mayurkale22 added the enhancement New feature or request label Jun 2, 2020
@dyladan
Copy link
Member

dyladan commented Jun 2, 2020

@mayurkale22 if you're ok with it, I'll release just this package when it merges as 0.8.0 and make an addendum to the changelog noting that this was released.

@mayurkale22
Copy link
Member

@mayurkale22 if you're ok with it, I'll release just this package when it merges as 0.8.0 and make an addendum to the changelog noting that this was released.

Sounds good to me. Let's do that.

@mayurkale22 mayurkale22 merged commit 193cd1b into open-telemetry:master Jun 2, 2020
@nkelly75 nkelly75 deleted the census-propagator branch June 4, 2020 10:07
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.

5 participants