Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dotnet.mdx #9108

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions platform-includes/performance/opentelemetry-setup/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ To start tracing in a console application, you'll need to add Sentry to the trac

```csharp
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.AddSource(serviceName)
.ConfigureResource(resource =>
resource.AddService(
serviceName: serviceName,
serviceVersion: serviceVersion))
.AddSource(serviceName) // <-- The name of an activity sources you care about
.AddSentry() // <-- Configure OpenTelemetry to send traces to Sentry
.Build();
```
Expand All @@ -36,10 +32,8 @@ var builder = WebApplication.CreateBuilder(args);
builder.Services.AddOpenTelemetry()
.WithTracing(tracerProviderBuilder =>
tracerProviderBuilder
.AddSource(Telemetry.ActivitySource.Name)
.ConfigureResource(resource => resource.AddService(Telemetry.ServiceName))
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddAspNetCoreInstrumentation() // <-- Adds ASP.NET Core telemetry sources
.AddHttpClientInstrumentation() // <-- Adds HttpClient telemetry sources
.AddSentry() // <-- Configure OpenTelemetry to send trace information to Sentry
);
```
Expand All @@ -61,13 +55,7 @@ To start tracing in an ASP.NET application, you'll need to create a tracer provi

```csharp
var builder = Sdk.CreateTracerProviderBuilder()
.AddAspNetInstrumentation()
.AddSource(Telemetry.ServiceName)
.SetResourceBuilder(
ResourceBuilder.CreateDefault()
.AddService(serviceName: Telemetry.ServiceName, serviceVersion: "1.0.0")
);

.AddAspNetInstrumentation(); // <-- Adds ASP.NET telemetry sources
```

Next, initialize Sentry and opt into the use of OpenTelemetry. Provide the SDK with the builder for OpenTelemetry's tracer provider to allow sending spans to Sentry.
Expand Down
Loading