Skip to content

Commit

Permalink
Remove 'span' for jaeger and zipkin exporters (#1664)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzchen authored Mar 5, 2021
1 parent 9bf28fb commit 1af9f87
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 31 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1662])(https://github.com/open-telemetry/opentelemetry-python/pull/1662)
- Rename `BaggagePropagator` to `W3CBaggagePropagator`
([#1663])(https://github.com/open-telemetry/opentelemetry-python/pull/1663)
- Rename `JaegerSpanExporter` to `JaegerExporter` and rename `ZipkinSpanExporter` to `ZipkinExporter`
([#1664])(https://github.com/open-telemetry/opentelemetry-python/pull/1664)

## [0.18b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.18b0) - 2021-02-16

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/opentracing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from rediscache import RedisCache

from opentelemetry import trace
from opentelemetry.exporter.jaeger import JaegerSpanExporter
from opentelemetry.exporter.jaeger import JaegerExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.shim import opentracing_shim
Expand All @@ -13,7 +13,7 @@
tracer_provider = trace.get_tracer_provider()

# Configure the tracer to export traces to Jaeger
jaeger_exporter = JaegerSpanExporter(
jaeger_exporter = JaegerExporter(
service_name="OpenTracing Shim Example",
agent_host_name="localhost",
agent_port=6831,
Expand Down
2 changes: 1 addition & 1 deletion docs/getting_started/jaeger_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

trace.set_tracer_provider(TracerProvider())

jaeger_exporter = jaeger.JaegerSpanExporter(
jaeger_exporter = jaeger.JaegerExporter(
service_name="my-helloworld-service",
agent_host_name="localhost",
agent_port=6831,
Expand Down
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-jaeger/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Installation
Configuration
-------------

OpenTelemetry Jaeger Exporter can be configured by setting `JaegerSpanExporter parameters
OpenTelemetry Jaeger Exporter can be configured by setting `JaegerExporter parameters
<https://github.com/open-telemetry/opentelemetry-python/blob/main/exporter/opentelemetry-exporter-jaeger
/src/opentelemetry/exporter/jaeger/__init__.py#L88>`_ or by setting
`environment variables <https://github.com/open-telemetry/opentelemetry-specification/blob/main/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
trace.set_tracer_provider(TracerProvider())
tracer = trace.get_tracer(__name__)

# create a JaegerSpanExporter
jaeger_exporter = jaeger.JaegerSpanExporter(
# create a JaegerExporter
jaeger_exporter = jaeger.JaegerExporter(
service_name="my-helloworld-service",
# configure agent
agent_host_name="localhost",
Expand All @@ -22,13 +22,13 @@
# password=xxxx, # optional
)

# Create a JaegerSpanExporter to send spans with gRPC
# Create a JaegerExporter to send spans with gRPC
# If there is no encryption or authentication set `insecure` to True
# If server has authentication with SSL/TLS you can set the
# parameter credentials=ChannelCredentials(...) or the environment variable
# `EXPORTER_JAEGER_CERTIFICATE` with file containing creds.

# jaeger_exporter = jaeger.JaegerSpanExporter(
# jaeger_exporter = jaeger.JaegerExporter(
# service_name="my-helloworld-service",
# collector_endpoint="localhost:14250",
# insecure=True,
Expand Down
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-jaeger/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ test =

[options.entry_points]
opentelemetry_exporter =
jaeger = opentelemetry.exporter.jaeger:JaegerSpanExporter
jaeger = opentelemetry.exporter.jaeger:JaegerExporter
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
trace.set_tracer_provider(TracerProvider())
tracer = trace.get_tracer(__name__)
# create a JaegerSpanExporter
jaeger_exporter = jaeger.JaegerSpanExporter(
# create a JaegerExporter
jaeger_exporter = jaeger.JaegerExporter(
service_name='my-helloworld-service',
# configure agent
agent_host_name='localhost',
Expand Down Expand Up @@ -104,7 +104,7 @@
logger = logging.getLogger(__name__)


class JaegerSpanExporter(SpanExporter):
class JaegerExporter(SpanExporter):
"""Jaeger span exporter for OpenTelemetry.
Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import opentelemetry.exporter.jaeger.gen.model_pb2 as model_pb2
import opentelemetry.exporter.jaeger.translate.protobuf as pb_translator
from opentelemetry import trace as trace_api
from opentelemetry.exporter.jaeger import JaegerSpanExporter
from opentelemetry.exporter.jaeger import JaegerExporter
from opentelemetry.exporter.jaeger.translate import (
NAME_KEY,
VERSION_KEY,
Expand All @@ -39,7 +39,7 @@


# pylint:disable=no-member
class TestJaegerSpanExporter(unittest.TestCase):
class TestJaegerExporter(unittest.TestCase):
def setUp(self):
# create and save span to be used in tests
context = trace_api.SpanContext(
Expand Down Expand Up @@ -71,7 +71,7 @@ def test_constructor_by_environment_variables(self):

env_patch.start()

exporter = JaegerSpanExporter(
exporter = JaegerExporter(
service_name=service, transport_format="protobuf"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from opentelemetry.trace.status import Status, StatusCode


class TestJaegerSpanExporter(unittest.TestCase):
class TestJaegerExporter(unittest.TestCase):
def setUp(self):
# create and save span to be used in tests
context = trace_api.SpanContext(
Expand All @@ -57,7 +57,7 @@ def test_constructor_default(self):
service_name = "my-service-name"
agent_host_name = "localhost"
agent_port = 6831
exporter = jaeger_exporter.JaegerSpanExporter(service_name)
exporter = jaeger_exporter.JaegerExporter(service_name)

self.assertEqual(exporter.service_name, service_name)
self.assertEqual(exporter.agent_host_name, agent_host_name)
Expand All @@ -82,7 +82,7 @@ def test_constructor_explicit(self):
password = "password"
auth = (username, password)

exporter = jaeger_exporter.JaegerSpanExporter(
exporter = jaeger_exporter.JaegerExporter(
service_name=service,
agent_host_name=agent_host_name,
agent_port=agent_port,
Expand Down Expand Up @@ -135,7 +135,7 @@ def test_constructor_by_environment_variables(self):

environ_patcher.start()

exporter = jaeger_exporter.JaegerSpanExporter(service_name=service)
exporter = jaeger_exporter.JaegerExporter(service_name=service)

self.assertEqual(exporter.service_name, service)
self.assertEqual(exporter.agent_host_name, agent_host_name)
Expand Down Expand Up @@ -433,7 +433,7 @@ def test_translate_to_jaeger(self):

def test_export(self):
"""Test that agent and/or collector are invoked"""
exporter = jaeger_exporter.JaegerSpanExporter(
exporter = jaeger_exporter.JaegerExporter(
"test_export", agent_host_name="localhost", agent_port=6318
)

Expand Down
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-zipkin/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ test =

[options.entry_points]
opentelemetry_exporter =
zipkin = opentelemetry.exporter.zipkin:ZipkinSpanExporter
zipkin = opentelemetry.exporter.zipkin:ZipkinExporter
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
trace.set_tracer_provider(TracerProvider())
tracer = trace.get_tracer(__name__)
# create a ZipkinSpanExporter
zipkin_exporter = zipkin.ZipkinSpanExporter(
# create a ZipkinExporter
zipkin_exporter = zipkin.ZipkinExporter(
# protocol=Protocol.V2_PROTOBUF
# optional:
# endpoint="http://localhost:9411/api/v2/spans",
Expand Down Expand Up @@ -92,7 +92,7 @@
logger = logging.getLogger(__name__)


class ZipkinSpanExporter(SpanExporter):
class ZipkinExporter(SpanExporter):
def __init__(
self,
protocol: Protocol,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from unittest.mock import patch

from opentelemetry import trace
from opentelemetry.exporter.zipkin import DEFAULT_ENDPOINT, ZipkinSpanExporter
from opentelemetry.exporter.zipkin import DEFAULT_ENDPOINT, ZipkinExporter
from opentelemetry.exporter.zipkin.encoder import Protocol
from opentelemetry.exporter.zipkin.encoder.v2.protobuf import ProtobufEncoder
from opentelemetry.exporter.zipkin.node_endpoint import NodeEndpoint
Expand All @@ -38,7 +38,7 @@ def __init__(self, status_code):
self.text = status_code


class TestZipkinSpanExporter(unittest.TestCase):
class TestZipkinExporter(unittest.TestCase):
@classmethod
def setUpClass(cls):
trace.set_tracer_provider(
Expand All @@ -52,7 +52,7 @@ def tearDown(self):
del os.environ[OTEL_EXPORTER_ZIPKIN_ENDPOINT]

def test_constructor_default(self):
exporter = ZipkinSpanExporter(Protocol.V2_PROTOBUF)
exporter = ZipkinExporter(Protocol.V2_PROTOBUF)
self.assertIsInstance(exporter.encoder, ProtobufEncoder)
self.assertEqual(exporter.endpoint, DEFAULT_ENDPOINT)
self.assertEqual(exporter.local_node.service_name, TEST_SERVICE_NAME)
Expand All @@ -64,7 +64,7 @@ def test_constructor_env_vars(self):
os_endpoint = "https://foo:9911/path"
os.environ[OTEL_EXPORTER_ZIPKIN_ENDPOINT] = os_endpoint

exporter = ZipkinSpanExporter(Protocol.V2_PROTOBUF)
exporter = ZipkinExporter(Protocol.V2_PROTOBUF)

self.assertEqual(exporter.endpoint, os_endpoint)
self.assertEqual(exporter.local_node.service_name, TEST_SERVICE_NAME)
Expand All @@ -78,7 +78,7 @@ def test_constructor_protocol_endpoint(self):
protocol = Protocol.V2_PROTOBUF
endpoint = "https://opentelemetry.io:15875/myapi/traces?format=zipkin"

exporter = ZipkinSpanExporter(protocol, endpoint)
exporter = ZipkinExporter(protocol, endpoint)

self.assertIsInstance(exporter.encoder, ProtobufEncoder)
self.assertEqual(exporter.endpoint, endpoint)
Expand All @@ -101,7 +101,7 @@ def test_constructor_all_params_and_env_vars(self):
local_node_port = 30301
max_tag_value_length = 56

exporter = ZipkinSpanExporter(
exporter = ZipkinExporter(
constructor_param_protocol,
constructor_param_endpoint,
local_node_ipv4,
Expand All @@ -125,7 +125,7 @@ def test_constructor_all_params_and_env_vars(self):
def test_invalid_response(self, mock_post):
mock_post.return_value = MockResponse(404)
spans = []
exporter = ZipkinSpanExporter(Protocol.V2_PROTOBUF)
exporter = ZipkinExporter(Protocol.V2_PROTOBUF)
status = exporter.export(spans)
self.assertEqual(SpanExportResult.FAILURE, status)

Expand Down

0 comments on commit 1af9f87

Please sign in to comment.