For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ko/api/latest/usage-metering/get-monthly-cost-attribution.md. A documentation index is available at /llms.txt.
Language
Datadog site

월별 Cost Attribution 확인하기

GEThttps://api.datadoghq.com/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.us3.datadoghq.com/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.us5.datadoghq.com/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.datadoghq.eu/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.ap1.datadoghq.com/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.ap2.datadoghq.com/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.uk1.datadoghq.com/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.ddog-gov.com/api/v2/cost_by_tag/monthly_cost_attributionhttps://api.us2.ddog-gov.com/api/v2/cost_by_tag/monthly_cost_attribution

개요

멀티 조직 및 단일 루트 조직 계정 전반에 걸쳐 태그별 월간 Cost Attribution을 가져옵니다. 지정된 월의 Cost Attribution 데이터는 다음 달 19일까지 사용할 수 있습니다. 이 API 엔드포인트는 페이지 지정을 지원합니다. 모든 레코드를 수신하도록 next_record_id 값이 응답에 설정되어 있는지 검사하세요. 해당 값이 설정되어 있다면 다른 요청을 수행하고 next_record_id를 파라미터로 전달하세요. 의사 코드 예시:

response := GetMonthlyCostAttribution(start_month, end_month)
cursor := response.metadata.pagination.next_record_id
WHILE cursor != null BEGIN
  sleep(5 seconds)  # 속도 제한에 걸리지 않도록 방지
  response := GetMonthlyCostAttribution(start_month, end_month, next_record_id=cursor)
  cursor := response.metadata.pagination.next_record_id
END

이 엔드포인트는 상위 수준 조직에서만 액세스할 수 있습니다. 이 엔드포인트는 Government(US1-FED) 사이트에서는 사용할 수 없습니다.

This endpoint requires all of the following permissions:

  • usage_read
  • billing_read

OAuth apps require the usage_read, billing_read authorization scope to access this endpoint.

인수

쿼리 문자열

이름
유형
설명
start_month [required]
string

Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for cost beginning in this month.

end_month
string

Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for cost ending this month.

fields [required]
string

Comma-separated list specifying cost types (e.g., <billing_dimension>_on_demand_cost, <billing_dimension>_committed_cost, <billing_dimension>_total_cost) and the proportions (<billing_dimension>_percentage_in_org, <billing_dimension>_percentage_in_account). Use * to retrieve all fields. Example: infra_host_on_demand_cost,infra_host_percentage_in_account To obtain the complete list of active billing dimensions that can be used to replace <billing_dimension> in the field names, make a request to the Get active billing dimensions API.

sort_direction
enum

The direction to sort by: [desc, asc].

Default: desc
Allowed enum values: desc, asc
sort_name
string

The billing dimension to sort by. Always sorted by total cost. Example: infra_host.

tag_breakdown_keys
string

Comma separated list of tag keys used to group cost. If no value is provided the cost 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.

next_record_id
string

List following results with a next_record_id provided in the previous query.

include_descendants
boolean

Include child org cost in the response. Defaults to true.

Default: true

응답

OK

Response containing the monthly cost attribution by tag(s).

항목
유형
설명
data
[object]

Response containing cost attribution.

meta
object

The object containing document metadata.

코드 예시

월별 Cost Attribution 확인하기
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"
export fields="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/cost_by_tag/monthly_cost_attribution?start_month=${start_month}&fields=${fields}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"