Skip to content

feat: Add braintrust.span_attributes type tag to LLM spans#57

Merged
Alex R (alexr17) merged 1 commit into
mainfrom
alexr/span-type-fix
May 21, 2026
Merged

feat: Add braintrust.span_attributes type tag to LLM spans#57
Alex R (alexr17) merged 1 commit into
mainfrom
alexr/span-type-fix

Conversation

@alexr17
Copy link
Copy Markdown
Contributor

Fixes: #52

Sets {"type":"llm"} span attribute on OpenAI and Anthropic instrumentation to enable LLM duration metrics and UI features like the "Try prompt" button in the Braintrust UI. Matches the pattern already implemented in the Agent Framework integration (SpanTagHelper.SetSpanType).

Changes:

  • InstrumentedChatClient.TagActivity (OpenAI, line 144)
  • InstrumentedMessageService.TagActivity (Anthropic, line 206)
  • InstrumentedMessageService.TagStreamActivity (Anthropic, line 263)

Test assertions verify span attributes are set correctly on both OpenAI and Anthropic spans.

Copy link
Copy Markdown
Collaborator

@realark Andrew Kent (realark) left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM -- if you haven't already, I'd recommend running the examples to make sure this shows up as expected in the UI (I'm pretty sure this is correct but usually good to verify)

@alexr17 Alex R (alexr17) merged commit ff3cc98 into main May 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bot] OpenAI and Anthropic integrations missing braintrust.span_attributes type tag for LLM spans

2 participants