Skip to content

Commit

Permalink
Update OpenTelemetry configuration and SQL Server connection string
Browse files Browse the repository at this point in the history
  • Loading branch information
0GiS0 committed Feb 8, 2024
1 parent 4c7c5bc commit 4519fcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
6 changes: 4 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
*********** https://grafana.com/grafana/dashboards/17706-asp-net-otel-metrics/ ******************
************************************************************************************************/

string serviceName = builder.Configuration["OTEL_SERVICE_NAME"] ?? "tour_of_heroes_api";

builder.Logging.AddOpenTelemetry(options =>
{
options.IncludeScopes = true;
options.IncludeFormattedMessage = true;

var resourceBuilder = ResourceBuilder.CreateDefault();
resourceBuilder.AddService(builder.Configuration["OTEL_SERVICE_NAME"]);
resourceBuilder.AddService(serviceName);
options.SetResourceBuilder(resourceBuilder);

// options.AddConsoleExporter();
Expand All @@ -42,7 +44,7 @@

builder.Services.AddOpenTelemetry()
// .UseAzureMonitor() //https://learn.microsoft.com/es-es/azure/azure-monitor/app/opentelemetry-configuration?tabs=aspnetcore
.ConfigureResource(resource => resource.AddService(builder.Configuration["OTEL_SERVICE_NAME"]))
.ConfigureResource(resource => resource.AddService(serviceName))
.WithTracing(tracing =>
{
tracing.AddAspNetCoreInstrumentation();
Expand Down
11 changes: 2 additions & 9 deletions appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "<SQL SERVER CONNECTION STRING>"
"DefaultConnection": "Server=localhost,1433;Initial Catalog=heroes;Persist Security Info=False;User ID=sa;Password=Password1!;Encrypt=False"
},
"Logging": {
"LogLevel": {
Expand All @@ -13,12 +13,5 @@
"Microsoft.EntityFrameworkCore": "Warning"
}
},
"AllowedHosts": "*",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://*:5010"
}
}
}
"AllowedHosts": "*"
}

0 comments on commit 4519fcd

Please sign in to comment.