sentry-dotnet icon indicating copy to clipboard operation
sentry-dotnet copied to clipboard

Add Distributed Tracing to the ASP.NET Core Documentation

Open jamescrosswell opened this issue 1 year ago • 5 comments

The Laravel docs have a section on Distributed Tracing that explains what people need to do in the front end of their app to pass a propagation id through to the back end and trace between processes.

We should add something similar explaining what to do in a Razor template or something to the ASP.NET Core docs.

Originally raised on Discord.

jamescrosswell avatar Dec 13 '23 21:12 jamescrosswell

Added this one more generically on the docs repo (as it's not just about .NET): https://github.com/getsentry/sentry-docs/issues/8715

bruno-garcia avatar Dec 13 '23 21:12 bruno-garcia

I can't believe I just came across this after two days of trying to figure out why this isn't working in asp.net core.

petefox avatar Jul 07 '24 05:07 petefox

@bruno-garcia just checking what we're supposed to be doing here:

  • The Laravel docs appear to describe a PHP helper function that will insert a couple of meta tags. Those meta tags would get used if the front end was instrumented using one of Sentry's javascript integrations (e.g. Browser Tracing)

In ASP.NET, there are quite a few different options for how you build your UI. There are Razor Pages in ASP.NET MVC, there are all the different modes for Blazor (Server/Client/Hybrid) and then there are SPAs.

It looks like the technique described in the Laravel docs would mostly be relevant if you had a SPA hooked up to your ASP.NET application right? I think that's the only scenario in which people are likely to be instrumenting the front end using Sentry's javascript integration.

I don't think we have any helper functions (yet) in .NET to generate those meta tags. We could create some and then document how these could be used in conjunction with a SPA application that was instrumented using Sentry. Is that what we're talking about here?

jamescrosswell avatar Jul 31 '24 02:07 jamescrosswell

A related question: what's the best way for users of the .NET SDK to include instrumentation for their front end when they're not using a SPA? Ideally a transaction would start when a request was made from the front end to the back end right? That might be done using AJAX, SignalR (or something else for WASM maybe)? Do we have a mechanism to automatically instrument those requests starting with the request from the front end? It looks like we only instrument the middleware at the moment.

jamescrosswell avatar Jul 31 '24 02:07 jamescrosswell