Skip to content

[bot] OpenAI tracers do not set braintrust.span_attributes with type: "llm" #81

@AbhiPrasad

Description

Parent issue: #69

Summary

The OpenAI middleware tracers do not set the braintrust.span_attributes OTel attribute with type: "llm" on their spans, so OpenAI spans are not classified as LLM spans in the Braintrust UI.

Affected tracers

  1. trace/contrib/openai/chatcompletions.go
  2. trace/contrib/openai/responses.go

Expected behavior

Both tracers should set:

internal.SetJSONAttr(span, "braintrust.span_attributes", map[string]string{"type": "llm"})

Why this matters

Per https://www.braintrust.dev/docs/instrument/advanced-tracing, span_attributes.type = "llm" enables the LLM icon, LLM duration metrics, and the "Try prompt" feature in the Braintrust UI.

Acceptance criteria

  • OpenAI Chat Completions tracer sets braintrust.span_attributes with type: "llm"
  • OpenAI Responses tracer sets braintrust.span_attributes with type: "llm"
  • Tests verify the attribute is actually present on emitted spans rather than hardcoding the expected value

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions