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

datadog: do not add None tracestate value. #368

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Rename `IdsGenerator` to `IdGenerator`
([#350](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/350))
- `opentelemetry-exporter-datadog` Fix warning when DatadogFormat encounters a request with
no DD_ORIGIN headers ([#368](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/368)).

## [0.18b0](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/v0.18b0) - 2021-02-16

Expand All @@ -21,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#345](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/345))

### Removed
- Remove `component` span attribute in instrumentations.
- Remove `component` span attribute in instrumentations.
`opentelemetry-instrumentation-aiopg`, `opentelemetry-instrumentation-dbapi` Remove unused `database_type` parameter from `trace_integration` function.
([#301](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/301))
- `opentelemetry-instrumentation-asgi` Return header values using case insensitive keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@


class DatadogFormat(TextMapPropagator):
"""Propagator for the Datadog HTTP header format.
"""
"""Propagator for the Datadog HTTP header format."""

TRACE_ID_KEY = "x-datadog-trace-id"
PARENT_ID_KEY = "x-datadog-parent-id"
Expand Down Expand Up @@ -65,12 +64,15 @@ def extract(
if trace_id is None or span_id is None:
return set_span_in_context(trace.INVALID_SPAN, context)

trace_state = []
if origin is not None:
trace_state.append((constants.DD_ORIGIN, origin))
span_context = trace.SpanContext(
trace_id=int(trace_id),
span_id=int(span_id),
is_remote=True,
trace_flags=trace_flags,
trace_state=trace.TraceState([(constants.DD_ORIGIN, origin)]),
trace_state=trace.TraceState(trace_state),
)

return set_span_in_context(
Expand Down