Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Last active December 3, 2022 12:12
Show Gist options
  • Select an option

  • Save wullemsb/70fae615a805dbfadbc51e53ea739101 to your computer and use it in GitHub Desktop.

Select an option

Save wullemsb/70fae615a805dbfadbc51e53ea739101 to your computer and use it in GitHub Desktop.
var api = ResourceBuilder.CreateEmpty()
.AddService("Example-Service")
.AddAttributes(new KeyValuePair<string, object>[]
{
new("development.environment",""),
new("telemetry.sdk.name","dotnet"),
new("telemetry.sdk.version","6.0.0"),
});
builder.Services.AddOpenTelemetryTracing(b =>
{
b.AddHttpClientInstrumentation();
b.AddAspNetCoreInstrumentation();
b.AddSqlClientInstrumentation(options => {
options.SetDbStatementForText = true;
});
b.SetResourceBuilder(api);
b.AddAzureMonitorTraceExporter(options =>
{
options.ConnectionString = Configuration.GetSection("ApplicationInsights").GetValue<string>("ConnectionString");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment