Skip to content

Commit

Permalink
Support Npg traces
Browse files Browse the repository at this point in the history
  • Loading branch information
agile.zhou committed May 18, 2024
1 parent 0428d6a commit 3ac6e13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
<PackageReference Include="Npgsql.OpenTelemetry" Version="8.0.3" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.1" />
Expand Down
4 changes: 2 additions & 2 deletions src/AgileConfig.Server.Apisite/StartupExtension.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using AgileConfig.Server.Common;
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using System.Net.Http;
using OpenTelemetry.Trace;
using OpenTelemetry.Logs;
using OpenTelemetry.Exporter;
using OpenTelemetry;
using Npgsql;

namespace AgileConfig.Server.Apisite
{
Expand All @@ -31,7 +31,7 @@ public static IOpenTelemetryBuilder AddOtlpTraces(this IOpenTelemetryBuilder bui

builder.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddNpgsql()
.AddOtlpExporter(op =>
{
op.Protocol = Appsettings.OtlpTracesProtocol == "http" ? OtlpExportProtocol.HttpProtobuf : OtlpExportProtocol.Grpc;
Expand Down

0 comments on commit 3ac6e13

Please sign in to comment.