awslabs / awslabs/aws-embedded-metrics-python

3.3.0 broken - switching from asyncio.get_event_loop() to asyncio.run() causing major issues

Open
#124 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
231
Forks
44
PR merge metrics
No merged PRs in 30d

Description

In version 3.2.0, calls to get the running event loop were executed with `asyncio.get_event_loop` / `run_until_complete`

In version 3.3.0 `asyncio.run()` has been used instead. This closes the running event loop after the code is executed.

When using this in lambda code which needs to run `asyncio.get_event_loop` it causes subsequent executions to fail

The failure errors:

```
ersions/3.11.9/lib/python3.11/asyncio/events.py", line 683, in get_event_loop
raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'MainThread'.
```

The changed code is in `__init__.py` in the `metric_scope` decorator.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.