getsentry / getsentry/sentry-python

Don't hold references to objects in telemetry pipeline

未关闭
#5,582 1 条评论 0 个 reaction 已指派 1 人 已被 @sl0thentr0py 认领 在 GitHub 查看
Improvement Python Quality Improvement Span First
主要语言
Python
星标
2.2k
派生
669
平均合并
1 天 1 小时
30 天内合并 PR
213

描述

## Problem

A recurring problem in SDKs is that we hold references to userland objects throughout the event pipeline (scope apply, scrubbing) and sometimes that causes

* data corruption (modify user state)
* race conditions in concurrent flows

There is no real need for us to risk holding references since all we need is to collect data reliably and without locks and blocking user flow.

Some examples of this problem:

* django user lazy object instantiation: [https://github.com/getsentry/sentry-python/issues/5274]()
* go panic: [https://github.com/getsentry/sentry-go/pull/1214]()
* python scrubber modifying user objects: [https://github.com/getsentry/sentry-python/pull/3409]()

## Decision

* eventually once everything is on attributes API (including errors), we will make sure `set_attribute` doesn't hold direct references to userland state and reduce surface area of these races/data corruptions
* this can be through a lazy delegation wrapper object as in my [gist]()
* or just pre serialization in `set_attribute` itself


This is a placeholder task to decide and investigate the references that the span first pipeline holds and try to clean that up.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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