Skip to content

Commit

Permalink
Re-add Prometheus options (#312)
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Ahrens <boris.ahrens@gdata.de>
  • Loading branch information
borisahrens and Boris Ahrens authored Feb 26, 2024
1 parent a788ca0 commit df1b65e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/MalwareSampleExchange.Console/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /data
RUN apk add curl
ENTRYPOINT dotnet /data/MalwareSampleExchange.Console.dll

ENV ASPNETCORE_URLS="http://0.0.0.0:8080"
ENV ASPNETCORE_URLS="http://0.0.0.0:8080;http://0.0.0.0:9110"

LABEL org.opencontainers.image.title="Malware Sample Exchange (MSE) Image" \
org.opencontainers.image.description="Malware Sample Exchange (MSE)" \
Expand Down
6 changes: 6 additions & 0 deletions src/MalwareSampleExchange.Console/PrometheusOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace MalwareSampleExchange.Console;

public class PrometheusOptions
{
public int Port { get; set; } = 9110;
}
7 changes: 6 additions & 1 deletion src/MalwareSampleExchange.Console/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ public void ConfigureServices(IServiceCollection services)

public void Configure(IApplicationBuilder app)
{
app.UsePrometheusServer(options => options.Port = 8080);
app.UsePrometheusServer(q =>
{
var options = new PrometheusOptions();
_configuration.GetSection("Prometheus").Bind(options);
q.Port = options.Port;
});

app.UsePrometheusRequestDurations(q =>
{
Expand Down

0 comments on commit df1b65e

Please sign in to comment.