Revert "Zipkin: Fix OTLP events to Zipkin annotations translation (#1161)"
This reverts commit 6222b2aabe.
This commit is contained in:
parent
bb25b97cd7
commit
764ead9ce1
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
- Zipkin exporter now accepts a ``max_tag_value_length`` attribute to customize the
|
- Zipkin exporter now accepts a ``max_tag_value_length`` attribute to customize the
|
||||||
maximum allowed size a tag value can have. ([#1151](https://github.com/open-telemetry/opentelemetry-python/pull/1151))
|
maximum allowed size a tag value can have. ([#1151](https://github.com/open-telemetry/opentelemetry-python/pull/1151))
|
||||||
- Fixed OTLP events to Zipkin annotations translation. ([#1161](https://github.com/open-telemetry/opentelemetry-python/pull/1161))
|
|
||||||
|
|
||||||
## Version 0.13b0
|
## Version 0.13b0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -237,25 +237,20 @@ class ZipkinSpanExporter(SpanExporter):
|
||||||
tags.update(self._extract_tags_from_dict(span.resource.attributes))
|
tags.update(self._extract_tags_from_dict(span.resource.attributes))
|
||||||
return tags
|
return tags
|
||||||
|
|
||||||
def _extract_annotations_from_events(self, events):
|
def _extract_annotations_from_events(
|
||||||
if not events:
|
self, events
|
||||||
return None
|
): # pylint: disable=R0201
|
||||||
|
return (
|
||||||
annotations = []
|
[
|
||||||
for event in events:
|
|
||||||
attrs = {}
|
|
||||||
for key, value in event.attributes.items():
|
|
||||||
if isinstance(value, str):
|
|
||||||
value = value[: self.max_tag_value_length]
|
|
||||||
attrs[key] = value
|
|
||||||
|
|
||||||
annotations.append(
|
|
||||||
{
|
{
|
||||||
"timestamp": _nsec_to_usec_round(event.timestamp),
|
"timestamp": _nsec_to_usec_round(e.timestamp),
|
||||||
"value": json.dumps({event.name: attrs}),
|
"value": e.name,
|
||||||
}
|
}
|
||||||
|
for e in events
|
||||||
|
]
|
||||||
|
if events
|
||||||
|
else None
|
||||||
)
|
)
|
||||||
return annotations
|
|
||||||
|
|
||||||
|
|
||||||
def _nsec_to_usec_round(nsec):
|
def _nsec_to_usec_round(nsec):
|
||||||
|
|
|
||||||
|
|
@ -223,15 +223,7 @@ class TestZipkinSpanExporter(unittest.TestCase):
|
||||||
"annotations": [
|
"annotations": [
|
||||||
{
|
{
|
||||||
"timestamp": event_timestamp // 10 ** 3,
|
"timestamp": event_timestamp // 10 ** 3,
|
||||||
"value": json.dumps(
|
"value": "event0",
|
||||||
{
|
|
||||||
"event0": {
|
|
||||||
"annotation_bool": True,
|
|
||||||
"annotation_string": "annotation_test",
|
|
||||||
"key_float": 0.3,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"debug": True,
|
"debug": True,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue