Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

feat!: support user-specified context header propagation#1029

Merged
kjin merged 2 commits intogoogleapis:masterfrom
kjin:propagation
May 20, 2019
Merged

feat!: support user-specified context header propagation#1029
kjin merged 2 commits intogoogleapis:masterfrom
kjin:propagation

Conversation

@kjin
Copy link
Copy Markdown
Contributor

@kjin kjin commented May 17, 2019

Fixes #949, supercedes #950

With this change:

  • Trace context header extraction and injection has been abstracted out of plugins and now exists in the Tracer.
  • Its default underlying implementation is @opencensus/propagation-stackdriver (behavior should match what the plugins do currently)
  • APIs that make an assumption about trace context format have been removed or changed. In particular (this is a semver-major change):
    • Tracer#traceContextUtils no longer has methods for encoding and decoding trace context as a string.
    • The following APIs accept/return TraceContext objects instead of strings:
      • Tracer#getResponseTraceContext
      • Tracer#createRootSpan
      • Span#getTraceContext
  • Users can now set the propagation field with an instance of OpenCensusPropagation to override the default implementation.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 17, 2019
@kjin kjin force-pushed the propagation branch 2 times, most recently from de17efe to f700581 Compare May 17, 2019 22:21
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2019

Codecov Report

Merging #1029 into master will increase coverage by 0.09%.
The diff coverage is 93.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1029      +/-   ##
==========================================
+ Coverage   94.89%   94.98%   +0.09%     
==========================================
  Files          96       96              
  Lines        6226     6246      +20     
  Branches      484      474      -10     
==========================================
+ Hits         5908     5933      +25     
+ Misses        161      159       -2     
+ Partials      157      154       -3
Impacted Files Coverage Δ
src/index.ts 88.88% <ø> (ø) ⬆️
src/config.ts 100% <ø> (ø) ⬆️
test/plugins/common.ts 95.65% <100%> (+0.06%) ⬆️
test/test-config-plugins.ts 100% <100%> (ø) ⬆️
src/tracing.ts 89.65% <100%> (+0.56%) ⬆️
test/test-plugin-loader.ts 98.66% <100%> (ø) ⬆️
test/test-index.ts 100% <100%> (ø) ⬆️
src/plugins/plugin-hapi.ts 92% <100%> (+3.32%) ⬆️
src/plugins/plugin-http2.ts 85.71% <100%> (+0.25%) ⬆️
src/plugins/plugin-koa.ts 91.07% <100%> (+2.93%) ⬆️
... and 13 more

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 c63bb14...f700581. Read the comment docs.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2019

Codecov Report

Merging #1029 into master will increase coverage by 0.06%.
The diff coverage is 91.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1029      +/-   ##
==========================================
+ Coverage   94.89%   94.95%   +0.06%     
==========================================
  Files          96       96              
  Lines        6226     6249      +23     
  Branches      484      475       -9     
==========================================
+ Hits         5908     5934      +26     
+ Misses        161      160       -1     
+ Partials      157      155       -2
Impacted Files Coverage Δ
src/index.ts 88.88% <ø> (ø) ⬆️
src/config.ts 100% <ø> (ø) ⬆️
test/plugins/common.ts 95.65% <100%> (+0.06%) ⬆️
test/test-config-plugins.ts 100% <100%> (ø) ⬆️
src/tracing.ts 89.65% <100%> (+0.56%) ⬆️
test/test-plugin-loader.ts 98.66% <100%> (ø) ⬆️
test/test-index.ts 100% <100%> (ø) ⬆️
src/plugins/plugin-hapi.ts 92% <100%> (+3.32%) ⬆️
src/plugins/plugin-http2.ts 85.71% <100%> (+0.25%) ⬆️
src/plugins/plugin-koa.ts 91.07% <100%> (+2.93%) ⬆️
... and 13 more

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 c63bb14...2761f2b. Read the comment docs.

@kjin kjin marked this pull request as ready for review May 17, 2019 22:35
@kjin kjin requested review from a team and removed request for a team May 17, 2019 22:35
kjin added 2 commits May 17, 2019 15:49
BREAKING CHANGE: This change modifies/removes APIs that assume a
particular format for trace context headers; in other words, any
place where the user would deal with a stringified trace context,
they would now deal with a TraceContext object instead. This affects
three APIs: `getResponseTraceContext` (input/output has changed from
string to TraceContext), `createRootSpan` (input RootSpanOptions
now accepts a TraceContext instead of a string in the traceContext
field), and `Span#getTraceContext` (output has changed from string
to TraceContext).
@kjin kjin requested a review from a team May 20, 2019 18:45
@kjin kjin merged commit 28ecb16 into googleapis:master May 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Extract and propagate B3 headers

3 participants