awslabs / awslabs/aws-embedded-metrics-python
Better support for non-async scenarios
Open
enhancement
- Dominant language
- Python
- Stars
- 231
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
If you are using this within a `ThreadPoolExecutor` you may get the following error:
```sh
RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
```
A workaround for this is to use [`asyncio.run`](https://docs.python.org/3/library/asyncio-task.html#asyncio.run) instead. However, this has some overhead and it would be better if we provided a synchronous mechanism. `@metric_scope` can check whether or not an event loop exists, and if not, it can fall back to using a synchronous logger implementation.
This will likely be superseded by #21
Contributor guide
Assessment
This issue has not been assessed yet.