Instrumentation
Every integration emits traces and metrics via System.Diagnostics (ActivitySource / Meter), which any OpenTelemetry-compatible collection pipeline can consume directly. Both the ActivitySource and the Meter share the name in AddressValidationTelemetry.SourceName ("Visus.AddressValidation").
Setup
Register the OpenTelemetry SDK and point it at the shared source name via AddSource / AddMeter:
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService("MyApp"))
.WithTracing(tracing => tracing.AddSource(AddressValidationTelemetry.SourceName))
.WithMetrics(metrics => metrics.AddMeter(AddressValidationTelemetry.SourceName));
This requires the OpenTelemetry.Extensions.Hosting package:
dotnet add package OpenTelemetry.Extensions.Hosting
Note
The snippet above only registers the source and meter. It does not send data anywhere; add an exporter to WithTracing / WithMetrics as shown in Exporting to a Backend below.
What Is Measured
Activities
| Name | Emitted By | Tags | Description |
|---|---|---|---|
address_validation.validate |
AbstractAddressValidationService<TRequest, TApiResponse> |
address_validation.request_type, address_validation.country, address_validation.result |
Wraps a single ValidateAsync call, from request validation through response mapping. |
address_validation.token_fetch |
AbstractAuthenticationService<TClient> |
address_validation.client_type, address_validation.result |
Wraps a single OAuth 2.0 token fetch on a cache miss. Not started on a cache hit. |
Both activities are marked with ActivityStatusCode.Error and record the exception when the underlying operation throws.
Metrics
| Name | Kind | Unit | Tags | Description |
|---|---|---|---|---|
visus.address_validation.validate.duration |
Histogram<double> | s | address_validation.request_type, address_validation.result, address_validation.country |
Duration of a ValidateAsync call. |
visus.address_validation.validate.response_warning_count |
Histogram<long> | — | address_validation.request_type, address_validation.result, address_validation.country |
Number of warnings on the produced response. Not recorded when the API returns no response. |
visus.address_validation.validate.response_suggestion_count |
Histogram<long> | — | address_validation.request_type, address_validation.result, address_validation.country |
Number of suggestions on the produced response. Not recorded when the API returns no response. |
visus.address_validation.token_fetch.duration |
Histogram<double> | s | address_validation.client_type, address_validation.result |
Duration of a token fetch (cache miss only). |
visus.address_validation.token_fetch.cache_result |
Counter<long> | — | address_validation.client_type, address_validation.cache_result |
Incremented on every token cache lookup, whether it hits or misses. |
Tag Values
| Tag | Values |
|---|---|
address_validation.result (validate) |
success, invalid_request, no_response, invalid_response, error |
address_validation.result (token_fetch) |
success, empty_token, error |
address_validation.cache_result |
hit, miss |
address_validation.request_type |
The TRequest type name (e.g., FedExAddressValidationRequest) |
address_validation.client_type |
The TClient type name of the provider's authentication client |
address_validation.country |
The CountryCode of the request, or unknown when absent |
Exporting to a Backend
The tabs below each extend the Setup snippet with an exporter. Pick the one that matches your observability stack.
- Console
- OTLP Collector
- Azure Monitor
- Datadog
- New Relic
- AWS (X-Ray / CloudWatch)
- Prometheus + Grafana
For local development and debugging. Writes traces and metrics to standard output.
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService("MyApp"))
.WithTracing(tracing => tracing
.AddSource(AddressValidationTelemetry.SourceName)
.AddConsoleExporter())
.WithMetrics(metrics => metrics
.AddMeter(AddressValidationTelemetry.SourceName)
.AddConsoleExporter());
dotnet add package OpenTelemetry.Exporter.Console