OpenTelemetryInstaller — Web
Key: OpenTelemetry
Default Enabled: ✅
Package: SaveApis.Framework.Web
Purpose
Registers the OpenTelemetry SDK and exports logs, metrics, and traces to any OTLP-compatible backend (e.g. Grafana, Jaeger, Seq, BetterStack).
The OpenTelemetry resource is identified by SaveApisApplication.Name, SaveApisApplication.Namespace, and Environment.MachineName.
What It Does
Resource:
- Service name:
SaveApisApplication.Name - Service namespace:
SaveApisApplication.Namespace - Instance ID:
Environment.MachineName - Telemetry SDK attributes
Logging:
- Enables
IncludeFormattedMessage,ParseStateValues,IncludeScopes
Metrics (when enabled):
- .NET runtime instrumentation
- HttpClient instrumentation
- ASP.NET Core instrumentation
Tracing (when enabled):
- HttpClient instrumentation (records exceptions)
- ASP.NET Core instrumentation (records exceptions, filters ignored paths)
Dependencies
No dependencies on other installers.
Configuration
appsettings.json
{
"OpenTelemetry": {
"Endpoint": "http://localhost:4317",
"Protocol": "Grpc",
"Logging": {
"Enabled": true
},
"Metrics": {
"Enabled": true
},
"Tracing": {
"Enabled": true,
"IgnoredPaths": ["/scalar", "/openapi", "/health"]
}
}
}
Environment Variables
| Variable | Type | Default | Description |
|---|---|---|---|
OpenTelemetry__Endpoint |
Uri |
(required) | OTLP exporter endpoint |
OpenTelemetry__Protocol |
OtlpExportProtocol |
Grpc |
Grpc or HttpProtobuf |
OpenTelemetry__Logging__Enabled |
bool |
true |
Enable log export via OTLP |
OpenTelemetry__Metrics__Enabled |
bool |
true |
Enable metrics export |
OpenTelemetry__Tracing__Enabled |
bool |
true |
Enable trace export |
OpenTelemetry__Tracing__IgnoredPaths__0 |
string |
/scalar |
First ignored path prefix |
OpenTelemetry__Tracing__IgnoredPaths__1 |
string |
/openapi |
Second ignored path prefix |
Example:
OpenTelemetry__Endpoint=http://otel-collector:4317
OpenTelemetry__Protocol=Grpc
OpenTelemetry__Tracing__IgnoredPaths__0=/scalar
OpenTelemetry__Tracing__IgnoredPaths__1=/openapi
OpenTelemetry__Tracing__IgnoredPaths__2=/health
InstallerContext Extension
installer.WithOpenTelemetry(bool enabled = true);
Example — disable in local development:
installer.WithOpenTelemetry(false);
Notes
- The
Endpointis required when this installer is enabled. If absent, the OTLP exporter will fail to initialize. - Paths listed in
IgnoredPathsare matched by prefix (case-insensitive). The defaults exclude the Scalar UI and OpenAPI document endpoint from tracing. - To add Marten/Wolverine traces and metrics, use CritterStack which registers additional OTLP sources.
Related
- Web Framework Overview
- LoggingInstaller — console log output (separate from OTLP export)