elastic / elastic/apm-agent-python
[Agent-Python] AsyncIO + ThreadPool Span Tracing
- Lenguaje dominante
- Python
- Estrellas
- 431
- Forks
- 239
- Merge medio
- 5 d 10 h
- PR fusionados (30 d)
- 7
Descripción
**Describe the bug**:
Current setup: A flask endpoint that summons a sync function running asyncio code block and a threadpool executor that dovetails on the results of the asyncio code block
Looking for a way to monitor the function execution via the instrumentation of code running in those several threads.
- Both `@elasticapm.capture_span()` and `async_capture_span` were not able to trace the function execution as desired.
- Implemented the workaround suggested in #499 but did not work in my case.
Any advice/directions on this would be of great help. TIA.
**Environment (please complete the following information)**
- OS:
System Version: **macOS 10.14.6 (18G6020)**
Kernel Version: **Darwin 18.7.0**
- Python version: **3.8.0**
- Framework and version: **Flask 1.1.4**
- APM Server version: **7.6.2**
- Agent version: **6.4.0**
**Additional context**
Attaching a blueprint of the function block that gets triggered on hitting the flask request endpoint.

Essentially a bulk indexer job that posts to ES /_bulk endpoint post various data pre-processing.
On the APM front, only the request call/response duration is being captured by the agent:

Any advice/directions on this would be of great help. TIA.
Guía de contribución
Línea de trabajo
Comienza reproduciendo el flujo de la función síncrona, el bloque de asyncio y ThreadPoolExecutor del endpoint de Flask con las versiones indicadas de Python, Flask y agent. Compara capture_span y async_capture_span con la solución alternativa de #499 y verifica si los spans cubren el trabajo asíncrono y en hilos, en lugar de cubrir únicamente la solicitud; el issue necesita un enfoque de tracing confirmado antes de que la implementación pueda considerarse terminada.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- flask, python
- Área
- backend, observability-sre
- Tipo de issue
- Error
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 28/100