elastic / elastic/apm-agent-python

Refactor serialization mechanism to be extendable

Abierto
#182 2 comentarios 1 reacción 0 asignados Ver en GitHub
agent-python
Lenguaje dominante
Python
Estrellas
431
Forks
239
Merge medio
5 d 10 h
PR fusionados (30 d)
7

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.