Prometheus fixes (#2433)

This commit is contained in:
Cijo Thomas 2021-09-30 14:41:29 -07:00 committed by GitHub
parent 90d93fb637
commit 124c12afdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -31,7 +31,7 @@ namespace Examples.Console
/// dotnet run -p Examples.Console.csproj inmemory
/// dotnet run -p Examples.Console.csproj zipkin -u http://localhost:9411/api/v2/spans
/// dotnet run -p Examples.Console.csproj jaeger -h localhost -p 6831
/// dotnet run -p Examples.Console.csproj prometheus -i 15 -p 9184 -d 2
/// dotnet run -p Examples.Console.csproj prometheus -p 9184 -d 2
/// dotnet run -p Examples.Console.csproj otlp -e "http://localhost:4317"
/// dotnet run -p Examples.Console.csproj zpages
/// dotnet run -p Examples.Console.csproj metrics --help

View File

@ -52,7 +52,7 @@ namespace Examples.Console
.AddPrometheusExporter(opt =>
{
opt.StartHttpListener = true;
opt.HttpListenerPrefixes = new string[] { $"http://*:{port}/" };
opt.HttpListenerPrefixes = new string[] { $"http://localhost:{port}/" };
})
.Build();

View File

@ -53,6 +53,11 @@ namespace OpenTelemetry.Exporter.Prometheus
path = $"/{path}";
}
if (!path.EndsWith("/"))
{
path = $"{path}/";
}
foreach (string prefix in exporter.Options.HttpListenerPrefixes)
{
this.httpListener.Prefixes.Add($"{prefix.TrimEnd('/')}{path}");