Add support for Prometheus metrics on /metrics.

This commit is contained in:
Denis-Cosmin Nutiu 2021-07-16 20:49:46 +03:00
parent 2fc1c6cbf5
commit 48124346c0
2 changed files with 5 additions and 1 deletions

View file

@ -11,6 +11,8 @@
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="MongoDB.Driver" Version="2.12.3" />
<PackageReference Include="prometheus-net" Version="4.2.0" />
<PackageReference Include="prometheus-net.AspNetCore" Version="4.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>

View file

@ -9,6 +9,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
using Prometheus;
using Retroactiune.Core.Interfaces;
using Retroactiune.Core.Services;
using Retroactiune.Infrastructure;
@ -19,7 +20,6 @@ namespace Retroactiune
public class Startup
{
// TODO: Support for Sentry.
// TODO: Support for Prometheus.
// TODO: External auth provider.
// TODO: UI?
public Startup(IConfiguration configuration)
@ -68,6 +68,8 @@ namespace Retroactiune
app.UseDeveloperExceptionPage();
}
app.UseMetricServer();
app.UseSwagger();
app.UseSwaggerUI(c =>
{