Jaeger exporter report instrumentation info (#1098)
This commit is contained in:
parent
6dce5c3157
commit
9e9905fa30
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from opentelemetry import trace as trace_api
|
|||
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
|
||||
|
||||
|
||||
|
|
@ -221,6 +222,9 @@ class TestJaegerSpanExporter(unittest.TestCase):
|
|||
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)
|
||||
|
|
@ -334,7 +338,33 @@ class TestJaegerSpanExporter(unittest.TestCase):
|
|||
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",
|
||||
),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue