All API docs

Telemetry

The client emits OpenTelemetry traces and metrics under a stable source name. Wire the ActivitySource and Meter into your existing pipeline to see request spans, durations, failures, and rate-limit hits.

Inject in DI
  • PwnedClientTelemetryStatic class exposing the stable ActivitySource and Meter names, plus instrument names.

You do not inject PwnedClientTelemetry. Reference its constants when registering OpenTelemetry so the client's spans and metrics flow to your exporter.

RegistrationC#
using HaveIBeenPwned.Client;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddOpenTelemetry()
    .WithTracing(tracing =>
        tracing.AddSource(PwnedClientTelemetry.ActivitySourceName))
    .WithMetrics(metrics =>
        metrics.AddMeter(PwnedClientTelemetry.MeterName));

var app = builder.Build();
Constants
MemberValueDescription
ActivitySourceName"HaveIBeenPwned.Client"The stable ActivitySource name for client request spans.
MeterName"HaveIBeenPwned.Client"The stable Meter name for the request and rate-limit instruments.
Instruments
InstrumentKindUnitDescription
hibp.client.request.countCounter{request}Number of logical client requests issued.
hibp.client.request.durationHistogramsDuration of each logical request in seconds.
hibp.client.request.failure.countCounter{request}Number of requests that ended in a non-success response.
hibp.client.rate_limit.countCounter{response}Number of HTTP 429 responses observed.
Sample metric exporttext
hibp.client.request.count{status="200"} 42
hibp.client.request.duration_bucket{le="0.25"} 39
hibp.client.request.failure.count{status="429"} 1
hibp.client.rate_limit.count 1
Privacy note

Never log or export plaintext passwords. K-anonymity range results that do not match the requested value must not be retained.