-
Notifications
You must be signed in to change notification settings - Fork 0
feat: restructure and support custom sampling #22
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
base: main
Are you sure you want to change the base?
Conversation
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 restructures the sampling functionality for the Asos.OpenTelemetry project by introducing custom, route-based sampling for ASP.NET Core applications while updating project configurations and documentation for .NET 8.0.
- Added new classes for configuring and processing sampling rules based on HTTP routes and methods.
- Updated project files to target .NET 8.0 and improved README documentation with usage examples.
- Implemented comprehensive unit tests to validate the new custom sampling behavior.
Reviewed Changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Asos.OpenTelemetry.Exporter.EventHubs.csproj | Updated project targeting to .NET 8.0 and metadata adjustments for packaging |
| SamplingRule.cs | Added class representing individual sampling rules with regex support |
| RouteSamplingOptions.cs | Introduced options class to define default and route-specific sampling rates |
| OpenTelemetryExtensions.cs | Added extension methods to integrate custom sampling with Azure Monitor trace exporter |
| ConfigurableRouteSampler.cs | Implemented sampler logic based on HTTP request path and method |
| README.md | Updated documentation to illustrate configuration and usage of custom sampling |
| OpenTelemetrySetupTests.cs | Added tests for validating service registration and binding of sampling options |
| ConfigurableRouteSamplerTests.cs | Comprehensive tests for various scenarios of the route-based sampler |
| Asos.OpenTelemetry.AspNetCore.csproj & Tests.csproj | Updated project files to target .NET 8.0 and align with new features |
...Telemetry/Asos.OpenTelemetry.Exporter.EventHubs/Asos.OpenTelemetry.Exporter.EventHubs.csproj
Show resolved
Hide resolved
Co-authored-by: dylan-asos <[email protected]>
Co-authored-by: dylan-asos <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: dylan-asos <[email protected]>
…telemetry into feature/sampling
Purpose
This pull request introduces significant changes to the
Asos.OpenTelemetryproject, focusing on adding custom sampling functionality for OpenTelemetry in ASP.NET Core applications, updating project configurations, and improving documentation. The most important changes include the implementation of route-based sampling, the addition of tests for the new functionality, and updates to project files to target .NET 8.0.New functionality: Route-based sampling
Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore/Sampling/ConfigurableRouteSampler.cs: AddedConfigurableRouteSamplerclass to enable route-based sampling using HTTP request paths and methods, with support for custom sampling rates.Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore/Sampling/RouteSamplingOptions.cs: IntroducedRouteSamplingOptionsto define sampling rules and a default sampling rate.Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore/Sampling/SamplingRule.cs: AddedSamplingRuleclass to represent individual sampling rules, including route patterns, HTTP methods, and sampling rates.Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore/Sampling/OpenTelemetryExtensions.cs: Added extension methods to configure OpenTelemetry with custom sampling rules and integrate Azure Monitor trace exporter.Unit tests for sampling functionality
Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore.Tests/ConfigurableRouteSamplerTests.cs: Implemented comprehensive tests forConfigurableRouteSampler, including edge cases like null HTTP context and invalid sampling rates.Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore.Tests/OpenTelemetrySetupTests.cs: Added tests to verify service registration and correct binding of sampling options in OpenTelemetry setup.Project updates
Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore/Asos.OpenTelemetry.AspNetCore.csproj: Updated project file to target .NET 8.0 and include metadata for packaging, such as license and documentation files.Asos.OpenTelemetry/Asos.OpenTelemetry.Exporter.EventHubs/Asos.OpenTelemetry.Exporter.EventHubs.csproj: Renamed and updated the project file to target .NET 8.0 and simplify metadata paths. [1] [2]Documentation improvements
Asos.OpenTelemetry/Asos.OpenTelemetry.AspNetCore/README.md: Added detailed documentation on configuring OpenTelemetry with custom sampling rules, including examples forappsettings.jsonand usage scenarios.