diff --git a/Program.cs b/Program.cs
index a9c6ded..3dcd30d 100644
--- a/Program.cs
+++ b/Program.cs
@@ -8,6 +8,7 @@
using OpenTelemetry.Instrumentation.AspNetCore;
using tour_of_heroes_api.Interfaces;
using tour_of_heroes_api.Repositories;
+using Azure.Monitor.OpenTelemetry.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
@@ -24,7 +25,7 @@
/********************************** Application Insights ****************************************/
/************************************************************************************************/
-builder.Services.AddApplicationInsightsTelemetry(); //You need ApplicationInsights.ConnectionString in your appsettings.json
+// builder.Services.AddApplicationInsightsTelemetry(); //You need ApplicationInsights.ConnectionString in your appsettings.json
/************************************************************************************************
********************************** Open Telemetry configuration *********************************
@@ -42,7 +43,7 @@
resourceBuilder.AddService(serviceName);
options.SetResourceBuilder(resourceBuilder);
- // options.AddConsoleExporter();
+ options.AddConsoleExporter();
options.AddOtlpExporter(); //This will, by default, send traces using gRPC to http://localhost:4317
});
@@ -50,7 +51,7 @@
builder.Services.AddHttpLogging(o => o.LoggingFields = HttpLoggingFields.All);
builder.Services.AddOpenTelemetry()
-// .UseAzureMonitor() //https://learn.microsoft.com/es-es/azure/azure-monitor/app/opentelemetry-configuration?tabs=aspnetcore
+.UseAzureMonitor() //https://learn.microsoft.com/es-es/azure/azure-monitor/app/opentelemetry-configuration?tabs=aspnetcore
.ConfigureResource(resource => resource.AddService(serviceName))
.WithTracing(tracing =>
{
@@ -61,7 +62,7 @@
tracing.AddOtlpExporter();
- // tracing.AddConsoleExporter();
+ tracing.AddConsoleExporter();
})
.WithMetrics(metrics =>
diff --git a/appsettings.json b/appsettings.json
index da13db6..ee06d4e 100644
--- a/appsettings.json
+++ b/appsettings.json
@@ -13,5 +13,8 @@
"ApplicationInsights": {
"ConnectionString": "InstrumentationKey=3faddc52-30e5-46dc-801f-c2a46c197ade;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/"
},
+ "AzureMonitor": {
+ "ConnectionString": "InstrumentationKey=b896b53e-acd7-4da6-9993-1303482cbbce;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/"
+ },
"AllowedHosts": "*"
}
diff --git a/tour-of-heroes-api.csproj b/tour-of-heroes-api.csproj
index 8a638fe..8625f61 100644
--- a/tour-of-heroes-api.csproj
+++ b/tour-of-heroes-api.csproj
@@ -33,7 +33,7 @@
-
+