Skip to content

Commit

Permalink
[statsd] Update notes about buffering in statsd
Browse files Browse the repository at this point in the history
Since we are at least for the time being disabling buffering by default, the
docs here are being updated to match the changes applied.
  • Loading branch information
sgnn7 committed Oct 13, 2021
1 parent 3ad759f commit a8a12cd
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,28 +159,8 @@ an instance of :class:`datadog.threadstats.ThreadStats`::

datadog.dogstatsd
=================
:mod:`datadog.dogstatsd` is a Python client for DogStatsd that automatically
buffers submitted metrics and submits them to the server asynchronously or at
maximum sizes for a packet that would prevent fragmentation.

.. note::

To ensure that all the metrics are sent to the server, either use the
context-managed instance of :class:`~datadog.dogstatsd.base.DogStatsd`
or when you are finished with the client perform a manual :code:`flush()`.
Otherwise the buffered data may get de-allocated before being sent.


.. warning::

:class:`~datadog.dogstatsd.base.DogStatsd` instances are not :code:`fork()`-safe
because the automatic buffer flushing occurs in a thread only on the
process that created the :class:`~datadog.dogstatsd.base.DogStatsd`
instance. Because of this, instances of those clients must not be copied
from a parent process to a child process. Instead, the parent process and
each child process must create their own instances of the client or the
buffering must be globally disabled by using the :code:`disable_buffering`
initialization flag.
:mod:`datadog.dogstatsd` is a Python client for DogStatsd that submits metrics
to the Agent.


Usage
Expand All @@ -192,7 +172,6 @@ Usage
client = DogStatsd()
client.increment("home.page.hits")
client.flush()


.. autoclass:: datadog.dogstatsd.base.DogStatsd
Expand All @@ -209,15 +188,6 @@ Usage
>>> initialize(statsd_host="localhost", statsd_port=8125)
>>> statsd.increment("home.page.hits")

.. warning::

Global :class:`~datadog.dogstatsd.base.DogStatsd` is not :code:`fork()`-safe
because the automatic buffer flushing occurs in a thread only on the
process that created the :class:`~datadog.dogstatsd.base.DogStatsd`
instance. Because of this, the parent process and each child process must
create their own instances of the client or the buffering must be globally
disabled by using the :code:`disable_buffering` initialization flag.


Get in Touch
============
Expand Down

0 comments on commit a8a12cd

Please sign in to comment.