diff --git a/docs/examples/opencensus-shim/README.rst b/docs/examples/opencensus-shim/README.rst index 9c24440172..f620fdc086 100644 --- a/docs/examples/opencensus-shim/README.rst +++ b/docs/examples/opencensus-shim/README.rst @@ -20,10 +20,10 @@ Start Jaeger .. code-block:: sh docker run --rm \ - -p 6831:6831/udp \ - -p 6832:6832/udp \ + -p 4317:4317 \ + -p 4318:4318 \ -p 16686:16686 \ - jaegertracing/all-in-one:1.13 \ + jaegertracing/all-in-one:latest \ --log-level=debug Python Dependencies @@ -43,7 +43,7 @@ Alternatively, you can install the Python dependencies separately: pip install \ opentelemetry-api \ opentelemetry-sdk \ - opentelemetry-exporter-jaeger \ + opentelemetry-exporter-otlp \ opentelemetry-opencensus-shim \ opentelemetry-instrumentation-sqlite3 \ opencensus \ diff --git a/docs/examples/opencensus-shim/app.py b/docs/examples/opencensus-shim/app.py index 5c8b7f744b..9103ba5333 100644 --- a/docs/examples/opencensus-shim/app.py +++ b/docs/examples/opencensus-shim/app.py @@ -18,7 +18,9 @@ from opencensus.ext.flask.flask_middleware import FlaskMiddleware from opentelemetry import trace -from opentelemetry.exporter.jaeger.thrift import JaegerExporter +from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import ( + OTLPSpanExporter, +) from opentelemetry.instrumentation.sqlite3 import SQLite3Instrumentor from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider @@ -40,9 +42,8 @@ # Configure OTel to export traces to Jaeger tracer_provider.add_span_processor( BatchSpanProcessor( - JaegerExporter( - agent_host_name="localhost", - agent_port=6831, + OTLPSpanExporter( + endpoint="localhost:4317", ) ) ) diff --git a/docs/examples/opencensus-shim/requirements.txt b/docs/examples/opencensus-shim/requirements.txt index da9f0f3f96..9e619db7c9 100644 --- a/docs/examples/opencensus-shim/requirements.txt +++ b/docs/examples/opencensus-shim/requirements.txt @@ -1,6 +1,6 @@ opentelemetry-api opentelemetry-sdk -opentelemetry-exporter-jaeger +opentelemetry-exporter-otlp opentelemetry-opencensus-shim opentelemetry-instrumentation-sqlite3 opencensus diff --git a/docs/examples/opentracing/README.rst b/docs/examples/opentracing/README.rst index 0bf5f8dca3..d811c36fd4 100644 --- a/docs/examples/opentracing/README.rst +++ b/docs/examples/opentracing/README.rst @@ -26,10 +26,10 @@ Start Jaeger .. code-block:: sh docker run --rm \ - -p 6831:6831/udp \ - -p 6832:6832/udp \ + -p 4317:4317 \ + -p 4318:4318 \ -p 16686:16686 \ - jaegertracing/all-in-one:1.13 \ + jaegertracing/all-in-one:latest \ --log-level=debug Redis @@ -61,7 +61,7 @@ Alternatively, you can install the Python dependencies separately: pip install \ opentelemetry-api \ opentelemetry-sdk \ - opentelemetry-exporter-jaeger \ + opentelemetry-exporter-otlp \ opentelemetry-opentracing-shim \ redis \ redis_opentracing diff --git a/docs/examples/opentracing/main.py b/docs/examples/opentracing/main.py index 3975c4a45d..f8a9c55cc5 100755 --- a/docs/examples/opentracing/main.py +++ b/docs/examples/opentracing/main.py @@ -3,7 +3,9 @@ from rediscache import RedisCache from opentelemetry import trace -from opentelemetry.exporter.jaeger.thrift import JaegerExporter +from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import ( + OTLPSpanExporter, +) from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.shim import opentracing_shim @@ -12,13 +14,16 @@ trace.set_tracer_provider(TracerProvider()) tracer_provider = trace.get_tracer_provider() -# Configure the tracer to export traces to Jaeger -jaeger_exporter = JaegerExporter( - agent_host_name="localhost", - agent_port=6831, +# Create an OTLP gRPC span exporter +otlp_exporter = OTLPSpanExporter( + endpoint="http://localhost:4317", + # For insecure connection, useful for testing + insecure=True, +) +# Add the exporter to the tracer provider +trace.get_tracer_provider().add_span_processor( + BatchSpanProcessor(otlp_exporter) ) -span_processor = BatchSpanProcessor(jaeger_exporter) -tracer_provider.add_span_processor(span_processor) # Create an OpenTracing shim. This implements the OpenTracing tracer API, but # forwards calls to the underlying OpenTelemetry tracer. diff --git a/docs/examples/opentracing/requirements.txt b/docs/examples/opentracing/requirements.txt index fa4b520936..db390be5fd 100644 --- a/docs/examples/opentracing/requirements.txt +++ b/docs/examples/opentracing/requirements.txt @@ -1,6 +1,6 @@ opentelemetry-api opentelemetry-sdk -opentelemetry-exporter-jaeger +opentelemetry-exporter-otlp opentelemetry-opentracing-shim redis redis_opentracing