OpenTelemetry
Identifier: PowerShellUniversal.Plugins.OpenTelemetry
The OpenTelemetry plugin exports PowerShell Universal metrics and ASP.NET Core traces through OTLP. Use an OpenTelemetry-compatible collector, dashboard, or metrics backend to inspect platform activity and custom API endpoint requests.
Enable the plugin
Add the exact, fully qualified plugin identifier to the Plugins array in appsettings.json. The default persistence provider is SQLite.
{
"Plugins": [
"PowerShellUniversal.SQLite",
"PowerShellUniversal.Plugins.OpenTelemetry"
]
}Configure the OTLP endpoint and restart PowerShell Universal after changing plugin or telemetry settings.
Configure OTLP export
Set OpenTelemetry:Otlp:Endpoint to use one endpoint for both metrics and traces. If the fallback endpoint ends in /v1/metrics, PowerShell Universal uses that URL for metrics and automatically uses the corresponding /v1/traces URL for traces.
{
"OpenTelemetry": {
"Otlp": {
"Endpoint": "http://localhost:4318/v1/metrics"
}
}
}To use separate collectors or endpoints, configure the signal-specific settings. These settings override the fallback endpoint for their respective signals.
The default service name is PowerShellUniversal. OTLP uses HTTP/protobuf by default. To set the protocol explicitly, set OTEL_EXPORTER_OTLP_PROTOCOL to the .NET enum name HttpProtobuf or Grpc.
Custom API endpoint telemetry
The plugin instruments custom API endpoint requests, including conventional and regular-expression endpoints. Each request produces an ASP.NET Core trace span named with the HTTP method and endpoint definition, such as GET /users/{id}.
Endpoint spans include these attributes:
http.route
The configured endpoint URL or pattern.
psu.endpoint.id
The PowerShell Universal endpoint ID.
psu.endpoint.url
The configured endpoint URL or pattern.
http.response.status_code
The HTTP status code returned by the endpoint.
Use these attributes to filter traces for a particular endpoint or response status in your telemetry backend.
The plugin also exports endpoint metrics through the PSU.Endpoints meter:
PSU.Endpoint.Execution.CountPSU.Endpoint.Execution.Durationin millisecondsPSU.Endpoint.Execution.IncomingContentLengthin bytesPSU.Endpoint.Execution.OutgoingContentLengthin bytes
Prometheus metrics
Prometheus can receive OTLP metrics when its OTLP receiver is enabled.
Configure the metrics endpoint with Prometheus's OTLP metrics URL. Prometheus is a metrics backend; configure a trace-capable collector or backend separately when you also want to export traces.
Environment variables
Use double underscores for nested configuration keys and zero-based indexes for the Plugins array. This Docker Compose example enables the plugin and exports metrics and traces over HTTP/protobuf:
You can also configure signal-specific endpoints:
Last updated
Was this helpful?