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

Include parent span in Jaeger thrift export #1836

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.1.0...HEAD)

### Changed
- Include span parent in Jaeger gRPC export as `CHILD_OF` reference
([#1809])(https://github.com/open-telemetry/opentelemetry-python/pull/1809)

### Added
- Added example for running Django with auto instrumentation.
([#1803](https://github.com/open-telemetry/opentelemetry-python/pull/1803))
Expand All @@ -28,6 +24,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1810](https://github.com/open-telemetry/opentelemetry-python/pull/1810))
- Fixed inconsistency in parent_id formatting from the ConsoleSpanExporter
([#1833](https://github.com/open-telemetry/opentelemetry-python/pull/1833))
- Include span parent in Jaeger gRPC export as `CHILD_OF` reference
([#1809])(https://github.com/open-telemetry/opentelemetry-python/pull/1809)
- Include span parent in Jaeger thrift export as `CHILD_OF` reference
([#1836])(https://github.com/open-telemetry/opentelemetry-python/pull/1836)

### Removed
- Moved `opentelemetry-instrumentation` to contrib repository.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,18 @@ def _extract_tags(self, span: ReadableSpan) -> Sequence[TCollector.Tag]:
def _extract_refs(
self, span: ReadableSpan
) -> Optional[Sequence[TCollector.SpanRef]]:
if not span.links:
return None

refs = []
if span.parent:
ctx = span.get_span_context()
parent_id = span.parent.span_id
parent_ref = TCollector.SpanRef(
refType=TCollector.SpanRefType.CHILD_OF,
traceIdHigh=_get_trace_id_high(ctx.trace_id),
traceIdLow=_get_trace_id_low(ctx.trace_id),
spanId=_convert_int_to_i64(parent_id),
)
refs.append(parent_ref)
for link in span.links:
trace_id = link.context.trace_id
span_id = link.context.span_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,18 @@ def test_translate_to_jaeger(self):
),
],
references=[
jaeger.SpanRef(
refType=jaeger.SpanRefType.CHILD_OF,
traceIdHigh=trace_id_high,
traceIdLow=trace_id_low,
spanId=parent_id,
),
jaeger.SpanRef(
refType=jaeger.SpanRefType.FOLLOWS_FROM,
traceIdHigh=trace_id_high,
traceIdLow=trace_id_low,
spanId=other_id,
)
),
],
logs=[
jaeger.Log(
Expand Down Expand Up @@ -414,6 +420,7 @@ def test_translate_to_jaeger(self):
duration=durations[1] // 10 ** 3,
flags=0,
tags=default_tags,
references=[],
),
jaeger.Span(
operationName=span_names[2],
Expand Down Expand Up @@ -446,6 +453,7 @@ def test_translate_to_jaeger(self):
vStr="version",
),
],
references=[],
),
]

Expand Down