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 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
3 changes: 2 additions & 1 deletion exporter/opentelemetry-exporter-jaeger/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## Unreleased

- Drop support for Python 3.4
([#1099](https://github.com/open-telemetry/opentelemetry-python/pull/1099))
- Report instrumentation info
([#1098](https://github.com/open-telemetry/opentelemetry-python/pull/1098))

## Version 0.12b0

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