Skip to main content

usage_top_avg_metrics

Creates, updates, deletes, gets or lists a usage_top_avg_metrics resource.

Overview

Nameusage_top_avg_metrics
TypeResource
Iddatadog.organization.usage_top_avg_metrics

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
metric_namestringContains the custom metric name.
avg_metric_hourinteger (int64)Average number of timeseries per hour in which the metric occurs.
max_metric_hourinteger (int64)Maximum number of timeseries per hour in which the metric occurs.
metric_categorystringContains the metric category. (standard, custom)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_usage_top_avg_metricsselectmonth, day, names, limit, next_record_idGet all [custom metrics](https:​//docs.datadoghq.com/developers/metrics/custom_metrics/) by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.
daystring (date-time)Datetime in ISO-8601 format, UTC, precise to day: [YYYY-MM-DD] for usage beginning at this hour. (Either month or day should be specified, but not both)
limitinteger (int32)Maximum number of results to return (between 1 and 5000) - defaults to 500 results if limit not specified.
monthstring (date-time)Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning at this hour. (Either month or day should be specified, but not both)
namesarrayComma-separated list of metric names.
next_record_idstringList following results with a next_record_id provided in the previous query.

SELECT examples

Get all custom metrics by hourly average. Use the month parameter to get a month-to-date data resolution or use the day parameter to get a daily resolution. One of the two is required, and only one of the two is allowed.

SELECT
metric_name,
avg_metric_hour,
max_metric_hour,
metric_category
FROM datadog.organization.usage_top_avg_metrics
WHERE month = '{{ month }}'
AND day = '{{ day }}'
AND names = '{{ names }}'
AND limit = '{{ limit }}'
AND next_record_id = '{{ next_record_id }}'
;