Skip to content

Observability

The client runtime emits OpenTelemetry-friendly telemetry through the standard .NET primitives — no NSmithy-specific setup, no extra packages. Subscribe with your tracer/meter provider:

using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing.AddSource("NSmithy.Client"))
.WithMetrics(metrics => metrics.AddMeter("NSmithy.Client"));

The source and meter names are also available as constants: SmithyClientTelemetry.ActivitySourceName and SmithyClientTelemetry.MeterName.

Each operation execution produces a client span named {Service}.{Operation} (e.g. Weather.GetForecast), with one child span per transport attempt, so retries are visible in the trace:

AttributeValue
rpc.systemsmithy
rpc.serviceThe service shape id (e.g. example.weather#Weather).
rpc.methodThe operation name.
error.typeThe exception type on failure (execution span).
smithy.attemptThe 1-based attempt number (attempt spans).

Failed executions set the span status to Error with the exception message; failed attempts mark their attempt span the same way, so a retried-then- successful call shows a failed first attempt under a successful operation span.

InstrumentTypeUnitMeaning
smithy.client.operation.durationHistogramsEnd-to-end operation duration, spanning all attempts and backoff.
smithy.client.attemptsCounter{attempt}Total transport attempts, including retries.
smithy.client.errorsCounter{error}Failed operation executions, dimensioned by error.type.

All instruments carry rpc.system, rpc.service, and rpc.method dimensions. The ratio of smithy.client.attempts to operation count is a direct retry-amplification signal.

For custom logging or per-request diagnostics beyond spans and metrics, use interceptorsOnAfterExecution receives the outcome (the exception, or null on success).