Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(tracing): set space_id, fix call_type
  • Loading branch information
floritange committed Sep 3, 2025
commit 46a6366ec6ee0fe678470a63f0393081ef08dc8c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async def agent_card() -> dict:
return agent_card.model_dump()

async def get_cozeloop_space_id() -> dict:
return {"space_id": os.getenv("OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME", default="<no_cozeloop_id_provided>")}
return {"space_id": os.getenv("OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME", default="")}

load_tracer()

Expand Down Expand Up @@ -170,10 +170,12 @@ async def otel_context_middleware(request: Request, call_next):
"traceparent": request.headers.get("Traceparent"),
"tracestate": request.headers.get("Tracestate"),
}
logger.debug(f"carrier: {carrier}")
if carrier["traceparent"] is None:
return await call_next(request)
else:
ctx = TraceContextTextMapPropagator().extract(carrier=carrier)
logger.debug(f"ctx: {ctx}")
token = context.attach(ctx)
try:
response = await call_next(request)
Expand Down
6 changes: 5 additions & 1 deletion veadk/tracing/telemetry/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ def trace_call_llm(
model_name=invocation_context.agent.model_name
if isinstance(invocation_context.agent, Agent)
else "",
call_type=span.context.trace_state.get("call_type") or "",
call_type=span.context.trace_state.get("call_type")
if hasattr(span, "context")
and hasattr(span.context, "trace_state")
and hasattr(span.context.trace_state, "get")
else "",
)

llm_attributes_mapping = ATTRIBUTES.get("llm", {})
Expand Down