Skip to content

Commit

Permalink
Clarify docstring for metrics (DataDog#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bouchare committed Nov 28, 2019
1 parent b0c0a75 commit 2199e57
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions datadog/api/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ def _rename_metric_type(metric):
def send(cls, metrics=None, attach_host_name=True, **single_metric):
"""
Submit a metric or a list of metrics to the metric API
A metric dictionary should consist of 5 keys: metric, points, host, tags, type (some of which optional),
see below:
:param metric: the name of the time series
:type metric: string
:param metrics: a list of dictionaries, each item being a metric to send
:type metrics: list
:param points: a (timestamp, value) pair or list of (timestamp, value) pairs
:type points: list
Expand All @@ -66,6 +71,12 @@ def send(cls, metrics=None, attach_host_name=True, **single_metric):
:param type: type of the metric
:type type: 'gauge' or 'count' or 'rate' string
>>> api.Metric.send(metric='my.series', points=[(now, 15), (future_10s, 16)])
>>> metrics = [{'metric': 'my.series', 'type': 'gauge', 'points': [(now, 15), (future_10s, 16)]},
{'metric': 'my.series2', 'type': 'gauge', 'points': [(now, 15), (future_10s, 16)]}]
>>> api.Metric.send(metrics=metrics)
:returns: Dictionary representing the API's JSON response
"""
# Set the right endpoint
Expand Down

0 comments on commit 2199e57

Please sign in to comment.