Release v7.10.0
Summary
This PR adds trace instrumentation that mirrors the existing metrics model: business code can declare typed [Span] partial methods and consume IActivitySource<T> / IActivityScope<T> instead of raw ActivitySource / Activity. It also adds analyzer enforcement for undisposed activity scopes, trace documentation under Documentation/csharp/traces that now prefers extension-method usage, broader spec coverage across runtime, AOT, generator, and analyzer scenarios, and fixes the markdown lint issues surfaced by the new docs.
public static partial class OrderTraces
{
[Span("order.process", ActivityKind.Server)]
internal static partial IActivityScope<OrderService> ProcessOrder(
this IActivitySource<OrderService> source,
string orderId,
string customerId);
}
using var span = _source.ProcessOrder(order.Id, order.CustomerId);Added
Cratis.Tracesabstractions and implementations:IActivitySource<T>,IActivityScope<T>,ActivitySource<T>,ActivityScope<T>, andSpanAttribute- Generator support for
[Span]methods that start activities and map method parameters to tags - Analyzer
CRT0001to requireusingdisposal semantics forIActivityScope<T>call sites Documentation/csharp/traces/index.mdandDocumentation/csharp/traces/roslyn.mdfor the trace API and generated span support- Expanded runtime, AOT, generator, and analyzer specs for trace behavior and diagnostics
- Roslyn spec coverage for generated trace extension methods, including tag generation
Changed
Cratis.Metrics.Roslyngenerates trace wrappers alongside existing metrics generation- Typed
IMeter<>andIActivitySource<>open generics are registered through DI - Tag generation supports snake_case trace tags, including acronym-aware conversion
- The C# documentation table of contents includes the new traces section
- Trace documentation and examples now prefer extension-method span declarations and call sites on
IActivitySource<T>
Fixed
- The gap where trace instrumentation required direct
System.Diagnosticsprimitives in application code - The failure mode where span scopes could be created without
using, leaving activities unstopped and parent-child chains incomplete - Missing validation coverage for trace generator diagnostics and analyzer failure modes
- Repository markdown lint violations surfaced while adding the new trace documentation
Removed
- None
Security
- Compile-time enforcement for disposing generated activity scopes, reducing the risk of broken trace lifetimes and incomplete span trees
Deprecated
- None