Skip to content

Commit

Permalink
Fix tracing_context_var lint errors (#1220)
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje authored Nov 27, 2024
1 parent 793598f commit 15dacfa
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# Context var used to keep track of tracing related info.
# This mainly useful for parents spans.
tracing_context_var: ContextVar[Dict[Any, Any]] = ContextVar("tracing_context", default={})
tracing_context_var: ContextVar[Dict[Any, Any]] = ContextVar("tracing_context")


class LangfuseSpan(Span):
Expand Down Expand Up @@ -147,15 +147,16 @@ def trace(
operation_name=operation_name,
)
# Create a new trace if no parent span is provided
context = tracing_context_var.get({})
span = LangfuseSpan(
self._tracer.trace(
name=self._name,
public=self._public,
id=tracing_context_var.get().get("trace_id"),
user_id=tracing_context_var.get().get("user_id"),
session_id=tracing_context_var.get().get("session_id"),
tags=tracing_context_var.get().get("tags"),
version=tracing_context_var.get().get("version"),
id=context.get("trace_id"),
user_id=context.get("user_id"),
session_id=context.get("session_id"),
tags=context.get("tags"),
version=context.get("version"),
)
)
elif tags.get(_COMPONENT_TYPE_KEY) in _ALL_SUPPORTED_GENERATORS:
Expand Down

0 comments on commit 15dacfa

Please sign in to comment.