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

Add protocol as an argument to the Jaeger exporter constructor #978

Merged
merged 4 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions exporter/opentelemetry-exporter-jaeger/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
([#978] (https://github.com/open-telemetry/opentelemetry-python/pull/978))

## 0.8b0

Released 2020-05-27
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -77,6 +78,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

Expand All @@ -91,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
Expand All @@ -109,6 +112,7 @@ def __init__(
collector_host_name=None,
collector_port=None,
collector_endpoint=DEFAULT_COLLECTOR_ENDPOINT,
collector_protocol=DEFAULT_COLLECTOR_PROTOCOL,
username=None,
password=None,
):
Expand All @@ -119,6 +123,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
Expand All @@ -139,7 +144,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ 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)
self.assertEqual(exporter.collector_host_name, None)
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)
Expand All @@ -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"
Expand All @@ -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,
Expand All @@ -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
Expand Down