Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 66d67b8

Browse files
author
Alex Boten
committed
fix context prop example
1 parent 4f008a4 commit 66d67b8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/opentelemetry-example-app/src/opentelemetry_example_app/context_propagation_example.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ def fetch_from_service_c() -> str:
7676

7777
@app.route("/")
7878
def hello():
79-
tracer = trace.tracer_source()
80-
tracer.add_span_processor(BatchExportSpanProcessor(ConsoleSpanExporter()))
79+
tracer = trace.tracer_source().get_tracer(__name__)
80+
trace.tracer_source().add_span_processor(
81+
BatchExportSpanProcessor(ConsoleSpanExporter())
82+
)
8183
with propagation.extract(request.headers):
8284
# extract a baggage header
8385
with tracer.start_as_current_span("service-span"):

0 commit comments

Comments
 (0)