From 5c0bc91d85a8372eb7e8a26945144b9411c80c00 Mon Sep 17 00:00:00 2001 From: Owais Lone Date: Tue, 29 Sep 2020 23:17:34 +0530 Subject: [PATCH] Update instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py Co-authored-by: (Eliseo) Nathaniel Ruiz Nowell --- .../src/opentelemetry/instrumentation/falcon/__init__.py | 6 ++++-- .../opentelemetry-instrumentation-tornado/CHANGELOG.md | 2 ++ .../opentelemetry-instrumentation-tornado/README.rst | 2 +- .../tests/test_instrumentation.py | 6 +++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py index 7bc2f796815..bfcd45a8b58 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py @@ -165,9 +165,11 @@ def process_request(self, req, resp): if not span: return - attributes = extract_attributes_from_object(req, self._traced_request_attrs) + attributes = extract_attributes_from_object( + req, self._traced_request_attrs + ) for key, value in attributes.items(): - span.set_attribute(key, str(value)) + span.set_attribute(key, value) def process_resource(self, req, resp, resource, params): span = req.env.get(_ENVIRON_SPAN_KEY) diff --git a/instrumentation/opentelemetry-instrumentation-tornado/CHANGELOG.md b/instrumentation/opentelemetry-instrumentation-tornado/CHANGELOG.md index 7cc628718de..e82446d66d7 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/CHANGELOG.md +++ b/instrumentation/opentelemetry-instrumentation-tornado/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Added support for `OTEL_PYTHON_TORNADO_TRACED_REQUEST_ATTRS` ([#1178](https://github.com/open-telemetry/opentelemetry-python/pull/1178)) + ## Version 0.13b0 Released 2020-09-17 diff --git a/instrumentation/opentelemetry-instrumentation-tornado/README.rst b/instrumentation/opentelemetry-instrumentation-tornado/README.rst index 5d428435c28..088c7f0e85d 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/README.rst +++ b/instrumentation/opentelemetry-instrumentation-tornado/README.rst @@ -40,7 +40,7 @@ For example, :: - export OTEL_PYTHON_TONADO_TRACED_REQUEST_ATTRS='uri,query' + export OTEL_PYTHON_TORNADO_TRACED_REQUEST_ATTRS='uri,query' will extract path_info and content_type attributes from every traced request and add them as span attributes. diff --git a/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py b/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py index 64b055a2bcd..eb2852f1123 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py @@ -362,10 +362,10 @@ def test_traced_attrs(self): self.fetch("/ping?q=abc&b=123") spans = self.sorted_spans(self.memory_exporter.get_finished_spans()) self.assertEqual(len(spans), 2) - server = spans[0] - self.assertEqual(server.kind, SpanKind.SERVER) + server_span = spans[0] + self.assertEqual(server_span.kind, SpanKind.SERVER) self.assert_span_has_attributes( - server, {"uri": "/ping?q=abc&b=123", "query": "q=abc&b=123"} + server_span, {"uri": "/ping?q=abc&b=123", "query": "q=abc&b=123"} ) self.memory_exporter.clear()