Skip to main content

usage_monthly_attribution

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

Overview

Nameusage_monthly_attribution
TypeResource
Iddatadog.organization.usage_monthly_attribution

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
public_idstringThe organization public ID.
org_namestringThe name of the organization.
monthstring (date-time)Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM].
regionstringThe region of the Datadog instance that the organization belongs to.
tag_config_sourcestringThe source of the usage attribution tag configuration and the selected tags in the format <source_org_name>:::<selected tag 1>///<selected tag 2>///<selected tag 3>.
tagsobjectTag keys and values. A null value here means that the requested tag breakdown cannot be applied because it does not match the [tags configured for usage attribution](https:​//docs.datadoghq.com/account_management/billing/usage_attribution/#getting-started). In this scenario the API returns the total usage, not broken down by tags.
updated_atstring (date-time)Datetime of the most recent update to the usage values.
valuesobjectFields in Usage Summary by tag(s).

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_monthly_usage_attributionselectstart_month, fieldsend_month, sort_direction, sort_name, tag_breakdown_keys, next_record_id, include_descendantsGet monthly usage attribution. Multi-region data is available starting March 1, 2023.<br /><br />This API endpoint is paginated. To make sure you receive all records, check if the value of next_record_id is<br />set in the response. If it is, make another request and pass next_record_id as a parameter.<br />Pseudo code example:<br /><br />&lt;br /&gt;response := GetMonthlyUsageAttribution(start_month)&lt;br /&gt;cursor := response.metadata.pagination.next_record_id&lt;br /&gt;WHILE cursor != null BEGIN&lt;br /&gt; sleep(5 seconds) # Avoid running into rate limit&lt;br /&gt; response := GetMonthlyUsageAttribution(start_month, next_record_id=cursor)&lt;br /&gt; cursor := response.metadata.pagination.next_record_id&lt;br /&gt;END&lt;br /&gt;

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
fieldsstringComma-separated list of usage types to return, or * for all usage types. Usage types are in the format &lt;usage_type&gt;_usage and &lt;usage_type&gt;_percentage. Example: infra_host_usage,infra_host_percentage To obtain the complete list of usage attribution types that can be used to replace <usage_type> in the field names, make a request to the [Get usage attribution types API](https:​//docs.datadoghq.com/api/latest/usage-metering/#get-usage-attribution-types).
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.
start_monthstring (date-time)Datetime in ISO-8601 format, UTC, precise to month: &#91;YYYY-MM&#93; for usage beginning in this month. Maximum of 15 months ago.
end_monthstring (date-time)Datetime in ISO-8601 format, UTC, precise to month: &#91;YYYY-MM&#93; for usage ending this month.
include_descendantsbooleanInclude child org usage in the response. Defaults to true.
next_record_idstringList following results with a next_record_id provided in the previous query.
sort_directionstringThe direction to sort by: &#91;desc, asc&#93;.
sort_namestringThe field to sort by. Sort fields are in the format &lt;usage_type&gt;_usage. Example: infra_host_usage To obtain the complete list of usage attribution types that can be used to replace <usage_type> in the field names, make a request to the [Get usage attribution types API](https:​//docs.datadoghq.com/api/latest/usage-metering/#get-usage-attribution-types).
tag_breakdown_keysstringComma separated list of tag keys used to group usage. If no value is provided the usage will not be broken down by tags. To see which tags are available, look for the value of tag_config_source in the API response.

SELECT examples

Get monthly usage attribution. Multi-region data is available starting March 1, 2023.<br /><br />This API endpoint is paginated. To make sure you receive all records, check if the value of next_record_id is<br />set in the response. If it is, make another request and pass next_record_id as a parameter.<br />Pseudo code example:<br /><br />&lt;br /&gt;response := GetMonthlyUsageAttribution(start_month)&lt;br /&gt;cursor := response.metadata.pagination.next_record_id&lt;br /&gt;WHILE cursor != null BEGIN&lt;br /&gt; sleep(5 seconds) # Avoid running into rate limit&lt;br /&gt; response := GetMonthlyUsageAttribution(start_month, next_record_id=cursor)&lt;br /&gt; cursor := response.metadata.pagination.next_record_id&lt;br /&gt;END&lt;br /&gt;

SELECT
public_id,
org_name,
month,
region,
tag_config_source,
tags,
updated_at,
values
FROM datadog.organization.usage_monthly_attribution
WHERE start_month = '{{ start_month }}' -- required
AND fields = '{{ fields }}' -- required
AND end_month = '{{ end_month }}'
AND sort_direction = '{{ sort_direction }}'
AND sort_name = '{{ sort_name }}'
AND tag_breakdown_keys = '{{ tag_breakdown_keys }}'
AND next_record_id = '{{ next_record_id }}'
AND include_descendants = '{{ include_descendants }}'
;