Skip to content

Commit 6588a70

Browse files
authored
Zipkin exporter report instrumentation info (#1097)
* Zipkin exporter report instrumentation info
1 parent 12f51bc commit 6588a70

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

exporter/opentelemetry-exporter-zipkin/CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
`port`, `protocol`, `endpoint`. This brings this implementation inline with other
88
implementations.
99
([#1064](https://github.com/open-telemetry/opentelemetry-python/pull/1064))
10+
- Zipkin exporter report instrumentation info.
11+
([#1097](https://github.com/open-telemetry/opentelemetry-python/pull/1097))
1012

1113
## Version 0.12b0
1214

exporter/opentelemetry-exporter-zipkin/src/opentelemetry/exporter/zipkin/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ def _translate_to_zipkin(self, spans: Sequence[Span]):
175175
"annotations": _extract_annotations_from_events(span.events),
176176
}
177177

178+
if span.instrumentation_info is not None:
179+
zipkin_span["tags"][
180+
"otel.instrumentation_library.name"
181+
] = span.instrumentation_info.name
182+
zipkin_span["tags"][
183+
"otel.instrumentation_library.version"
184+
] = span.instrumentation_info.version
185+
178186
if context.trace_flags.sampled:
179187
zipkin_span["debug"] = True
180188

exporter/opentelemetry-exporter-zipkin/tests/test_zipkin_exporter.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from opentelemetry.sdk import trace
2323
from opentelemetry.sdk.trace import Resource
2424
from opentelemetry.sdk.trace.export import SpanExportResult
25+
from opentelemetry.sdk.util.instrumentation import InstrumentationInfo
2526
from opentelemetry.trace import TraceFlags
2627

2728

@@ -191,6 +192,9 @@ def test_export(self):
191192
otel_spans[3].start(start_time=start_times[3])
192193
otel_spans[3].resource = Resource({})
193194
otel_spans[3].end(end_time=end_times[3])
195+
otel_spans[3].instrumentation_info = InstrumentationInfo(
196+
name="name", version="version"
197+
)
194198

195199
service_name = "test-service"
196200
local_endpoint = {"serviceName": service_name, "port": 9411}
@@ -252,7 +256,10 @@ def test_export(self):
252256
"duration": durations[3] // 10 ** 3,
253257
"localEndpoint": local_endpoint,
254258
"kind": None,
255-
"tags": {},
259+
"tags": {
260+
"otel.instrumentation_library.name": "name",
261+
"otel.instrumentation_library.version": "version",
262+
},
256263
"annotations": None,
257264
},
258265
]

0 commit comments

Comments
 (0)