monotonic_count()
This function is used to track a raw COUNT metric that always increases. The Datadog Agent calculates the delta between each submission. Samples that have a lower value than the previous sample are ignored. Lower values usually indicate the underlying raw COUNT metric has been reset. The function can be called multiple times during a check’s execution.
For example, submitting samples 2, 3, 6, 7 sends a value of 5 (7-2) during the first check execution. Submitting the samples 10, 11 on the same monotonic_count
sends a value of 4 (11-7) during the second check execution.
Note: Metrics submitted with this function are stored with a COUNT
metric type in Datadog. Each value in the stored timeseries is a delta of the metric’s value between samples (not time-normalized).
Function template:
self.monotonic_count(name, value, tags=None, hostname=None, device_name=None)
Parameter | Type | Required | Default Value | Description |
---|
name | String | Yes | - | The name of the metric. |
value | Float | Yes | - | The value for the metric. |
tags | List of strings | No | - | A list of tags to associate with this metric. |
hostname | String | No | Current host | A hostname to associate with this metric. |
device_name | String | No | - | Deprecated. Adds a tag in the form device:<DEVICE_NAME> to the tags list instead. |
count()
This function submits the number of events that occurred during the check interval. It can be called multiple times during a check’s execution, each sample being added to the value that is sent.
Note: Metrics submitted with this function are stored with a COUNT
metric type in Datadog.
Function template:
self.count(name, value, tags=None, hostname=None, device_name=None)
Parameter | Type | Required | Default Value | Description |
---|
name | String | Yes | - | The name of the metric. |
value | Float | Yes | - | The value for the metric. |
tags | List of strings | No | - | A list of tags to associate with this metric. |
hostname | String | No | current host | A hostname to associate with this metric. |
device_name | String | No | - | Deprecated. Adds a tag in the form device:<DEVICE_NAME> to the tags list instead. |
gauge()
This function submits the value of a metric at a given timestamp. If called multiple times during a check’s execution for a metric only the last sample is used.
Note: Metrics submitted with this function are stored with a GAUGE
metric type in Datadog.
Function template:
self.gauge(name, value, tags=None, hostname=None, device_name=None)
Parameter | Type | Required | Default Value | Description |
---|
name | String | Yes | - | The name of the metric. |
value | Float | Yes | - | The value for the metric. |
tags | List of strings | No | - | A list of tags to associate with this metric. |
hostname | String | No | current host | A hostname to associate with this metric. |
device_name | String | No | - | Deprecated. Adds a tag in the form device:<DEVICE_NAME> to the tags list instead. |
rate()
This function submits the sampled raw value of your RATE metric. The Datadog Agent calculates the delta of that metric’s value between two submission, and divides it by the submission interval to get the rate. This function should only be called once during a check, otherwise it throws away any value that is less than a previously submitted value.
Note: Metrics submitted with this function are stored as a GAUGE
metric type in Datadog. Each value in the stored timeseries is a time-normalized delta of the metric’s value between samples.
Function template:
self.rate(name, value, tags=None, hostname=None, device_name=None)
Parameter | Type | Required | Default Value | Description |
---|
name | String | Yes | - | The name of the metric. |
value | Float | Yes | - | The value for the metric. |
tags | List of strings | No | - | A list of tags to associate with this metric. |
hostname | String | No | current host | A hostname to associate with this metric. |
device_name | String | No | - | Deprecated. Adds a tag in the form device:<DEVICE_NAME> to the tags list instead. |
histogram()
This function submits the sample of a histogram metric that occurred during the check interval. It can be called multiple times during a check’s execution. Each sample is added to the statistical distribution of the set of values for this metric.
Note: All metric aggregation produced are stored as a GAUGE
metric type in Datadog, except the <METRIC_NAME>.count
that is stored as a RATE
metric type in Datadog.
Function template:
self.histogram(name, value, tags=None, hostname=None, device_name=None)
Parameter | Type | Required | Default Value | Description |
---|
name | String | Yes | - | The name of the metric. |
value | Float | Yes | - | The value for the metric. |
tags | List of strings | No | - | A list of tags to associate with this metric. |
hostname | String | No | current host | A hostname to associate with this metric. |
device_name | String | No | - | Deprecated. Adds a tag in the form device:<DEVICE_NAME> to the tags list instead. |