Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove prometheus metrics endpoint #831

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

22 changes: 1 addition & 21 deletions TeachingRecordSystem/src/TeachingRecordSystem.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
using Microsoft.Extensions.Azure;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.PowerPlatform.Dataverse.Client;
using Prometheus;
using TeachingRecordSystem.Api.Endpoints.IdentityWebHooks;
using TeachingRecordSystem.Api.Infrastructure.ApplicationModel;
using TeachingRecordSystem.Api.Infrastructure.Configuration;
using TeachingRecordSystem.Api.Infrastructure.Filters;
using TeachingRecordSystem.Api.Infrastructure.Json;
using TeachingRecordSystem.Api.Infrastructure.Logging;
Expand Down Expand Up @@ -56,15 +54,12 @@ public static void Main(string[] args)

if (builder.Environment.IsProduction())
{
builder.Configuration
.AddJsonEnvironmentVariable("AppConfig")
.AddJsonEnvironmentVariable("VCAP_APPLICATION", configurationKeyPrefix: "VCAP_APPLICATION");
builder.Configuration.AddJsonEnvironmentVariable("AppConfig");
}

var platformEnvironmentName = configuration["PlatformEnvironment"];
builder.ConfigureLogging(platformEnvironmentName);

var platform = configuration.GetRequiredValue("Platform");
var pgConnectionString = configuration.GetRequiredValue("ConnectionStrings:DefaultConnection");

services.AddAuthentication(ApiKeyAuthenticationHandler.AuthenticationScheme)
Expand Down Expand Up @@ -265,11 +260,6 @@ public static void Main(string[] args)
services.AddRedis(env, configuration, healthCheckBuilder);
services.AddRateLimiting(env, configuration);

if (platform == "PAAS")
{
MetricLabels.ConfigureLabels(builder.Configuration);
}

if (builder.Environment.IsProduction())
{
builder.Services.Configure<ForwardedHeadersOptions>(options =>
Expand All @@ -295,11 +285,6 @@ public static void Main(string[] args)

app.UseRouting();

if (platform == "PAAS")
{
app.UseHttpMetrics();
}

app.UseHealthChecks("/status");

app.UseAuthentication();
Expand Down Expand Up @@ -333,11 +318,6 @@ public static void Main(string[] args)

app.MapWebHookEndpoints();

if (platform == "PAAS")
{
app.MapMetrics();
}

app.MapControllers();

if (configuration.GetValue<bool>("RecurringJobs:Enabled") && !builder.Environment.IsUnitTests() && !builder.Environment.IsEndToEndTests())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="NSwag.AspNetCore" Version="13.20.0" />
<PackageReference Include="NSwag.Examples" Version="1.0.10" />
<PackageReference Include="prometheus-net.AspNetCore" Version="6.0.0" />
<PackageReference Include="RedisRateLimiting.AspNetCore" Version="1.0.8" />
<PackageReference Include="Sentry.AspNetCore" Version="3.35.0" />
<PackageReference Include="Sentry.Serilog" Version="3.35.0" />
Expand All @@ -49,12 +48,6 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="entrypoint.sh">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TeachingRecordSystem.Core\TeachingRecordSystem.Core.csproj" />
</ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion terraform/aks/app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ module "api_application_configuration" {
secret_key_vault_short = "api"

config_variables = {
Platform = "AKS"
PlatformEnvironment = var.environment_name
DistributedLockContainerName = azurerm_storage_container.locks.name
DqtReporting__RunService = var.run_dqt_reporting_service
Expand Down
Loading