elastic / elastic/apm-agent-python

Refactor serialization mechanism to be extendable

オープン
#182 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
agent-python
主要言語
Python
スター
431
フォーク
239
平均マージ
5日 10時間
マージ済み PR(30日)
7

説明

At the moment, our serialization code is just a really long `if-elif-elif-...` block: https://github.com/elastic/apm-agent-python/blob/ee45d21ff43be495089a005863b7f6af0707fe34/elasticapm/utils/encoding.py#L85-L138.

This has several drawbacks:
* it's not extendable (we e.g. might want to serialize Django `QuerySet` objects in a sane way that doesn't evaluate the queryset unnecessarily, but only if Django is installed)
* it's brittle
* it's hard to read
* ideally, serialization would also include shortening of values, which is hard to do in its current state

One option could be to have a registry, to which transformers can register themselves, together with a list of supported types for that transformer.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。