diff --git a/deployments/docker-compose/docker-compose.yaml b/deployments/docker-compose/docker-compose.yaml index 83a84f3..6b419c9 100644 --- a/deployments/docker-compose/docker-compose.yaml +++ b/deployments/docker-compose/docker-compose.yaml @@ -144,7 +144,46 @@ services: networks: - booking + ####################################################### + # prometheus + ####################################################### + prometheus: + image: prom/prometheus:latest + container_name: prometheus + ports: + - "9090:9090" + environment: + - TZ=UTC + volumes: + - ./monitoring/prom/prometheus.yml:/etc/prometheus/prometheus.yml + networks: + - booking + ####################################################### + # grafana + ####################################################### + grafana: + image: grafana/grafana + container_name: grafana + ports: + - "3000:3000" + volumes: + - ./monitoring/grafana-data/data:/var/lib/grafana + networks: + - booking + + ####################################################### + # node_exporter + ####################################################### + node_exporter: + image: prom/node-exporter + container_name: node_exporter + restart: unless-stopped + ports: + - 9101:9100 + networks: + - booking + ###################################################### # Gateway ###################################################### diff --git a/deployments/docker-compose/infrastracture.yaml b/deployments/docker-compose/infrastracture.yaml index 808c430..e0fca93 100644 --- a/deployments/docker-compose/infrastracture.yaml +++ b/deployments/docker-compose/infrastracture.yaml @@ -158,6 +158,46 @@ services: ports: - 6379:6379 + ####################################################### + # prometheus + ####################################################### + prometheus: + image: prom/prometheus:latest + container_name: prometheus + ports: + - "9090:9090" + environment: + - TZ=UTC + volumes: + - ./monitoring/prom/prometheus.yml:/etc/prometheus/prometheus.yml + networks: + - booking + + ####################################################### + # grafana + ####################################################### + grafana: + image: grafana/grafana + container_name: grafana + ports: + - "3000:3000" + volumes: + - ./monitoring/grafana-data/data:/var/lib/grafana + networks: + - booking + + ####################################################### + # node_exporter + ####################################################### + node_exporter: + image: prom/node-exporter + container_name: node_exporter + restart: unless-stopped + ports: + - 9101:9100 + networks: + - booking + networks: booking: diff --git a/deployments/docker-compose/monitoring/grafana-data/data/alerting/1/__default__.tmpl b/deployments/docker-compose/monitoring/grafana-data/data/alerting/1/__default__.tmpl new file mode 100644 index 0000000..b8633d1 --- /dev/null +++ b/deployments/docker-compose/monitoring/grafana-data/data/alerting/1/__default__.tmpl @@ -0,0 +1,53 @@ + +{{ define "__subject" }}[{{ .Status | toUpper }}{{ if eq .Status "firing" }}:{{ .Alerts.Firing | len }}{{ if gt (.Alerts.Resolved | len) 0 }}, RESOLVED:{{ .Alerts.Resolved | len }}{{ end }}{{ end }}] {{ .GroupLabels.SortedPairs.Values | join " " }} {{ if gt (len .CommonLabels) (len .GroupLabels) }}({{ with .CommonLabels.Remove .GroupLabels.Names }}{{ .Values | join " " }}{{ end }}){{ end }}{{ end }} + +{{ define "__text_values_list" }}{{ if len .Values }}{{ $first := true }}{{ range $refID, $value := .Values -}} +{{ if $first }}{{ $first = false }}{{ else }}, {{ end }}{{ $refID }}={{ $value }}{{ end -}} +{{ else }}[no value]{{ end }}{{ end }} + +{{ define "__text_alert_list" }}{{ range . }} +Value: {{ template "__text_values_list" . }} +Labels: +{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }} +{{ end }}Annotations: +{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }} +{{ end }}{{ if gt (len .GeneratorURL) 0 }}Source: {{ .GeneratorURL }} +{{ end }}{{ if gt (len .SilenceURL) 0 }}Silence: {{ .SilenceURL }} +{{ end }}{{ if gt (len .DashboardURL) 0 }}Dashboard: {{ .DashboardURL }} +{{ end }}{{ if gt (len .PanelURL) 0 }}Panel: {{ .PanelURL }} +{{ end }}{{ end }}{{ end }} + +{{ define "default.title" }}{{ template "__subject" . }}{{ end }} + +{{ define "default.message" }}{{ if gt (len .Alerts.Firing) 0 }}**Firing** +{{ template "__text_alert_list" .Alerts.Firing }}{{ if gt (len .Alerts.Resolved) 0 }} + +{{ end }}{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}**Resolved** +{{ template "__text_alert_list" .Alerts.Resolved }}{{ end }}{{ end }} + + +{{ define "__teams_text_alert_list" }}{{ range . }} +Value: {{ template "__text_values_list" . }} +Labels: +{{ range .Labels.SortedPairs }} - {{ .Name }} = {{ .Value }} +{{ end }} +Annotations: +{{ range .Annotations.SortedPairs }} - {{ .Name }} = {{ .Value }} +{{ end }} +{{ if gt (len .GeneratorURL) 0 }}Source: [{{ .GeneratorURL }}]({{ .GeneratorURL }}) + +{{ end }}{{ if gt (len .SilenceURL) 0 }}Silence: [{{ .SilenceURL }}]({{ .SilenceURL }}) + +{{ end }}{{ if gt (len .DashboardURL) 0 }}Dashboard: [{{ .DashboardURL }}]({{ .DashboardURL }}) + +{{ end }}{{ if gt (len .PanelURL) 0 }}Panel: [{{ .PanelURL }}]({{ .PanelURL }}) + +{{ end }} +{{ end }}{{ end }} + + +{{ define "teams.default.message" }}{{ if gt (len .Alerts.Firing) 0 }}**Firing** +{{ template "__teams_text_alert_list" .Alerts.Firing }}{{ if gt (len .Alerts.Resolved) 0 }} + +{{ end }}{{ end }}{{ if gt (len .Alerts.Resolved) 0 }}**Resolved** +{{ template "__teams_text_alert_list" .Alerts.Resolved }}{{ end }}{{ end }} diff --git a/deployments/docker-compose/monitoring/grafana-data/data/grafana.db b/deployments/docker-compose/monitoring/grafana-data/data/grafana.db new file mode 100644 index 0000000..f8713c0 Binary files /dev/null and b/deployments/docker-compose/monitoring/grafana-data/data/grafana.db differ diff --git a/deployments/docker-compose/monitoring/prom/prometheus.yml b/deployments/docker-compose/monitoring/prom/prometheus.yml new file mode 100644 index 0000000..2153661 --- /dev/null +++ b/deployments/docker-compose/monitoring/prom/prometheus.yml @@ -0,0 +1,61 @@ +global: + scrape_interval: 15s + scrape_timeout: 10s + evaluation_interval: 15s +alerting: + alertmanagers: + - scheme: http + timeout: 10s + api_version: v1 + static_configs: + - targets: [] +scrape_configs: +- job_name: prometheus + honor_timestamps: true + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - localhost:9090 +- job_name: flight + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - host.docker.internal:5004 +- job_name: identity + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - host.docker.internal:6005 +- job_name: passenger + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - host.docker.internal:6012 +- job_name: booking + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: http + static_configs: + - targets: + - host.docker.internal:6010 +- job_name: gateway + scrape_interval: 15s + scrape_timeout: 10s + metrics_path: /metrics + scheme: https + static_configs: + - targets: + - host.docker.internal:5000 \ No newline at end of file diff --git a/src/ApiGateway/Dockerfile b/src/ApiGateway/Dockerfile index c2b1d62..2103d12 100644 --- a/src/ApiGateway/Dockerfile +++ b/src/ApiGateway/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR /src # Setup working directory for the project @@ -26,7 +26,7 @@ WORKDIR /src/ApiGateway/src # and no build, as we did it already RUN dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR /app diff --git a/src/ApiGateway/dev.Dockerfile b/src/ApiGateway/dev.Dockerfile index a31e806..c177a19 100644 --- a/src/ApiGateway/dev.Dockerfile +++ b/src/ApiGateway/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR /src # Setup working directory for the project @@ -29,7 +29,7 @@ WORKDIR /src/ApiGateway/src RUN --mount=type=cache,id=gateway_nuget,target=/root/.nuget/packages \ dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR /app diff --git a/src/ApiGateway/src/ApiGateway.csproj b/src/ApiGateway/src/ApiGateway.csproj index 8c97b06..f7204b1 100644 --- a/src/ApiGateway/src/ApiGateway.csproj +++ b/src/ApiGateway/src/ApiGateway.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable diff --git a/src/BuildingBlocks/BuildingBlocks.csproj b/src/BuildingBlocks/BuildingBlocks.csproj index 8595b07..e7a1937 100644 --- a/src/BuildingBlocks/BuildingBlocks.csproj +++ b/src/BuildingBlocks/BuildingBlocks.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable @@ -37,7 +37,8 @@ - + + all @@ -117,11 +118,11 @@ - - - - - + + + + + all diff --git a/src/BuildingBlocks/OpenTelemetry/Extensions.cs b/src/BuildingBlocks/OpenTelemetry/Extensions.cs index d842616..a31a3d9 100644 --- a/src/BuildingBlocks/OpenTelemetry/Extensions.cs +++ b/src/BuildingBlocks/OpenTelemetry/Extensions.cs @@ -6,17 +6,38 @@ using OpenTelemetry.Trace; namespace BuildingBlocks.OpenTelemetry; +using global::OpenTelemetry.Metrics; + public static class Extensions { public static IServiceCollection AddCustomOpenTelemetry(this IServiceCollection services) { - services.AddOpenTelemetryTracing(builder => builder - .AddGrpcClientInstrumentation() - .AddMassTransitInstrumentation() - .AddAspNetCoreInstrumentation() - .AddHttpClientInstrumentation() - .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(services.GetOptions("AppOptions").Name)) - .AddJaegerExporter()); + services.AddOpenTelemetry() + .WithTracing(builder => builder + .AddGrpcClientInstrumentation() + .AddMassTransitInstrumentation() + .AddAspNetCoreInstrumentation() + .AddHttpClientInstrumentation() + .SetResourceBuilder(ResourceBuilder.CreateDefault() + .AddService(services.GetOptions("AppOptions").Name)) + .AddJaegerExporter()) + .WithMetrics(builder => + { + builder.AddPrometheusExporter(); + builder.AddMeter( + "Microsoft.AspNetCore.Hosting", + "Microsoft.AspNetCore.Server.Kestrel" + ); + builder.AddView("request-duration", + new ExplicitBucketHistogramConfiguration + { + Boundaries = new[] + { + 0, 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 + } + }); + } + ); return services; } diff --git a/src/Services/Booking/Dockerfile b/src/Services/Booking/Dockerfile index 1d61dcc..9ccec65 100644 --- a/src/Services/Booking/Dockerfile +++ b/src/Services/Booking/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR / # Setup working directory for the project @@ -27,7 +27,7 @@ WORKDIR /Services/Booking/src/Booking.Api # and no build, as we did it already RUN dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Booking/dev.Dockerfile b/src/Services/Booking/dev.Dockerfile index a75037f..212ab55 100644 --- a/src/Services/Booking/dev.Dockerfile +++ b/src/Services/Booking/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR / # Setup working directory for the project @@ -30,7 +30,7 @@ WORKDIR /Services/Booking/src/Booking.Api RUN --mount=type=cache,id=booking_nuget,target=/root/.nuget/packages\ dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Booking/src/Booking.Api/Booking.Api.csproj b/src/Services/Booking/src/Booking.Api/Booking.Api.csproj index af8b754..fb05520 100644 --- a/src/Services/Booking/src/Booking.Api/Booking.Api.csproj +++ b/src/Services/Booking/src/Booking.Api/Booking.Api.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/src/Services/Booking/src/Booking/Booking.csproj b/src/Services/Booking/src/Booking/Booking.csproj index 22fd0ed..e1c5ef5 100644 --- a/src/Services/Booking/src/Booking/Booking.csproj +++ b/src/Services/Booking/src/Booking/Booking.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/src/Services/Booking/src/Booking/Extensions/Infrastructure/InfrastructureExtensions.cs b/src/Services/Booking/src/Booking/Extensions/Infrastructure/InfrastructureExtensions.cs index 036912a..928f3ed 100644 --- a/src/Services/Booking/src/Booking/Extensions/Infrastructure/InfrastructureExtensions.cs +++ b/src/Services/Booking/src/Booking/Extensions/Infrastructure/InfrastructureExtensions.cs @@ -88,15 +88,15 @@ public static class InfrastructureExtensions var env = app.Environment; var appOptions = app.GetOptions(nameof(AppOptions)); + app.MapPrometheusScrapingEndpoint(); + app.UseCustomProblemDetails(); app.UseSerilogRequestLogging(options => { options.EnrichDiagnosticContext = LogEnrichHelper.EnrichFromRequest; }); app.UseCorrelationId(); - app.UseHttpMetrics(); app.UseCustomHealthCheck(); - app.MapMetrics(); app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name)); if (env.IsDevelopment()) diff --git a/src/Services/Booking/tests/IntegrationTest/Integration.Test.csproj b/src/Services/Booking/tests/IntegrationTest/Integration.Test.csproj index 6b0d8b3..b100fdf 100644 --- a/src/Services/Booking/tests/IntegrationTest/Integration.Test.csproj +++ b/src/Services/Booking/tests/IntegrationTest/Integration.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false enable diff --git a/src/Services/Flight/Dockerfile b/src/Services/Flight/Dockerfile index 21154ac..a3acedd 100644 --- a/src/Services/Flight/Dockerfile +++ b/src/Services/Flight/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR / # Setup working directory for the project @@ -27,7 +27,7 @@ WORKDIR /Services/Flight/src/Flight.Api # and no build, as we did it already RUN dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Flight/dev.Dockerfile b/src/Services/Flight/dev.Dockerfile index c7b76cb..11026f0 100644 --- a/src/Services/Flight/dev.Dockerfile +++ b/src/Services/Flight/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR / # Setup working directory for the project @@ -30,7 +30,7 @@ WORKDIR /Services/Flight/src/Flight.Api RUN --mount=type=cache,id=flight_nuget,target=/root/.nuget/packages \ dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Flight/src/Flight.Api/Flight.Api.csproj b/src/Services/Flight/src/Flight.Api/Flight.Api.csproj index 3bfc53c..7eb9df1 100644 --- a/src/Services/Flight/src/Flight.Api/Flight.Api.csproj +++ b/src/Services/Flight/src/Flight.Api/Flight.Api.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/src/Services/Flight/src/Flight/Extensions/Infrastructure/InfrastructureExtensions.cs b/src/Services/Flight/src/Flight/Extensions/Infrastructure/InfrastructureExtensions.cs index 25837e1..7890a8e 100644 --- a/src/Services/Flight/src/Flight/Extensions/Infrastructure/InfrastructureExtensions.cs +++ b/src/Services/Flight/src/Flight/Extensions/Infrastructure/InfrastructureExtensions.cs @@ -23,13 +23,10 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Prometheus; using Serilog; namespace Flight.Extensions.Infrastructure; -using BuildingBlocks.PersistMessageProcessor.Data; - public static class InfrastructureExtensions { public static WebApplicationBuilder AddInfrastructure(this WebApplicationBuilder builder) @@ -95,15 +92,15 @@ public static class InfrastructureExtensions var env = app.Environment; var appOptions = app.GetOptions(nameof(AppOptions)); + app.MapPrometheusScrapingEndpoint(); + app.UseCustomProblemDetails(); app.UseSerilogRequestLogging(options => { options.EnrichDiagnosticContext = LogEnrichHelper.EnrichFromRequest; }); app.UseCorrelationId(); - app.UseHttpMetrics(); app.UseMigration(env); - app.MapMetrics(); app.UseCustomHealthCheck(); app.MapGrpcService(); app.UseRateLimiter(); diff --git a/src/Services/Flight/src/Flight/Flight.csproj b/src/Services/Flight/src/Flight/Flight.csproj index 5ec1a9a..0b9e03c 100644 --- a/src/Services/Flight/src/Flight/Flight.csproj +++ b/src/Services/Flight/src/Flight/Flight.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable diff --git a/src/Services/Flight/tests/EndToEndTest/EndToEnd.Test.csproj b/src/Services/Flight/tests/EndToEndTest/EndToEnd.Test.csproj index 6acf245..8726cab 100644 --- a/src/Services/Flight/tests/EndToEndTest/EndToEnd.Test.csproj +++ b/src/Services/Flight/tests/EndToEndTest/EndToEnd.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable false diff --git a/src/Services/Flight/tests/IntegrationTest/Integration.Test.csproj b/src/Services/Flight/tests/IntegrationTest/Integration.Test.csproj index ed55732..ca1dc0a 100644 --- a/src/Services/Flight/tests/IntegrationTest/Integration.Test.csproj +++ b/src/Services/Flight/tests/IntegrationTest/Integration.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false enable diff --git a/src/Services/Flight/tests/UnitTest/Unit.Test.csproj b/src/Services/Flight/tests/UnitTest/Unit.Test.csproj index d69eeb2..d4c3137 100644 --- a/src/Services/Flight/tests/UnitTest/Unit.Test.csproj +++ b/src/Services/Flight/tests/UnitTest/Unit.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false enable diff --git a/src/Services/Identity/Dockerfile b/src/Services/Identity/Dockerfile index 9a6c0c6..f18ef44 100644 --- a/src/Services/Identity/Dockerfile +++ b/src/Services/Identity/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder # Setup working directory for the project WORKDIR / @@ -26,7 +26,7 @@ WORKDIR /Services/Identity/src/Identity.Api # and no build, as we did it already RUN dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Identity/dev.Dockerfile b/src/Services/Identity/dev.Dockerfile index e7072b3..5f59253 100644 --- a/src/Services/Identity/dev.Dockerfile +++ b/src/Services/Identity/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder # Setup working directory for the project WORKDIR / @@ -29,7 +29,7 @@ WORKDIR /Services/Identity/src/Identity.Api RUN --mount=type=cache,id=identity_nuget,target=/root/.nuget/packages \ dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Identity/src/Identity.Api/Identity.Api.csproj b/src/Services/Identity/src/Identity.Api/Identity.Api.csproj index 51a2b7c..0dd41d7 100644 --- a/src/Services/Identity/src/Identity.Api/Identity.Api.csproj +++ b/src/Services/Identity/src/Identity.Api/Identity.Api.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/src/Services/Identity/src/Identity/Extensions/Infrastructure/InfrastructureExtensions.cs b/src/Services/Identity/src/Identity/Extensions/Infrastructure/InfrastructureExtensions.cs index e9333e3..db0b96e 100644 --- a/src/Services/Identity/src/Identity/Extensions/Infrastructure/InfrastructureExtensions.cs +++ b/src/Services/Identity/src/Identity/Extensions/Infrastructure/InfrastructureExtensions.cs @@ -92,6 +92,8 @@ public static class InfrastructureExtensions var env = app.Environment; var appOptions = app.GetOptions(nameof(AppOptions)); + app.MapPrometheusScrapingEndpoint(); + app.UseForwardedHeaders(); app.UseCustomProblemDetails(); @@ -101,11 +103,8 @@ public static class InfrastructureExtensions }); app.UseMigration(env); app.UseCorrelationId(); - app.UseHttpMetrics(); app.UseCustomHealthCheck(); app.UseIdentityServer(); - app.MapMetrics(); - app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name)); diff --git a/src/Services/Identity/src/Identity/Identity.csproj b/src/Services/Identity/src/Identity/Identity.csproj index cf433e1..f7fa9d7 100644 --- a/src/Services/Identity/src/Identity/Identity.csproj +++ b/src/Services/Identity/src/Identity/Identity.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable diff --git a/src/Services/Identity/tests/IntegrationTest/Integration.Test.csproj b/src/Services/Identity/tests/IntegrationTest/Integration.Test.csproj index 7153e37..6730933 100644 --- a/src/Services/Identity/tests/IntegrationTest/Integration.Test.csproj +++ b/src/Services/Identity/tests/IntegrationTest/Integration.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false enable diff --git a/src/Services/Passenger/Dockerfile b/src/Services/Passenger/Dockerfile index a95093c..d94b450 100644 --- a/src/Services/Passenger/Dockerfile +++ b/src/Services/Passenger/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR / # Setup working directory for the project @@ -27,7 +27,7 @@ WORKDIR /Services/Passenger/src/Passenger.Api # and no build, as we did it already RUN dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Passenger/dev.Dockerfile b/src/Services/Passenger/dev.Dockerfile index f8809ac..a59b524 100644 --- a/src/Services/Passenger/dev.Dockerfile +++ b/src/Services/Passenger/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder +FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS builder WORKDIR / # Setup working directory for the project @@ -30,7 +30,7 @@ WORKDIR /Services/Passenger/src/Passenger.Api RUN --mount=type=cache,id=passenger_nuget,target=/root/.nuget/packages \ dotnet publish -c Release --no-build -o out -FROM mcr.microsoft.com/dotnet/aspnet:7.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview # Setup working directory for the project WORKDIR / diff --git a/src/Services/Passenger/src/Passenger.Api/Passenger.Api.csproj b/src/Services/Passenger/src/Passenger.Api/Passenger.Api.csproj index f18f014..1fabf7c 100644 --- a/src/Services/Passenger/src/Passenger.Api/Passenger.Api.csproj +++ b/src/Services/Passenger/src/Passenger.Api/Passenger.Api.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/src/Services/Passenger/src/Passenger/Extensions/Infrastructure/InfrastructureExtensions.cs b/src/Services/Passenger/src/Passenger/Extensions/Infrastructure/InfrastructureExtensions.cs index f2efd59..2a4c7f5 100644 --- a/src/Services/Passenger/src/Passenger/Extensions/Infrastructure/InfrastructureExtensions.cs +++ b/src/Services/Passenger/src/Passenger/Extensions/Infrastructure/InfrastructureExtensions.cs @@ -21,7 +21,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Passenger.Data; using Passenger.GrpcServer.Services; -using Prometheus; using Serilog; namespace Passenger.Extensions.Infrastructure; @@ -87,6 +86,8 @@ public static class InfrastructureExtensions var env = app.Environment; var appOptions = app.GetOptions(nameof(AppOptions)); + app.MapPrometheusScrapingEndpoint(); + app.UseCustomProblemDetails(); app.UseSerilogRequestLogging(options => { @@ -94,9 +95,7 @@ public static class InfrastructureExtensions }); app.UseMigration(env); app.UseCorrelationId(); - app.UseHttpMetrics(); app.UseCustomHealthCheck(); - app.MapMetrics(); app.MapGrpcService(); app.MapGet("/", x => x.Response.WriteAsync(appOptions.Name)); diff --git a/src/Services/Passenger/src/Passenger/Passenger.csproj b/src/Services/Passenger/src/Passenger/Passenger.csproj index 40cf04a..7718fe1 100644 --- a/src/Services/Passenger/src/Passenger/Passenger.csproj +++ b/src/Services/Passenger/src/Passenger/Passenger.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/src/Services/Passenger/tests/IntegrationTest/Integration.Test.csproj b/src/Services/Passenger/tests/IntegrationTest/Integration.Test.csproj index 686c844..9b417a2 100644 --- a/src/Services/Passenger/tests/IntegrationTest/Integration.Test.csproj +++ b/src/Services/Passenger/tests/IntegrationTest/Integration.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false enable