Skip to content

Commit d215c52

Browse files
joperezrsamsp-msftJamesNK
authored
Remove Prometheus commented out code that does not work (#4096)
* Remove Prometheus commented out code that does not work * Update Extensions.cs * Update Extensions.cs * Update src/Aspire.ProjectTemplates/templates/aspire-empty/AspireApplication.1.ServiceDefaults/Extensions.cs * Update Extensions.cs * Update Extensions.cs * Update Extensions.cs * Apply suggestions from code review Co-authored-by: James Newton-King <[email protected]> * Apply suggestions from code review --------- Co-authored-by: Sam Spencer <[email protected]> Co-authored-by: James Newton-King <[email protected]>
1 parent 7d0dde4 commit d215c52

File tree

3 files changed

+9
-21
lines changed
  • src/Aspire.ProjectTemplates/templates

3 files changed

+9
-21
lines changed

src/Aspire.ProjectTemplates/templates/aspire-empty/AspireApplication.1.ServiceDefaults/Extensions.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
namespace Microsoft.Extensions.Hosting;
1111

12+
// Adds common .NET Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
13+
// This project should be referenced by each service project in your solution.
14+
// To learn more about using this project, see https://aka.ms/dotnet/aspire/service-defaults
1215
public static class Extensions
1316
{
1417
public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
@@ -68,10 +71,6 @@ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostAppli
6871
builder.Services.AddOpenTelemetry().UseOtlpExporter();
6972
}
7073

71-
// Uncomment the following lines to enable the Prometheus exporter (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
72-
// builder.Services.AddOpenTelemetry()
73-
// .WithMetrics(metrics => metrics.AddPrometheusExporter());
74-
7574
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
7675
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
7776
//{
@@ -105,9 +104,6 @@ public static WebApplication MapDefaultEndpoints(this WebApplication app)
105104
{
106105
Predicate = r => r.Tags.Contains("live")
107106
});
108-
109-
// Uncomment the following line to enable the Prometheus endpoint (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
110-
// app.MapPrometheusScrapingEndpoint();
111107
}
112108

113109
return app;

src/Aspire.ProjectTemplates/templates/aspire-servicedefaults/Extensions.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
namespace Microsoft.Extensions.Hosting;
1212

13+
// Adds common .NET Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
14+
// This project should be referenced by each service project in your solution.
15+
// To learn more about using this project, see https://aka.ms/dotnet/aspire/service-defaults
1316
public static class Extensions
1417
{
1518
public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
@@ -75,10 +78,6 @@ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostAppli
7578
builder.Services.AddOpenTelemetry().UseOtlpExporter();
7679
}
7780

78-
// Uncomment the following lines to enable the Prometheus exporter (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
79-
// builder.Services.AddOpenTelemetry()
80-
// .WithMetrics(metrics => metrics.AddPrometheusExporter());
81-
8281
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
8382
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
8483
//{
@@ -100,9 +99,6 @@ public static IHostApplicationBuilder AddDefaultHealthChecks(this IHostApplicati
10099

101100
public static WebApplication MapDefaultEndpoints(this WebApplication app)
102101
{
103-
// Uncomment the following line to enable the Prometheus endpoint (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
104-
// app.MapPrometheusScrapingEndpoint();
105-
106102
// Adding health checks endpoints to applications in non-development environments has security implications.
107103
// See https://aka.ms/dotnet/aspire/healthchecks for details before enabling these endpoints in non-development environments.
108104
if (app.Environment.IsDevelopment())

src/Aspire.ProjectTemplates/templates/aspire-starter/AspireStarterApplication.1.ServiceDefaults/Extensions.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
namespace Microsoft.Extensions.Hosting;
1111

12+
// Adds common .NET Aspire services: service discovery, resilience, health checks, and OpenTelemetry.
13+
// This project should be referenced by each service project in your solution.
14+
// To learn more about using this project, see https://aka.ms/dotnet/aspire/service-defaults
1215
public static class Extensions
1316
{
1417
public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
@@ -68,10 +71,6 @@ private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostAppli
6871
builder.Services.AddOpenTelemetry().UseOtlpExporter();
6972
}
7073

71-
// Uncomment the following lines to enable the Prometheus exporter (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
72-
// builder.Services.AddOpenTelemetry()
73-
// .WithMetrics(metrics => metrics.AddPrometheusExporter());
74-
7574
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
7675
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))
7776
//{
@@ -93,9 +92,6 @@ public static IHostApplicationBuilder AddDefaultHealthChecks(this IHostApplicati
9392

9493
public static WebApplication MapDefaultEndpoints(this WebApplication app)
9594
{
96-
// Uncomment the following line to enable the Prometheus endpoint (requires the OpenTelemetry.Exporter.Prometheus.AspNetCore package)
97-
// app.MapPrometheusScrapingEndpoint();
98-
9995
// Adding health checks endpoints to applications in non-development environments has security implications.
10096
// See https://aka.ms/dotnet/aspire/healthchecks for details before enabling these endpoints in non-development environments.
10197
if (app.Environment.IsDevelopment())

0 commit comments

Comments
 (0)