Skip to content

Commit

Permalink
Update step-02.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangB33r authored Feb 22, 2024
1 parent 0a97e60 commit 8763230
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions course/step-02.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,25 @@ Import statements as well as the creation of the trace provider are added at the
from flask import Flask
import json

# Otel
from opentelemetry import trace
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
BatchSpanProcessor,
ConsoleSpanExporter,
)


from opentelemetry.sdk.resources import Resource


trace_provider = TracerProvider(resource=Resource.create({
"service.name": "shoppingcart",
"service.instance.id": "instance-12",
}),)
processor = BatchSpanProcessor(ConsoleSpanExporter())
trace_provider.add_span_processor(processor)


# Sets the global default tracer provider
trace.set_tracer_provider(trace_provider)


# Creates a tracer from the global tracer provider
tracer = trace.get_tracer(__name__)

# End Otel init

app = Flask(__name__)

Expand Down

0 comments on commit 8763230

Please sign in to comment.