OpenTelemetryInstaller — Console
Key: OpenTelemetry
Default Enabled: ✅
Package: SaveApis.Framework.Console
Purpose
Registers the OpenTelemetry SDK and exports logs, metrics, and traces to any OTLP-compatible backend for background worker and hosted service applications.
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
Logging:
IncludeFormattedMessage,ParseStateValues,IncludeScopesenabled
Metrics (when enabled):
- .NET runtime instrumentation
- HttpClient instrumentation
Tracing (when enabled):
- HttpClient instrumentation (records exceptions)
Note: There is no ASP.NET Core instrumentation in the Console Framework. For web-specific instrumentation, use the Web Framework.
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
}
}
}
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 |
Example:
OpenTelemetry__Endpoint=http://otel-collector:4317
OpenTelemetry__Protocol=Grpc
OpenTelemetry__Metrics__Enabled=true
OpenTelemetry__Tracing__Enabled=true
InstallerContext Extension
installer.WithOpenTelemetry(bool enabled = true);
Difference from Web OpenTelemetryInstaller
| Feature | Web | Console |
|---|---|---|
| ASP.NET Core metrics | ✅ | ❌ |
| ASP.NET Core tracing | ✅ | ❌ |
| Ignored paths filter | ✅ | ❌ |
| HttpClient metrics | ✅ | ✅ |
| HttpClient tracing | ✅ | ✅ |
| Runtime metrics | ✅ | ✅ |
Related
- Console Framework Overview
- LoggingInstaller — console log output (separate from OTLP export)