DataDog / datadogpy

The Datadog Python library
https://datadoghq.com/
Other
614 stars 304 forks source link

Is DogStatsD client async-safe? #564

Open maxmalysh opened 4 years ago

maxmalysh commented 4 years ago

Hi,

Is DogStatsD safe to use with asyncio? I'm particularly interested if it uses any thread-blocking calls. It would be nice to have this mentioned in readme / docs (in addition to the thread safety notice).

Thanks

Rizato commented 4 years ago

It looks like ThreadStats is not asyncio safe.

It calls a MetricsAggregator add_point which uses a threading.RLock at https://github.com/DataDog/datadogpy/blob/master/datadog/threadstats/metrics.py#L186

github-actions[bot] commented 4 years ago

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

meshy commented 3 years ago

The link to threading.RLock pointed to a line on the master branch which has moved. Here's a more stable link: https://github.com/DataDog/datadogpy/blob/0f4bf72b398224a32b702c04ac4adecb86b23ec6/datadog/threadstats/metrics.py#L177