-
-
Notifications
You must be signed in to change notification settings - Fork 226
Description
Problem Statement
Inspired by the discussion here -
Thanks to Coby from support for pointing me to this discussion.
We attribute special meaning to some TagObjects based on the Key in the KVP. For example, we know the URL is important in ASP.NET Core apps:
var url = attributes.UrlFullAttribute(); The key is really the only thing that provide some hint... but we can't use this for custom tags that you've defined.
If you wanted to make some specific TagObjects searchable, you could potentially write some custom logic in the SetBeforeSendTransaction callback to copy these across.
Originally posted by @jamescrosswell in #4043
This got me wondering if there could be the same special treatment for http.response.status_code ?
This is the only OpenTelemetry attribute brought through by default with .AddAspNetCoreInstrumentation() that I cannot find in a more visible space on the traces page and would be a very welcome addition.
Furthermore, as per the above discussion I did explore using SetBeforeSendTransaction and SentrySdk which worked as expected, however having the response code extraction built in by default might be a welcome feature for the community?
o.SetBeforeSendTransaction((transaction, hint) =>
{
var act = Activity.Current;
var statusCode = act?.TagObjects.FirstOrDefault(x => x.Key == "http.response.status_code");
if (statusCode is not null && statusCode.HasValue)
transaction.SetTag("http.response.status_code", statusCode.Value.ToString());
return transaction;
});
SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("ResponseStatusCode", context.Response.StatusCode.ToString());
});
Solution Brainstorm
No response
Metadata
Metadata
Assignees
Labels
Projects
Status
Status

