getsentry / getsentry/sentry-dotnet

Add DiagnosticSource listener for HttpClient

Open
#2,140 3 comments 0 reactions 0 assignees View on GitHub
.NET Feature Spans
Dominant language
C#
Stars
770
Forks
248
Avg merge
3d 4h
Merged PRs (30d)
49

Description

### Problem Statement

We currently instrument outbound HTTP requests using our `SentryHttpMessageHander`, which can be added to an `HttpClient` instance manually during construction, or automatically when using `IHttpClientFactory`. If our handler is *not* added to the `HttpClient` instance, then we get no telemetry for outbound HTTP requests.

### Solution Brainstorm

We can improve on this by leveraging the `DiagnosticSource` events that `HttpClient` emits. This can be added to our existing `Sentry.DiagnosticSource` integration. That would allow us to capture basic HTTP request details even if our handler is not added. (Note, AppInsights does this.)

The handler is still preferred, as we get ability to add headers (baggage, trace, etc.) - but it would still be good to get *some* information if the handler is not there.

We should be careful not to create duplicate transactions when both are connected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.