Skip to content

Update OpenTelemetryChatClient to 1.34 #6466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented May 20, 2025

cc: @lmolkova

Microsoft Reviewers: Open in CodeFlow

@stephentoub stephentoub requested a review from a team as a code owner May 20, 2025 13:46
@stephentoub stephentoub requested a review from Copilot May 20, 2025 13:46
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label May 20, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the OpenTelemetry semantic conventions to v1.34 and adds conversation-level tagging to the chat client.

  • Introduce a new Conversation.Id constant for Gen AI telemetry.
  • Bump documentation references from v1.33 to v1.34.
  • Instrument OpenTelemetryChatClient to tag ConversationId on streaming responses.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Libraries/Microsoft.Extensions.AI/OpenTelemetryConsts.cs Added Conversation.Id constant under Gen AI telemetry.
src/Libraries/Microsoft.Extensions.AI/Embeddings/OpenTelemetryEmbeddingGenerator.cs Updated semantic conventions version to v1.34 in remarks.
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs Updated spec version docs and added tagging of ConversationId on streaming responses.
Comments suppressed due to low confidence (2)

src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs:250

  • Consider adding or updating unit/integration tests to verify that ConversationId is correctly added as a tag on activities, ensuring your new telemetry behaviour is covered.
if (options.ConversationId is string conversationId)

src/Libraries/Microsoft.Extensions.AI/ChatCompletion/OpenTelemetryChatClient.cs:246

  • For consistent telemetry, also apply the ConversationId tag in the non-streaming GetResponseAsync override so both chat paths include conversation context.
public override async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseA

@stephentoub stephentoub enabled auto-merge (squash) May 29, 2025 03:26
@stephentoub stephentoub merged commit c01d681 into dotnet:main May 29, 2025
7 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-ai Microsoft.Extensions.AI libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants