Skip to content

Commit

Permalink
chore: Cleanup metric explosion (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkromkamp authored Aug 4, 2024
1 parent 7fd8b06 commit da309de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/Rescheduler.Api/Rescheduler.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.EventCounters" Version="1.5.1-alpha.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.6" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
Expand Down
15 changes: 8 additions & 7 deletions src/Rescheduler.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,21 @@ public void ConfigureServices(IServiceCollection services)
services.AddOpenTelemetry()
.ConfigureResource(resource =>
{
resource.Clear();
// resource.Clear();

Check warning on line 52 in src/Rescheduler.Api/Startup.cs

View workflow job for this annotation

GitHub Actions / sonar

Remove this commented out code. (https://rules.sonarsource.com/csharp/RSPEC-125)
resource.AddService("Rescheduler");
resource.AddEnvironmentVariableDetector();
})
.WithMetrics(metrics => metrics
.AddAspNetCoreInstrumentation()
.AddRuntimeInstrumentation()
.AddProcessInstrumentation()
.AddMeter("Microsoft.AspNetCore.Hosting")
.AddMeter("Microsoft.AspNetCore.Routing")
.AddMeter("Rescheduler")
.AddEventCountersInstrumentation(ec =>
{
ec.AddEventSources("Microsoft.EntityFrameworkCore");
ec.AddEventSources("Microsoft.Data.SqlClient.EventSource");
})
.AddView("messages.publish.duration",
new ExplicitBucketHistogramConfiguration()
{
Boundaries = [0.005, 0.01, 0.3, 0.5, 1, 2, 5, 30]
})
.AddOtlpExporter(otlp =>
{
otlp.Protocol = protocol;
Expand Down

0 comments on commit da309de

Please sign in to comment.