-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Spans for HTTP requests - UnityWebRequest
and HttpMessageHandler
#737
Comments
i took a look into implementing the custom The IL replacement plan is to detect usage of existing handlers and wrap them in our own. but that wrapping does not seem possible. The reason is that the the I considered re-implementing each of the we cant inherit and override Unitys default handlers since they are all sealed |
Our goal is to wrap that HTTP request into a span/crumb creation logic, like we do here: https://github.com/getsentry/sentry-dotnet/blob/36ccacf43b8aeedc493585ea57bc05880b285773/src/Sentry/SentryHttpMessageHandler.cs#L52-L96 Like if the HTTP request code would be here: https://github.com/getsentry/sentry-dotnet/blob/36ccacf43b8aeedc493585ea57bc05880b285773/src/Sentry/SentryHttpMessageHandler.cs#L76 So during IL weaving we would find:
Then move the two parameters up to an assignment, so we can easily copy its values, add span:
|
Came across this commit: be0388e from this branch |
UnityWebRequest
and HttpMessageHandler
When a user makes an HTTP request to their backend, we want to measure how long that took. And propagate the trace id so we can have end to end tracing.
This can be split in:
HttpMessageHandler
The .NET approach. Used in Sentry Defenses:
https://github.com/getsentry/sentry-defenses/blob/2989949f857f1cccb46814ce0a05d50f603f9222/game/Assets/Scripts/Manager/BugSpawner.cs#L37
We need to find a way add the handler automatically. At least on the one assembly created by Unity when compiling the scripts.
Steps:
new HttpClient(...)
and adds the middleware (as done in Sentry defenses) @SimonCroppGameAssembly.dll
@bitsandfoxesSentry.Unity.Editor?
UnityWebRequests (Unity Client)
Example HTTP client usage:
sentry-unity/src/Sentry.Unity/UnityWebRequestTransport.cs
Lines 75 to 81 in 7774137
We need a way to plug Sentry in there. First 'manually' with some C# code. Then automatically, possibly with IL weaving.
UnityWebRequest
and add the new interceptor @SimonCroppSentry.Unity.Editor?
The text was updated successfully, but these errors were encountered: