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

Zipkin exporter report instrumentation info #1097

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions exporter/opentelemetry-exporter-zipkin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
`port`, `protocol`, `endpoint`. This brings this implementation inline with other
implementations.
([#1064](https://github.com/open-telemetry/opentelemetry-python/pull/1064))
- Zipkin exporter report instrumentation info.
([#1097](https://github.com/open-telemetry/opentelemetry-python/pull/1097))

## Version 0.12b0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,14 @@ def _translate_to_zipkin(self, spans: Sequence[Span]):
"annotations": _extract_annotations_from_events(span.events),
}

if span.instrumentation_info is not None:
zipkin_span["tags"][
"otel.instrumentation_library.name"
] = span.instrumentation_info.name
zipkin_span["tags"][
"otel.instrumentation_library.version"
] = span.instrumentation_info.version

if context.trace_flags.sampled:
zipkin_span["debug"] = True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from opentelemetry.sdk import trace
from opentelemetry.sdk.trace import Resource
from opentelemetry.sdk.trace.export import SpanExportResult
from opentelemetry.sdk.util.instrumentation import InstrumentationInfo
from opentelemetry.trace import TraceFlags


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

service_name = "test-service"
local_endpoint = {"serviceName": service_name, "port": 9411}
Expand Down Expand Up @@ -252,7 +256,10 @@ def test_export(self):
"duration": durations[3] // 10 ** 3,
"localEndpoint": local_endpoint,
"kind": None,
"tags": {},
"tags": {
"otel.instrumentation_library.name": "name",
"otel.instrumentation_library.version": "version",
},
"annotations": None,
},
]
Expand Down