Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Add support for gRPC tags propagation #443

Merged

Conversation

mayurkale22
Copy link
Member

Fixes #325

This PR contains the following changes

  1. Share same contextManager across tracer and stats singleton instances.
  2. Add withTagContext and getCurrentTagContext API on stats, so that plugins can use these API to get current TagContext/TagMap.
  3. Make a deep copy of TagMap during get/set into contextManager.
  4. Insert/Get gRPC metadata with grpc-tags-bin header with serialized TagMap.
  5. Update tag-context-example.js example.

@codecov-io
Copy link

codecov-io commented Mar 25, 2019

Codecov Report

Merging #443 into master will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #443      +/-   ##
=========================================
+ Coverage   95.02%   95.1%   +0.07%     
=========================================
  Files         149     149              
  Lines        9655    9760     +105     
  Branches      683     690       +7     
=========================================
+ Hits         9175    9282     +107     
+ Misses        480     478       -2
Impacted Files Coverage Δ
src/index.ts 100% <0%> (ø) ⬆️
src/stats/types.ts 100% <0%> (ø) ⬆️
src/tags/tagger.ts 100% <0%> (ø) ⬆️
test/test-tagger.ts 100% <0%> (ø) ⬆️
test/test-grpc.ts 99.49% <0%> (+0.11%) ⬆️
src/stats/stats.ts 98.27% <0%> (+0.19%) ⬆️
src/grpc.ts 94.11% <0%> (+0.39%) ⬆️
src/internal/cls-ah.ts 53.96% <0%> (+2.35%) ⬆️
src/internal/cls.ts 91.66% <0%> (+9.84%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5a49c1...9b62e2b. Read the comment docs.

Copy link
Contributor

@draffensperger draffensperger left a comment

Choose a reason for hiding this comment

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

Cool! It looks like the grpc-tags-bin header is only being serialized/deserialized in the getTagContext/setTagContext helper functions. Are those called automatically when gRPC calls happen? (Or will that be in a follow-up CL?)

packages/opencensus-instrumentation-grpc/src/grpc.ts Outdated Show resolved Hide resolved
@mayurkale22
Copy link
Member Author

Cool! It looks like the grpc-tags-bin header is only being serialized/deserialized in the getTagContext/setTagContext helper functions. Are those called automatically when gRPC calls happen? (Or will that be in a follow-up CL?)

I have added hook to use these functions during gRPC incoming request and outgoing request .

Copy link
Contributor

@draffensperger draffensperger left a comment

Choose a reason for hiding this comment

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

Cool, nice that the gRPC plugins now support tags with those new changes.

@mayurkale22 mayurkale22 merged commit c5a7d07 into census-instrumentation:master Mar 27, 2019
@mayurkale22 mayurkale22 deleted the context_manager branch March 27, 2019 17:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants