Skip to content

Instantly share code, notes, and snippets.

@yurishkuro
Last active October 4, 2023 00:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yurishkuro/c60011b9b3b3e6b5c11f0852f877a6c3 to your computer and use it in GitHub Desktop.
Save yurishkuro/c60011b9b3b3e6b5c11f0852f877a6c3 to your computer and use it in GitHub Desktop.
OpenTelemetry Python Example
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
BatchSpanProcessor(OTLPSpanExporter())
)
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("foo"):
print("Hello world!")
opentelemetry-api
opentelemetry-sdk
opentelemetry-exporter-otlp-proto-http
@glimchb
Copy link

glimchb commented Oct 4, 2023

Jaeger is run like this:

docker run --name jaeger \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  jaegertracing/all-in-one:1.35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment