From ee4aa9b292512437de01c44c86fc3b4fe37d1b27 Mon Sep 17 00:00:00 2001 From: Bartek Ogryczak Date: Wed, 11 Jan 2017 11:49:59 -0800 Subject: [PATCH] more consistent metrics (#473) * more consistent metrics More consistent metrics, in particular for consumers such as Graphite, CloudWatch etc. you don't want aggregated numbers per second, you want number since previous call. Since we don't want to track all the clients, total since start is the next best thing, because it can be easily calculated by the metrics consumer `count_since_last = pervious_count - current_count` * changing 'queue_depth' to 'messages_pending', also making 'messages' plurar for 'max_age' to keep it consitent --- docs/asgi.rst | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/asgi.rst b/docs/asgi.rst index 95b6595..405ba6e 100644 --- a/docs/asgi.rst +++ b/docs/asgi.rst @@ -367,17 +367,20 @@ A channel layer implementing the ``groups`` extension must also provide: A channel layer implementing the ``statistics`` extension must also provide: -* ``global_statistics()``, a callable that returns a dict with zero - or more of (unicode string keys): +* ``global_statistics()``, a callable that returns statistics across all channels +* ``channel_statistics(channel)``, a callable that returns statistics for specified channel - * ``count``, the current number of messages waiting in all channels +* in both cases statistics are a dict with zero or more of (unicode string keys): -* ``channel_statistics(channel)``, a callable that returns a dict with zero - or more of (unicode string keys): + * ``messages_count``, the number of messages processed since server start + * ``messages_count_per_second``, the number of messages processed in the last second + * ``messages_pending``, the current number of messages waiting + * ``messages_max_age``, how long the oldest message has been waiting, in seconds + * ``channel_full_count``, the number of times `ChannelFull` exception has been risen since server start + * ``channel_full_count_per_second``, the number of times `ChannelFull` exception has been risen in the last second + +* Implementation may provide total counts, counts per seconds or both. - * ``length``, the current number of messages waiting on the channel - * ``age``, how long the oldest message has been waiting, in seconds - * ``per_second``, the number of messages processed in the last second A channel layer implementing the ``flush`` extension must also provide: