From 7d3ec81b734e444603a7f9aebbccccba3c12fea9 Mon Sep 17 00:00:00 2001 From: Pradeep Date: Sat, 8 Aug 2020 15:49:34 +0100 Subject: [PATCH 1/3] Add protocol as an argument to the Jaeger exporter constructor --- .../src/opentelemetry/exporter/jaeger/__init__.py | 6 +++++- .../tests/test_jaeger_exporter.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py b/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py index 993bf4f087..cbc524879a 100644 --- a/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py @@ -77,6 +77,7 @@ DEFAULT_AGENT_HOST_NAME = "localhost" DEFAULT_AGENT_PORT = 6831 DEFAULT_COLLECTOR_ENDPOINT = "/api/traces?format=jaeger.thrift" +DEFAULT_COLLECTOR_PROTOCOL = "http" UDP_PACKET_MAX_LENGTH = 65000 @@ -109,6 +110,7 @@ def __init__( collector_host_name=None, collector_port=None, collector_endpoint=DEFAULT_COLLECTOR_ENDPOINT, + collector_protocol=DEFAULT_COLLECTOR_PROTOCOL, username=None, password=None, ): @@ -119,6 +121,7 @@ def __init__( self.collector_host_name = collector_host_name self.collector_port = collector_port self.collector_endpoint = collector_endpoint + self.collector_protocol = collector_protocol self.username = username self.password = password self._collector = None @@ -139,7 +142,8 @@ def collector(self): if self.collector_host_name is None or self.collector_port is None: return None - thrift_url = "http://{}:{}{}".format( + thrift_url = "{}://{}:{}{}".format( + self.collector_protocol, self.collector_host_name, self.collector_port, self.collector_endpoint, diff --git a/exporter/opentelemetry-exporter-jaeger/tests/test_jaeger_exporter.py b/exporter/opentelemetry-exporter-jaeger/tests/test_jaeger_exporter.py index 30b7c85826..7b3916c5b9 100644 --- a/exporter/opentelemetry-exporter-jaeger/tests/test_jaeger_exporter.py +++ b/exporter/opentelemetry-exporter-jaeger/tests/test_jaeger_exporter.py @@ -46,6 +46,7 @@ def test_constructor_default(self): thrift_port = None agent_port = 6831 collector_endpoint = "/api/traces?format=jaeger.thrift" + collector_protocol = "http" exporter = jaeger_exporter.JaegerSpanExporter(service_name) self.assertEqual(exporter.service_name, service_name) @@ -53,6 +54,7 @@ def test_constructor_default(self): self.assertEqual(exporter.agent_host_name, host_name) self.assertEqual(exporter.agent_port, agent_port) self.assertEqual(exporter.collector_port, thrift_port) + self.assertEqual(exporter.collector_protocol, collector_protocol) self.assertEqual(exporter.collector_endpoint, collector_endpoint) self.assertEqual(exporter.username, None) self.assertEqual(exporter.password, None) @@ -65,6 +67,7 @@ def test_constructor_explicit(self): collector_host_name = "opentelemetry.io" collector_port = 15875 collector_endpoint = "/myapi/traces?format=jaeger.thrift" + collector_protocol = "https" agent_port = 14268 agent_host_name = "opentelemetry.io" @@ -78,6 +81,7 @@ def test_constructor_explicit(self): collector_host_name=collector_host_name, collector_port=collector_port, collector_endpoint=collector_endpoint, + collector_protocol="https", agent_host_name=agent_host_name, agent_port=agent_port, username=username, @@ -88,6 +92,7 @@ def test_constructor_explicit(self): self.assertEqual(exporter.agent_port, agent_port) self.assertEqual(exporter.collector_host_name, collector_host_name) self.assertEqual(exporter.collector_port, collector_port) + self.assertEqual(exporter.collector_protocol, collector_protocol) self.assertTrue(exporter.collector is not None) self.assertEqual(exporter.collector.auth, auth) # property should not construct new object From e4c9d87a623d72e359f8d05864f942cc73f186f2 Mon Sep 17 00:00:00 2001 From: Pradeep Date: Sat, 8 Aug 2020 16:23:20 +0100 Subject: [PATCH 2/3] Changelog and doc changes --- exporter/opentelemetry-exporter-jaeger/CHANGELOG.md | 3 +++ .../src/opentelemetry/exporter/jaeger/__init__.py | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md b/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md index 7b9a03d312..bfabf9d418 100644 --- a/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md +++ b/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md @@ -5,6 +5,9 @@ - Change package name to opentelemetry-exporter-jaeger ([#953](https://github.com/open-telemetry/opentelemetry-python/pull/953)) +- Thrift URL for Jaeger exporter doesn't allow HTTPS (hardcoded to HTTP) + ([#962] (https://github.com/open-telemetry/opentelemetry-python/pull/978)) + ## 0.8b0 Released 2020-05-27 diff --git a/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py b/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py index cbc524879a..afa0b2578f 100644 --- a/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py +++ b/exporter/opentelemetry-exporter-jaeger/src/opentelemetry/exporter/jaeger/__init__.py @@ -42,6 +42,7 @@ # collector_host_name='localhost', # collector_port=14268, # collector_endpoint='/api/traces?format=jaeger.thrift', + # collector_protocol='http', # username=xxxx, # optional # password=xxxx, # optional ) @@ -92,10 +93,11 @@ class JaegerSpanExporter(SpanExporter): when query for spans. agent_host_name: The host name of the Jaeger-Agent. agent_port: The port of the Jaeger-Agent. - collector_host_name: The host name of the Jaeger-Collector HTTP + collector_host_name: The host name of the Jaeger-Collector HTTP/HTTPS Thrift. - collector_port: The port of the Jaeger-Collector HTTP Thrift. - collector_endpoint: The endpoint of the Jaeger-Collector HTTP Thrift. + collector_port: The port of the Jaeger-Collector HTTP/HTTPS Thrift. + collector_endpoint: The endpoint of the Jaeger-Collector HTTP/HTTPS Thrift. + collector_protocol: The transfer protocol for the Jaeger-Collector(HTTP or HTTPS). username: The user name of the Basic Auth if authentication is required. password: The password of the Basic Auth if authentication is From 68d74ff006df584056132523b3f5f70a207ed354 Mon Sep 17 00:00:00 2001 From: Leighton Chen Date: Thu, 13 Aug 2020 10:12:05 -0700 Subject: [PATCH 3/3] Update exporter/opentelemetry-exporter-jaeger/CHANGELOG.md --- exporter/opentelemetry-exporter-jaeger/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md b/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md index bfabf9d418..48f7afd397 100644 --- a/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md +++ b/exporter/opentelemetry-exporter-jaeger/CHANGELOG.md @@ -6,7 +6,7 @@ ([#953](https://github.com/open-telemetry/opentelemetry-python/pull/953)) - Thrift URL for Jaeger exporter doesn't allow HTTPS (hardcoded to HTTP) - ([#962] (https://github.com/open-telemetry/opentelemetry-python/pull/978)) + ([#978] (https://github.com/open-telemetry/opentelemetry-python/pull/978)) ## 0.8b0