Commit Graph

1 Commits

  • Set ApplicationName on CosmosClientOptions for UserAgent telemetry (#6481)
    Added CosmosOptionsHelper (in Microsoft.Agents.AI.CosmosNoSql namespace)
    that sets CosmosClientOptions.ApplicationName per component, producing
    wire-visible UserAgent suffixes:
    
    - CosmosChatHistoryProvider: Microsoft.Agents.CosmosNoSql.ChatHistory/{version}
    - CosmosCheckpointStore: Microsoft.Agents.CosmosNoSql.Checkpoint/{version}
    
    This ensures Cosmos DB requests from the Agent Framework are identifiable
    in telemetry, enabling usage tracking and diagnostics queries that can
    distinguish between chat history and checkpoint workloads.
    
    Addressed review feedback:
    - Truncates ApplicationName to 64 chars (Cosmos SDK max length)
    - Moved helper to Microsoft.Agents.AI.CosmosNoSql namespace (scoped ownership)
    - Uses StringComparison.Ordinal for IndexOf call
    
    When users provide their own CosmosClient instance, the ApplicationName
    is not overridden - users retain full control.
    
    Co-authored-by: TheovanKraay <TheovanKraay@users.noreply.github.com>