An OpenTelemetry Prometheus exporter that configures an HttpListener instance for Prometheus to scrape.
Warning
This component is intended for dev inner-loop, there is no plan to make it production ready. Production environments should use OpenTelemetry.Exporter.Prometheus.AspNetCore, or a combination of OpenTelemetry.Exporter.OpenTelemetryProtocol and OpenTelemetry Collector.
dotnet add package --prerelease OpenTelemetry.Exporter.Prometheus.HttpListener
var meterProvider = Sdk.CreateMeterProviderBuilder()
.AddMeter(MyMeter.Name)
.AddPrometheusHttpListener(
options => options.UriPrefixes = new string[] { "http://localhost:9464/" })
.Build();
Defines one or more URI (Uniform Resource Identifier) prefixes which will be
used by the HTTP listener. The default value is ["http://localhost:9464/"]
.
Refer to HttpListenerPrefixCollection.Add(String) for more details.
Defines the Prometheus scrape endpoint path. Default value: "/metrics"
.
This component uses an EventSource with the name "OpenTelemetry-Exporter-Prometheus" for its internal logging. Please refer to SDK troubleshooting for instructions on seeing these internal logs.