opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

OpenTracing Bridge: allow more generic carriers

Open bboreham opened this issue 2 years ago • 7 comments

Instead of insisting that the carrier is an HTTPHeaders, cast it or adapt it to the interface we need - TextMapCarrier.

~It's a bit long-winded to wrap the read and write side separately, but this gives maximum flexibility.~

Fixes #2137 - @kvrhdn has used this fork to create a working program.

bboreham avatar Jul 29 '21 14:07 bboreham

Codecov Report

Merging #2141 (8c48780) into main (1884de2) will increase coverage by 0.2%. The diff coverage is 78.7%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2141     +/-   ##
=======================================
+ Coverage   75.7%   75.9%   +0.2%     
=======================================
  Files        178     178             
  Lines      11703   11740     +37     
=======================================
+ Hits        8864    8922     +58     
+ Misses      2614    2584     -30     
- Partials     225     234      +9     
Impacted Files Coverage Δ
bridge/opentracing/bridge.go 53.1% <78.7%> (+9.5%) :arrow_up:
sdk/trace/batch_span_processor.go 80.2% <0.0%> (-1.0%) :arrow_down:
exporters/jaeger/jaeger.go 91.1% <0.0%> (+0.8%) :arrow_up:

codecov[bot] avatar Jul 29 '21 14:07 codecov[bot]

I can confirm this fixes our issue, propagation context can be injected and extracted without error now 🙂

kvrhdn avatar Jul 29 '21 16:07 kvrhdn

Ping @bboreham. Rebase needed and some feedback to look at.

hickeyma avatar Mar 28 '22 09:03 hickeyma

Ack. It hasn't been high enough up my priority list lately.

bboreham avatar Mar 28 '22 11:03 bboreham

Rebased and added unit tests for the Inject/Extract functionality added in this PR.

Note that ot.HTTPHeadersCarrier needs special treatment - Set() modifies the keys to meet HTTP header expectations - so we can't use the generic wrapper I added in that case.

It appears baggage was never propagated by BridgeTracer, so that is not included in the test.

bboreham avatar Apr 18 '22 11:04 bboreham

Does https://github.com/open-telemetry/opentelemetry-go/pull/2911 meet the needs here, or is there more required?

Aneurysm9 avatar Jul 06 '22 23:07 Aneurysm9

Does https://github.com/open-telemetry/opentelemetry-go/pull/2911 meet the needs here

Strictly no, however I think #2911 makes it easier to work around the deficiency.

~Perhaps you will update the doc says it should work with TextMapWriter?~ EDIT that doc is in OpenTracing so I realise OpenTelemetry would not update it.

Do you have any response to https://github.com/open-telemetry/opentelemetry-go/pull/2141#issuecomment-1101314799 ?

bboreham avatar Jul 10 '22 17:07 bboreham

@MrAlias Do you have any further feedback for this PR please?

zalegrala avatar Sep 28 '22 19:09 zalegrala