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

Jaeger exporter report instrumentation info #1098

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions exporter/opentelemetry-exporter-jaeger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

- Report instrumentation info
([#1098](https://github.com/open-telemetry/opentelemetry-python/pull/1098))

## Version 0.12b0

Released 2020-08-14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,20 @@ def _translate_to_jaeger(spans: Span):
]
)

if span.instrumentation_info is not None:
tags.extend(
[
_get_string_tag(
"otel.instrumentation_library.name",
span.instrumentation_info.name,
),
_get_string_tag(
"otel.instrumentation_library.version",
span.instrumentation_info.version,
),
]
)

# Ensure that if Status.Code is not OK, that we set the "error" tag on the Jaeger span.
if status.canonical_code is not StatusCanonicalCode.OK:
tags.append(_get_bool_tag("error", True))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from opentelemetry.exporter.jaeger.gen.jaeger import ttypes as jaeger
from opentelemetry.sdk import trace
from opentelemetry.sdk.trace import Resource
from opentelemetry.sdk.util.instrumentation import InstrumentationInfo
from opentelemetry.trace.status import Status, StatusCanonicalCode


Expand Down Expand Up @@ -221,6 +222,9 @@ def test_translate_to_jaeger(self):
otel_spans[2].start(start_time=start_times[2])
otel_spans[2].resource = Resource({})
otel_spans[2].end(end_time=end_times[2])
otel_spans[2].instrumentation_info = InstrumentationInfo(
name="name", version="version"
)

# pylint: disable=protected-access
spans = jaeger_exporter._translate_to_jaeger(otel_spans)
Expand Down Expand Up @@ -334,7 +338,33 @@ def test_translate_to_jaeger(self):
startTime=start_times[2] // 10 ** 3,
duration=durations[2] // 10 ** 3,
flags=0,
tags=default_tags,
tags=[
jaeger.Tag(
key="status.code",
vType=jaeger.TagType.LONG,
vLong=StatusCanonicalCode.OK.value,
),
jaeger.Tag(
key="status.message",
vType=jaeger.TagType.STRING,
vStr=None,
),
jaeger.Tag(
key="span.kind",
vType=jaeger.TagType.STRING,
vStr=trace_api.SpanKind.INTERNAL.name,
),
jaeger.Tag(
key="otel.instrumentation_library.name",
vType=jaeger.TagType.STRING,
vStr="name",
),
jaeger.Tag(
key="otel.instrumentation_library.version",
vType=jaeger.TagType.STRING,
vStr="version",
),
],
),
]

Expand Down