ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,188 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am on .net 6 asp.net core. In my web api project, I have the following registration of opentelemetry services.
services.AddOpenTelemetryTracing(providerBuilder =>
{
providerBuilder
.AddSource("DataInsight")
.SetResourceBuilder(ResourceBuilder.CreateDefault()
.AddService("InsightDataService"))
.AddHttpClientInstrumentation()
.AddAspNetCoreInstrumentation(
options =>
{
options.Enrich = Enrich;
options.RecordException = true;
}
)
.AddSqlClientInstrumentation()
.AddConsoleExporter()
.AddOtlpExporter(opt =>
{
opt.Endpoint = new Uri("http://localhost:58459");
});
});
In my controller, I had the following code to create an activity and addTag. However, the tags are not being added to the trace of my output.
using var activity = Startup.ActivitySource.StartActivity("GetReportData");
if (activity.IsAllDataRequested)
{
activity?.SetTag("GetData1", "Success");
activity?.AddTag("GetLinkData", "Success");
}