Skip to content

document load plugin assumes w3c trace context propagator #275

Description

@mwear

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

otel v0.12.x, document-load v0.11.0

What did you do?

Configured b3 context propagation

What did you expect to see?

A connected trace

Additional context

The document-load plugin assumes that there is a meta tag named traceparent in a response and sythesizes a carrier using it. See:

const metaElement = [...document.getElementsByTagName('meta')].find(
e => e.getAttribute('name') === TRACE_PARENT_HEADER
);
const entries = this._getEntries();
const traceparent = (metaElement && metaElement.content) || '';
context.with(propagation.extract({ traceparent }), () => {

This does not work if you are using b3 context propagation, as it does not understand carrier built with a hardcoded traceparent. It needs a carrier built with the fields expected by a B3 propagator. I think we could make this plugin propagator agnostic by doing the following:

  • instead of writing a traceparent as a meta tag in an http response, write a metatag for each field in Propagator#fields
  • the document load plugin can synthesize a carrier by iterating over Propagator#fields and looking for corresponding meta tags. use that carrier when extracting here

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions