Skip to content

Commit

Permalink
Fix stray examples
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t authored and Oberon00 committed Dec 9, 2019
1 parent f05eaaf commit a6a2670
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ pip install -e ./ext/opentelemetry-ext-{integration}
```python
from opentelemetry import trace
from opentelemetry.context import Context
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace import TracerSource
from opentelemetry.sdk.trace.export import ConsoleSpanExporter
from opentelemetry.sdk.trace.export import SimpleExportSpanProcessor

trace.set_preferred_tracer_implementation(lambda T: Tracer())
tracer = trace.tracer()
tracer.add_span_processor(
trace.set_preferred_tracer_source_implementation(lambda T: TracerSource())
trace.tracer_source().add_span_processor(
SimpleExportSpanProcessor(ConsoleSpanExporter())
)
tracer = trace.tracer_source().get_tracer("myapp")
with tracer.start_as_current_span('foo'):
with tracer.start_as_current_span('bar'):
with tracer.start_as_current_span('baz'):
Expand Down
6 changes: 3 additions & 3 deletions ext/opentelemetry-ext-jaeger/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ gRPC is still not supported by this implementation.
from opentelemetry import trace
from opentelemetry.ext import jaeger
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace import TracerSource
from opentelemetry.sdk.trace.export import BatchExportSpanProcessor
trace.set_preferred_tracer_implementation(lambda T: Tracer())
tracer = trace.tracer()
trace.set_preferred_tracer_source_implementation(lambda T: TracerSource())
tracer = trace.tracer_source().get_tracer("myapp")
# create a JaegerSpanExporter
jaeger_exporter = jaeger.JaegerSpanExporter(
Expand Down
10 changes: 5 additions & 5 deletions ext/opentelemetry-ext-jaeger/examples/jaeger_exporter_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from opentelemetry import trace
from opentelemetry.ext import jaeger
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace import TracerSource
from opentelemetry.sdk.trace.export import BatchExportSpanProcessor

trace.set_preferred_tracer_implementation(lambda T: Tracer())
tracer = trace.tracer()
trace.set_preferred_tracer_source_implementation(lambda T: TracerSource())
tracer = trace.tracer_source().get_tracer("myapp")

# create a JaegerSpanExporter
jaeger_exporter = jaeger.JaegerSpanExporter(
Expand All @@ -25,8 +25,8 @@
# create a BatchExportSpanProcessor and add the exporter to it
span_processor = BatchExportSpanProcessor(jaeger_exporter)

# add to the tracer
tracer.add_span_processor(span_processor)
# add to the tracer factory
trace.tracer_source().add_span_processor(span_processor)

# create some spans for testing
with tracer.start_as_current_span("foo") as foo:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
import time
from opentelemetry import trace
from opentelemetry.sdk.trace import Tracer
from opentelemetry.sdk.trace import TracerSource
from opentelemetry.ext.opentracing_shim import create_tracer
# Tell OpenTelemetry which Tracer implementation to use.
trace.set_preferred_tracer_implementation(lambda T: Tracer())
trace.set_preferred_tracer_source_implementation(lambda T: TracerSource())
# Create an OpenTelemetry Tracer.
otel_tracer = trace.tracer()
otel_tracer = trace.tracer_source().get_tracer("myapp")
# Create an OpenTracing shim.
shim = create_tracer(otel_tracer)
Expand Down

0 comments on commit a6a2670

Please sign in to comment.