-
Notifications
You must be signed in to change notification settings - Fork 133
Add support for configuring OpenTelemetryChatClient.EnableSensitiveData, MEAI telemetry sources, and expose DisableTracing property #846
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
Conversation
…ta and MEAI telemetry sources Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
|
@copilot Expose DisableTracing on OllamaSharpSettings pubicly. |
Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Done. Changed the Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this 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 enhances the OllamaSharp integration by adding support for configuring OpenTelemetry settings, specifically EnableSensitiveData, and automatically registering Microsoft.Extensions.AI telemetry sources for better distributed tracing.
- Added new method overloads for
AddChatClientandAddKeyedChatClientthat accept OpenTelemetry configuration delegates - Automatically registers the Microsoft.Extensions.AI telemetry source with OpenTelemetry
- Exposed the
DisableTracingproperty onOllamaSharpSettingsfrom internal to public visibility
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| AspireOllamaChatClientExtensions.cs | Added new method overloads for OpenTelemetry configuration and automatic telemetry source registration |
| OllamaSharpSettings.cs | Changed DisableTracing property visibility from internal to public |
| CommunityToolkit.Aspire.OllamaSharp.csproj | Added OpenTelemetry.Extensions.Hosting package reference |
| README.md | Added documentation for OpenTelemetry configuration |
| OllamaSharpIChatClientTests.cs | Added comprehensive tests for new OpenTelemetry configuration functionality |
Minimum allowed line rate is |
|
@davidfowl @JamesNK is this looking like what you were expecting with the new API? |
…ta, MEAI telemetry sources, and expose DisableTracing property (CommunityToolkit#846) * Initial plan * Add support for configuring OpenTelemetryChatClient.EnableSensitiveData and MEAI telemetry sources Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Update documentation for OpenTelemetry configuration support Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> * Expose DisableTracing property on OllamaSharpSettings publicly Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com> Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Aaron Powell <me@aaron-powell.com>
This PR adds support for configuring
OpenTelemetryChatClient.EnableSensitiveDataand automatically registers the Microsoft.Extensions.AI (MEAI) telemetry source with OpenTelemetry when using the Ollama chat client integration.Changes Made
New Method Overloads
Added new overloads to
AddChatClientandAddKeyedChatClientmethods that accept anAction<OpenTelemetryChatClient>delegate for configuration:Automatic Telemetry Source Registration
The integration now automatically registers the
"Experimental.Microsoft.Extensions.AI"telemetry source with OpenTelemetry when using any of theAddChatClientmethods. This enables proper distributed tracing for AI operations without requiring manual configuration.Enhanced OpenTelemetry Integration
CreateInnerChatClientto pass the correct source name to theOpenTelemetryChatClientconstructorAddTelemetrySourcehelper method to register the MEAI telemetry sourceOpenTelemetry.Extensions.Hostingpackage reference for proper OpenTelemetry integrationExposed DisableTracing Property
DisableTracingproperty onOllamaSharpSettingsfrominternaltopublicvisibility to allow external configuration of tracing behaviorComprehensive Testing
Added tests covering:
EnableSensitiveDatawith both keyed and non-keyed clientsDocumentation Updates
Updated the README.md to include examples of how to configure OpenTelemetry settings and explain the automatic telemetry source registration.
Backward Compatibility
All existing method signatures remain unchanged. The new configuration capability is provided through additional overloads, making this a non-breaking change.
Fixes #842.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.