Skip to content

Commit

Permalink
Remove prometheus metrics endpoint (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad authored Sep 19, 2023
1 parent 4448e5c commit c53eb91
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 50 deletions.

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

0 comments on commit c53eb91

Please sign in to comment.