Add a new single-span diagnostic observer for ASP.NET Core by andrewlock ยท Pull Request #7964 ยท DataDog/dd-trace-dotnet
This was referenced
Dec 17, 2025andrewlock added a commit that referenced this pull request
Dec 23, 2025## Summary of changes Adds a `ValueStringBuilder` implementation, based on the one used internally in the .NET runtime ## Reason for change - We can stackalloc the `Span<char>` - It's a bit faster than our existing `StringBuilderCache` implementation, and in some places that matters. ## Implementation details - Made in .NET 6 only for simplicity. We _could_ expose it earlier, but I wanted this for the updated aspnetcore integration, so .NET6+ only for now is good enough - It's not without risks in its usage, so we have to be careful about things like passing it around (i.e. avoid doing that completely, for safety) - Uses an array pool backed implementation (again, built into .NET 6) ## Test coverage Imported the unit tests from the runtime too ## Other details https://datadoghq.atlassian.net/browse/LANGPLAT-842 Part of a stack - #7962 ๐ - #7963 - #7964 - #7966 - #7965
andrewlock added a commit that referenced this pull request
Dec 24, 2025## Summary of changes Small perf tweaks for existing `AspNetCoreDiagnosticObserver` ## Reason for change While experimenting with single span observer, noticed some (safe) tweaks we could make to the existing implementation. There are some other improvements we could make as well, but those are a little riskier, so may be best to delay them. ## Implementation details - Use `HttpContext.Items[string]` instead of `HttpContext.Features.Get<T>` as it's a bit faster - Make `Tracer`/`Security`/`Iast` inputs readonly, instead of using a null-coalesce with every access - Move check outside of `AddHeaderTagsToSpan` given common case is to avoid the function call ## Test coverage Covered by existing tests ## Other details https://datadoghq.atlassian.net/browse/LANGPLAT-842 Part of a stack - #7962 - #7963 ๐ - #7964 - #7966 - #7965
Base automatically changed from andrew/single-span/2-minor-fixes to master
December 24, 2025 13:25andrewlock added a commit that referenced this pull request
Jan 13, 2026## Summary of changes Creates an optimized version of `AspNetCoreResourceNameHelper` for use by the single-span Diagnostic observer. ## Reason for change We have the opportunity for a variety of optimizations thanks to not creating the MVC span, and the fact that we're .NET 6+. We could potentially include some or all of these optimizations in the existing observer path, but for safety/simplicity I'd rather keep it isolated for now, and we can look at expanding it more broadly later ## Implementation details - Use the `ValueStringBuilder` to build a resource name - Don't pre-grab MVC route values, wait to see if we have route params from them first - Write directly into the builder as `ToLowerInvariant`, instead of doing an extra ToLower() at the end ## Test coverage Added unit tests that use the existing data for the other implementations, to confirm it's identical. It's also covered indirectly by the integration tests ## Other details https://datadoghq.atlassian.net/browse/LANGPLAT-842 Part of a stack - #7962 - #7963 - #7964 - #7966 ๐ - #7965
andrewlock added a commit that referenced this pull request
Jan 13, 2026โฆ7965) ## Summary of changes Adds a micro and macro benchmark for the new observer ## Reason for change Want to verify that it has performance benefits ## Implementation details - Added new scenario for macro - Duplicated existing scenario for micro and run. I would like to have had these as the same methods, but the "global" nature of diagnostic observers makes this difficult I think. ## Test coverage I'll manually trigger a run of the macro ## Other details https://datadoghq.atlassian.net/browse/LANGPLAT-842 Part of a stack - #7962 - #7963 - #7964 - #7966 - #7965 ๐
This was referenced
Jan 15, 2026This was referenced
Feb 12, 2026This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters