Spans for HTTP requests - `UnityWebRequest` and `HttpMessageHandler`

未关闭
#737 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 3 天内回复

@bitsandfoxes 已经在做这个了。

开始于 2022年5月9日。

评估

这个 Issue 还没有评估数据。

描述

Improvement Traces Unity

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:

  • A PoC that gets a DLL that has new HttpClient(...) and adds the middleware (as done in Sentry defenses) @SimonCropp
  • Find out which Unity hooks can we rely on to get the GameAssembly.dll @bitsandfoxes
  • With the PoC we can discuss next steps such as: Is this a .NET Global Tool? Do we have the code in Sentry.Unity.Editor?

UnityWebRequests (Unity Client)

Example HTTP client usage: https://github.com/getsentry/sentry-unity/blob/7774137c35ce4a3653b934e15ed15f0078a2ee36/src/Sentry.Unity/UnityWebRequestTransport.cs#L75-L81
We need a way to plug Sentry in there. First 'manually' with some C# code. Then automatically, possibly with IL weaving.

  • We need a strategy to get spans/crumbs similar to SentryHttpMessageHandler @bitsandfoxes
  • PoC with IL weaving a DLL using UnityWebRequest and add the new interceptor @SimonCropp
  • With the PoC we can discuss next steps such as: Is this a .NET Global Tool? Do we have the code in Sentry.Unity.Editor?
主要语言
C#
星标
295
派生
63
平均合并
3 天 17 小时
30 天内合并 PR
26

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-unity 的其他 Issue

查看 getsentry/sentry-unity 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。