What is the difference between AddHttpClientInstrumentation and AddAspNetCoreInstrumentation

andrew choi 1 Reputation point
2022-09-16T22:57:23.02+00:00

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?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,156 questions
{count} votes