File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222
2323import httpx
2424from opentelemetry import trace as otel_trace_api
25- from opentelemetry .trace import Tracer
2625from opentelemetry .sdk .resources import Resource
2726from opentelemetry .sdk .trace import TracerProvider
2827from opentelemetry .sdk .trace .sampling import Decision , TraceIdRatioBased
28+ from opentelemetry .trace import Tracer
2929
3030from langfuse ._client .attributes import LangfuseOtelSpanAttributes
3131from langfuse ._client .constants import LANGFUSE_TRACER_NAME
@@ -104,7 +104,14 @@ def __new__(
104104 with cls ._lock :
105105 if public_key not in cls ._instances :
106106 instance = super (LangfuseResourceManager , cls ).__new__ (cls )
107- instance ._otel_tracer = cast (Tracer , None )
107+
108+ # Initialize tracer (will be noop until init instance)
109+ instance ._otel_tracer = otel_trace_api .get_tracer (
110+ LANGFUSE_TRACER_NAME ,
111+ langfuse_version ,
112+ attributes = {"public_key" : public_key },
113+ )
114+
108115 instance ._initialize_instance (
109116 public_key = public_key ,
110117 secret_key = secret_key ,
You can’t perform that action at this time.
0 commit comments