Closed bitsandfoxes closed 1 day ago
@bitsandfoxes added some details to the issue description.
So it turns out this scenario isn't actually possible in .NET:
❌ If the request is to a relative URL (e.g., "GET /data.json"), the server.address span data value should be set to the server address (e.g., "my.service.io").
The only way to use Relative URLs with HttpClient is like this:
using var client = new HttpClient(sentryHandler);
client.BaseAddress = new Uri("http://localhost");
var uri = new Uri("/hello", UriKind.Relative);
await client.GetAsync(uri);
The call to await client.GetAsync(uri)
will throw an exception if you're using a Uri
with UriKind.Relative
and you haven't set the HttpClient.BaseAddress
. On the other hand, if you provide the base address, this gets combined with the relative url to create an absolute Uri.
No matter which way you do it then, by the time we see the Uri in the SentryMessageHandler
, it will be an absolute URI.
I've opted to always set the server.address
span data, which I think is what's happening when the spans are instrumented with OpenTelemetry.
https://docs.sentry.io/product/performance/requests/#span-eligibility
Review
SentryHttpMessageHandler / SentryGraphQLHttpMessageHandler
✅ The http.response.status_code contains the HTTP response status code (e.g., "200").
https://github.com/getsentry/sentry-dotnet/blob/bf4e0b3db4df28447d055cb569093c4307e85cf7/src/Sentry/SentryGraphQLHttpMessageHandler.cs#L57
OpenTelemetry instrumentation
http.client
Microsoft.AspNetCore.Hosting.HttpRequestIn