Skip to content

Commit

Permalink
Fix OpenTelemetry Trace Recording (#75)
Browse files Browse the repository at this point in the history
* comment

* *

* formating

* removed explicit endpoint setting in opentelemetry

* Update TodoApi/Extensions/OpenTelemetryExtensions.cs

Co-authored-by: David Fowler <[email protected]>
Signed-off-by: daniilzaonegin <[email protected]>

* Update TodoApi/Extensions/OpenTelemetryExtensions.cs

Signed-off-by: David Fowler <[email protected]>

---------

Signed-off-by: daniilzaonegin <[email protected]>
Signed-off-by: David Fowler <[email protected]>
Co-authored-by: David Fowler <[email protected]>
  • Loading branch information
daniilzaonegin and davidfowl committed Jun 8, 2023
1 parent b1103e2 commit 0acf81c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion TodoApi/Extensions/OpenTelemetryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,18 @@ public static WebApplicationBuilder AddOpenTelemetry(this WebApplicationBuilder
})
.WithTracing(tracing =>
{
// We need to use AlwaysSampler to record spans
// from Todo.Web.Server, because there it no OpenTelemetry
// instrumentation
tracing.SetResourceBuilder(resourceBuilder)
.SetSampler(new AlwaysOnSampler())
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddEntityFrameworkCoreInstrumentation();
if (!string.IsNullOrWhiteSpace(otlpEndpoint))
{
tracing.AddOtlpExporter();
}
})
.StartWithHost();
Expand Down

0 comments on commit 0acf81c

Please sign in to comment.