Innovabit.DotNet.Interceptors.Telemetry 2.0.117

dotnet add package Innovabit.DotNet.Interceptors.Telemetry --version 2.0.117
                    
NuGet\Install-Package Innovabit.DotNet.Interceptors.Telemetry -Version 2.0.117
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Innovabit.DotNet.Interceptors.Telemetry" Version="2.0.117" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Innovabit.DotNet.Interceptors.Telemetry" Version="2.0.117" />
                    
Directory.Packages.props
<PackageReference Include="Innovabit.DotNet.Interceptors.Telemetry" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Innovabit.DotNet.Interceptors.Telemetry --version 2.0.117
                    
#r "nuget: Innovabit.DotNet.Interceptors.Telemetry, 2.0.117"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Innovabit.DotNet.Interceptors.Telemetry@2.0.117
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Innovabit.DotNet.Interceptors.Telemetry&version=2.0.117
                    
Install as a Cake Addin
#tool nuget:?package=Innovabit.DotNet.Interceptors.Telemetry&version=2.0.117
                    
Install as a Cake Tool

Innovabit.DotNet.Interceptors.Telemetry

Distributed tracing and metrics for Innovabit.DotNet.Interceptors via [Traced] and [Measured]. There is no provider package to pick: the interceptors publish through .NET's own ActivitySource and Meter, which OpenTelemetry — or any other collector built on System.Diagnostics — consumes directly.

Usage

services
    .AddInterceptors()
    .AddTelemetry();                  // or .AddTracing() / .AddMetrics() separately

services.AddScopedWithInterception<IPaymentService, PaymentService>();

Point your collector at the source and meter — they are only named constants, so there is nothing to keep in sync by hand:

services.AddOpenTelemetry()
    .WithTracing(t => t.AddSource(TelemetryDefaults.ActivitySourceName))
    .WithMetrics(m => m.AddMeter(TelemetryDefaults.MeterName));
public class PaymentService : IPaymentService
{
    [Traced(Kind = ActivityKind.Client)]
    [Measured]
    public Task<Receipt> ChargeAsync(Order order, CancellationToken cancellationToken) { ... }
}

[Traced]

Wraps the method in a span: started before the call, ended when it returns, marked as failed with an exception event when it throws. Spans nest through Activity.Current, so traced methods calling each other produce a tree without any extra plumbing.

Property Meaning
Name Span name. Defaults to TypeName.MethodName.
Kind ActivityKind. Defaults to Internal; use Client for outbound calls, Consumer for message handlers.
RecordArguments Attach the arguments as code.arg.* tags. Defaults to false.
RecordResult Attach the returned value as a code.result tag. Defaults to false.

Tags follow OpenTelemetry's semantic conventions (code.function, code.namespace), and a failure sets an Error status plus the standard exception event with exception.type, exception.message and exception.stacktrace.

Arguments are off by default

Arguments routinely carry personal data and traces usually leave the building, so RecordArguments is opt-in. Even then, CancellationToken parameters are skipped and parameters marked [TelemetryIgnore] are recorded as *** — visibly withheld rather than silently missing:

[Traced(RecordArguments = true)]
public Task<Receipt> ChargeAsync(string orderId, [TelemetryIgnore] string cardNumber) { ... }

[TelemetryIgnore] keeps a parameter out of spans specifically. The cross-cutting [Sensitive] and [Mask] from the core package keep it out of every record the suite writes — logs, audit entries and exception notifications included — and are applied to span tags too, including a [return: Sensitive] return value.

Cost when nobody is listening

ActivitySource.StartActivity returns null when no collector subscribed to the source, and the interceptor then simply proceeds. An application that ships with the attributes but without tracing enabled pays for one dictionary lookup and one null check per call.

[Measured]

Records three instruments, shared by every measured method and told apart by tags — so adding the attribute to another method does not add another metric to your cardinality budget:

Instrument Type Unit
interceptors.method.calls counter {call}
interceptors.method.duration histogram ms
interceptors.method.errors counter {error}

Every measurement is tagged with operation, code.function, code.namespace and status (ok/error), plus exception.type when the call threw. A failed call increments both calls and errors, so the error rate is simply errors / calls.

Property Meaning
Name Value of the operation tag. Defaults to TypeName.MethodName. Share a name across methods to aggregate them into one line.
RecordDuration Record the duration histogram. Defaults to true.
RecordCalls Record the call and error counters. Defaults to true.

Ordering

Telemetry runs outermost, at negative orders on the InterceptorOrders scale:

Tracing -200 → Metrics -100 → Logging 0 → Validation 100 → … → Transaction 700

That is deliberate. The span and the recorded duration cover everything the rest of the pipeline does — the retries, the wait before each attempt, the cache lookup, the transaction — which is what the caller actually experienced. Put them anywhere else and a method that took four seconds across three retries reports as the 1.3 seconds of its last attempt.

Renaming the source and meter

services.AddInterceptors()
    .ConfigureTelemetry(o =>
    {
        o.ActivitySourceName = "Contoso.Ordering";
        o.MeterName = "Contoso.Ordering";
    })
    .AddTelemetry();

Remember to subscribe your collector to the new names instead of the defaults.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Innovabit.DotNet.Interceptors.Telemetry:

Package Downloads
Innovabit.DotNet.Interceptors.All

Meta-package: every interceptor concern in the suite (logging, validation, caching, notifications, telemetry, audit, authorization, rate limiting, coordination, feature gates, transactions, retry/timeout/circuit breaker/fallback) in one reference. Providers are separate packages — pick the ones you use.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.117 51 10/31/2026
2.0.116 106 10/26/2026
2.0.115 156 10/17/2026
2.0.114 117 10/10/2026
2.0.113 123 10/3/2026
2.0.112 123 9/28/2026
2.0.111 117 9/28/2026
2.0.110 122 9/27/2026
2.0.109 121 9/26/2026
2.0.108 118 9/26/2026
2.0.107 136 9/26/2026
2.0.105 127 9/25/2026
1.0.0.104 98 9/25/2026
1.0.0.103 101 9/25/2026
1.0.0.102 103 9/25/2026
1.0.0.101 105 9/25/2026
1.0.0.100 101 9/25/2026