diff --git a/Program.cs b/Program.cs index 61ccfc5..a9c6ded 100644 --- a/Program.cs +++ b/Program.cs @@ -20,6 +20,12 @@ }); +/************************************************************************************************/ +/********************************** Application Insights ****************************************/ +/************************************************************************************************/ + +builder.Services.AddApplicationInsightsTelemetry(); //You need ApplicationInsights.ConnectionString in your appsettings.json + /************************************************************************************************ ********************************** Open Telemetry configuration ********************************* *********** https://grafana.com/grafana/dashboards/17706-asp-net-otel-metrics/ ****************** diff --git a/appsettings.json b/appsettings.json index 1a1b505..da13db6 100644 --- a/appsettings.json +++ b/appsettings.json @@ -1,14 +1,17 @@ { - "ConnectionStrings": { - "DefaultConnection": "", - "AzureStorage": "" - }, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft": "Warning", - "Microsoft.Hosting.Lifetime": "Information" - } - }, - "AllowedHosts": "*" -} \ No newline at end of file + "ConnectionStrings": { + "DefaultConnection": "", + "AzureStorage": "" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "ApplicationInsights": { + "ConnectionString": "InstrumentationKey=3faddc52-30e5-46dc-801f-c2a46c197ade;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 1311435..8a638fe 100644 --- a/tour-of-heroes-api.csproj +++ b/tour-of-heroes-api.csproj @@ -38,6 +38,9 @@ + + + \ No newline at end of file