Skip to content

Release v7.10.0

Choose a tag to compare

@github-actions github-actions released this 22 May 22:14
b3041fd

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.Traces abstractions and implementations: IActivitySource<T>, IActivityScope<T>, ActivitySource<T>, ActivityScope<T>, and SpanAttribute
  • Generator support for [Span] methods that start activities and map method parameters to tags
  • Analyzer CRT0001 to require using disposal semantics for IActivityScope<T> call sites
  • Documentation/csharp/traces/index.md and Documentation/csharp/traces/roslyn.md for 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.Roslyn generates trace wrappers alongside existing metrics generation
  • Typed IMeter<> and IActivitySource<> 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.Diagnostics primitives 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