chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# This file is intended for examples exporting traces to a local OTLP listener
|
||||
from opentelemetry import trace
|
||||
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
|
||||
OTLPSpanExporter,
|
||||
) # noqa
|
||||
from opentelemetry.sdk.trace import TracerProvider
|
||||
from opentelemetry.sdk.trace.export import (
|
||||
ConsoleSpanExporter,
|
||||
SimpleSpanProcessor,
|
||||
)
|
||||
|
||||
|
||||
def setup_tracing() -> None:
|
||||
# Sets the tracer_provider. This is only allowed once per execution
|
||||
# context and will log a warning if attempted multiple times.
|
||||
trace.set_tracer_provider(TracerProvider())
|
||||
trace.get_tracer_provider().add_span_processor(
|
||||
SimpleSpanProcessor(
|
||||
OTLPSpanExporter(endpoint="http://localhost:4317", insecure=True)
|
||||
)
|
||||
)
|
||||
trace.get_tracer_provider().add_span_processor(
|
||||
SimpleSpanProcessor(ConsoleSpanExporter())
|
||||
)
|
||||
Reference in New Issue
Block a user