We can always use both of them.
-
AddAspNetCoreInstrumentation
is instrumenting inbound HTTP connections. -
AddHttpClientInstrumentation
is instrumenting outbound HTTP connections.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
In Asp.net core, to provide auto trace instrumentation, we can do the followings.
services.AddOpenTelemetryTracing(providerBuilder =>
{
providerBuilder
.AddSource("TemenosInsightDataService")
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("InsightDataService"))
.AddHttpClientInstrumentation()
.AddAspNetCoreInstrumentation()
.AddSqlClientInstrumentation()
.AddConsoleExporter()
});
After reading the limited documentation on github, I still quite understand the purpose and difference between them. It seems to me their main purpose is to allow Enrich function to be called to add additional information to activity. I can do that on both AddHttpClientInstrumentation() and AddAspNetCoreInstrumentation() which will both add to trace context. How to choose which one to use?
We can always use both of them.
AddAspNetCoreInstrumentation
is instrumenting inbound HTTP connections.AddHttpClientInstrumentation
is instrumenting outbound HTTP connections.