Skip to content

Commit

Permalink
API-2079 Add StatsD histogram metric type for tracking SMS content le…
Browse files Browse the repository at this point in the history
…ngth. (#182)
  • Loading branch information
mchlwellman authored Nov 21, 2024
1 parent 979cbb6 commit 8cd286d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions notifications_utils/clients/statsd/statsd_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ def gauge(self, stat, count):
if self.active:
self.statsd_client.gauge(self.format_stat_name(stat), count)

def histogram(self, stat, value, rate=1):
"""This is a DataDog specific method, which sends a histogram value to statsd. A statsd packet
is a packet with this format - <metric_name>:<value>|<type>|@<sample_rate>.
For a histogram, the metric type is 'h'.
reference: https://github.com/DataDog/datadogpy/blob/master/datadog/dogstatsd/base.py#L950
"""
if self.active:
self.statsd_client._send_stat(self.format_stat_name(stat), '%s|h' % value, rate)

def timing(self, stat, delta, rate=1):
if self.active:
self.statsd_client.timing(self.format_stat_name(stat), delta, rate)
Expand Down
2 changes: 1 addition & 1 deletion notifications_utils/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.2.3'
__version__ = '2.2.4'

0 comments on commit 8cd286d

Please sign in to comment.