Skip to main content

usage_hourly_attribution

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

Overview

Nameusage_hourly_attribution
TypeResource
Iddatadog.organization.usage_hourly_attribution

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
public_idstringThe organization public ID.
org_namestringThe name of the organization.
hourstring (date-time)The hour for the usage.
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 of <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.
total_usage_sumnumber (double)Total product usage for the given tags within the hour.
updated_atstringShows the most recent hour in the current month for all organizations where usages are calculated.
usage_typestringSupported products for hourly usage attribution requests. Usage types are in the format <usage_type>_usage. To obtain the complete list of valid usage types, make a request to the [Get usage attribution types API](https:​//docs.datadoghq.com/api/latest/usage-metering/#get-usage-attribution-types). (api_usage, apm_fargate_usage, apm_host_usage, apm_usm_usage, appsec_fargate_usage, appsec_usage, asm_serverless_traced_invocations_usage, asm_serverless_traced_invocations_percentage, bits_ai_investigations_usage, browser_usage, ci_code_coverage_committers_percentage, ci_code_coverage_committers_usage, ci_pipeline_indexed_spans_usage, ci_test_indexed_spans_usage, ci_visibility_itr_usage, cloud_siem_usage, code_security_host_usage, container_excl_agent_usage, container_usage, cspm_containers_usage, cspm_hosts_usage, custom_event_usage, custom_ingested_timeseries_usage, custom_timeseries_usage, cws_containers_usage, cws_fargate_task_usage, cws_hosts_usage, data_jobs_monitoring_usage, data_stream_monitoring_usage, dbm_hosts_usage, dbm_queries_usage, error_tracking_usage, error_tracking_percentage, estimated_indexed_spans_usage, estimated_ingested_spans_usage, fargate_usage, flex_logs_starter, flex_stored_logs, functions_usage, incident_management_monthly_active_users_usage, indexed_spans_usage, infra_host_usage, infra_host_basic_usage, ingested_logs_bytes_usage, ingested_spans_bytes_usage, invocations_usage, lambda_traced_invocations_usage, llm_observability_usage, llm_spans_usage, logs_indexed_15day_usage, logs_indexed_180day_usage, logs_indexed_1day_usage, logs_indexed_30day_usage, logs_indexed_360day_usage, logs_indexed_3day_usage, logs_indexed_45day_usage, logs_indexed_60day_usage, logs_indexed_7day_usage, logs_indexed_90day_usage, logs_indexed_custom_retention_usage, mobile_app_testing_usage, ndm_netflow_usage, npm_host_usage, network_device_wireless_usage, obs_pipeline_bytes_usage, obs_pipelines_vcpu_usage, online_archive_usage, product_analytics_session_usage, profiled_container_usage, profiled_fargate_usage, profiled_host_usage, published_app, rum_browser_mobile_sessions_usage, rum_ingested_usage, rum_investigate_usage, rum_replay_sessions_usage, rum_session_replay_add_on_usage, sca_fargate_usage, sds_scanned_bytes_usage, serverless_apps_usage, serverless_apps_apm_usage, siem_12mo_retention_usage, siem_6mo_retention_usage, siem_analyzed_logs_add_on_usage, siem_ingested_bytes_usage, snmp_usage, universal_service_monitoring_usage, vuln_management_hosts_usage, workflow_executions_usage)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_hourly_usage_attributionselectstart_hr, usage_typeend_hr, next_record_id, tag_breakdown_keys, include_descendantsGet hourly 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 := GetHourlyUsageAttribution(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 := GetHourlyUsageAttribution(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
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_hrstring (date-time)Datetime in ISO-8601 format, UTC, precise to hour: &#91;YYYY-MM-DDThh&#93; for usage beginning at this hour.
usage_typestringUsage type to retrieve. Usage types are in the format &lt;usage_type&gt;_usage. Example: infra_host_usage To obtain the complete list of active usage 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).
end_hrstring (date-time)Datetime in ISO-8601 format, UTC, precise to hour: &#91;YYYY-MM-DDThh&#93; for usage ending before this hour.
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.
tag_breakdown_keysstringComma separated list of tags 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 hourly 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 := GetHourlyUsageAttribution(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 := GetHourlyUsageAttribution(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,
hour,
region,
tag_config_source,
tags,
total_usage_sum,
updated_at,
usage_type
FROM datadog.organization.usage_hourly_attribution
WHERE start_hr = '{{ start_hr }}' -- required
AND usage_type = '{{ usage_type }}' -- required
AND end_hr = '{{ end_hr }}'
AND next_record_id = '{{ next_record_id }}'
AND tag_breakdown_keys = '{{ tag_breakdown_keys }}'
AND include_descendants = '{{ include_descendants }}'
;