From b72034be7a5c0164f861bf732dbe6cf822e40463 Mon Sep 17 00:00:00 2001 From: Pradeep Date: Sat, 27 Jun 2020 19:54:35 +0100 Subject: [PATCH 1/3] Fixing the serialization of a tuple element by coercing it into a string --- .../src/opentelemetry/ext/jaeger/__init__.py | 2 ++ ext/opentelemetry-ext-jaeger/tests/test_jaeger_exporter.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py b/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py index 18ec0dc7bf5..f12031d510b 100644 --- a/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py +++ b/ext/opentelemetry-ext-jaeger/src/opentelemetry/ext/jaeger/__init__.py @@ -314,6 +314,8 @@ def _convert_attribute_to_tag(key, attr): return jaeger.Tag(key=key, vLong=attr, vType=jaeger.TagType.LONG) if isinstance(attr, float): return jaeger.Tag(key=key, vDouble=attr, vType=jaeger.TagType.DOUBLE) + if isinstance(attr, tuple): + return jaeger.Tag(key=key, vStr=str(attr), vType=jaeger.TagType.STRING) logger.warning("Could not serialize attribute %s:%r to tag", key, attr) return None diff --git a/ext/opentelemetry-ext-jaeger/tests/test_jaeger_exporter.py b/ext/opentelemetry-ext-jaeger/tests/test_jaeger_exporter.py index 904ca9bff14..7bca8e83178 100644 --- a/ext/opentelemetry-ext-jaeger/tests/test_jaeger_exporter.py +++ b/ext/opentelemetry-ext-jaeger/tests/test_jaeger_exporter.py @@ -200,6 +200,7 @@ def test_translate_to_jaeger(self): otel_spans[0].set_attribute("key_bool", False) otel_spans[0].set_attribute("key_string", "hello_world") otel_spans[0].set_attribute("key_float", 111.22) + otel_spans[0].set_attribute("key_tuple", ("tuple_element",)) otel_spans[0].resource = Resource( labels={"key_resource": "some_resource"} ) @@ -241,6 +242,11 @@ def test_translate_to_jaeger(self): vType=jaeger.TagType.DOUBLE, vDouble=111.22, ), + jaeger.Tag( + key="key_tuple", + vType=jaeger.TagType.STRING, + vStr="('tuple_element',)", + ), jaeger.Tag( key="key_resource", vType=jaeger.TagType.STRING, From be50e37db52d8182f067708c202a7bd1d30b721e Mon Sep 17 00:00:00 2001 From: Pradeep Date: Sat, 27 Jun 2020 20:09:27 +0100 Subject: [PATCH 2/3] Entry in Changelog --- ext/opentelemetry-ext-jaeger/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/opentelemetry-ext-jaeger/CHANGELOG.md b/ext/opentelemetry-ext-jaeger/CHANGELOG.md index 9ed679ee1c1..978b9648ea7 100644 --- a/ext/opentelemetry-ext-jaeger/CHANGELOG.md +++ b/ext/opentelemetry-ext-jaeger/CHANGELOG.md @@ -8,6 +8,8 @@ Released 2020-05-27 - Transform resource to tags when exporting ([#645](https://github.com/open-telemetry/opentelemetry-python/pull/645)) +- ext/boto: Could not serialize attribute aws.region to tag when exporting via jaeger + ([#865](https://github.com/open-telemetry/opentelemetry-python/pull/865)) ## 0.6b0 From 12e2899779647ad558d522365c4cc0e89318e6e1 Mon Sep 17 00:00:00 2001 From: Pradeep Date: Mon, 6 Jul 2020 09:53:26 +0100 Subject: [PATCH 3/3] Update Changelog --- ext/opentelemetry-ext-jaeger/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/opentelemetry-ext-jaeger/CHANGELOG.md b/ext/opentelemetry-ext-jaeger/CHANGELOG.md index 978b9648ea7..dada0101e0d 100644 --- a/ext/opentelemetry-ext-jaeger/CHANGELOG.md +++ b/ext/opentelemetry-ext-jaeger/CHANGELOG.md @@ -9,6 +9,8 @@ Released 2020-05-27 - Transform resource to tags when exporting ([#645](https://github.com/open-telemetry/opentelemetry-python/pull/645)) - ext/boto: Could not serialize attribute aws.region to tag when exporting via jaeger + Serialize tuple type values by coercing them into a string, since Jaeger does not + support tuple types. ([#865](https://github.com/open-telemetry/opentelemetry-python/pull/865)) ## 0.6b0