# Get hourly logs usage by retention returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_logs_by_retention((Time.now+-5*86400),opts)
Contains the total number of infrastructure hosts reporting
during a given hour that were running the Datadog Agent.
alibaba_host_count
int64
Contains the total number of hosts that reported through Alibaba integration
(and were NOT running the Datadog Agent).
apm_azure_app_service_host_count
int64
Contains the total number of Azure App Services hosts using APM.
apm_host_count
int64
Shows the total number of hosts using APM during the hour,
these are counted as billable (except during trial periods).
aws_host_count
int64
Contains the total number of hosts that reported through the AWS integration
(and were NOT running the Datadog Agent).
azure_host_count
int64
Contains the total number of hosts that reported through Azure integration
(and were NOT running the Datadog Agent).
container_count
int64
Shows the total number of containers reported by the Docker integration during the hour.
gcp_host_count
int64
Contains the total number of hosts that reported through the Google Cloud integration
(and were NOT running the Datadog Agent).
heroku_host_count
int64
Contains the total number of Heroku dynos reported by the Datadog Agent.
host_count
int64
Contains the total number of billable infrastructure hosts reporting during a given hour.
This is the sum of agent_host_count, aws_host_count, and gcp_host_count.
hour
date-time
The hour for the usage.
infra_azure_app_service
int64
Contains the total number of hosts that reported through the Azure App Services integration
(and were NOT running the Datadog Agent).
opentelemetry_host_count
int64
Contains the total number of hosts reported by Datadog exporter for the OpenTelemetry Collector.
org_name
string
The organization name.
public_id
string
The organization public ID.
vsphere_host_count
int64
Contains the total number of hosts that reported through vSphere integration
(and were NOT running the Datadog Agent).
"""
Get hourly usage for hosts and containers returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_hosts(start_hr=(datetime.now()+relativedelta(days=-5)).isoformat(timespec="seconds"),end_hr=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get hourly usage for hosts and containers returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_hosts((Time.now+-5*86400),opts)
/**
* Get hourly usage for hosts and containers returns "OK" response
*/import{v1}from"@datadog/datadog-api-client";constconfiguration=v1.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageHostsRequest={startHr: newDate(newDate().getTime()/1000+-5*86400),endHr: newDate(newDate().getTime()/1000+-3*86400),};apiInstance.getUsageHosts(params).then((data: v1.UsageHostsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Get hourly usage for hosts and containers returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageHosts(ctx,time.Now().AddDate(0,0,-5),*datadog.NewGetUsageHostsOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageHosts`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageHosts`:\n%s\n",responseContent)}
// Get hourly usage for hosts and containers returns "OK" response
importcom.datadog.api.v1.client.ApiClient;importcom.datadog.api.v1.client.ApiException;importcom.datadog.api.v1.client.Configuration;importcom.datadog.api.v1.client.api.UsageMeteringApi;importcom.datadog.api.v1.client.api.UsageMeteringApi.GetUsageHostsOptionalParameters;importcom.datadog.api.v1.client.model.UsageHostsResponse;importjava.time.OffsetDateTime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{UsageHostsResponseresult=apiInstance.getUsageHosts(OffsetDateTime.now().plusDays(-5),newGetUsageHostsOptionalParameters().endHr(OffsetDateTime.now().plusDays(-3)));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getUsageHosts");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Get hourly usage for Logs returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_logs(start_hr=(datetime.now()+relativedelta(days=-5)).isoformat(timespec="seconds"),end_hr=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get hourly usage for Logs returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_logs((Time.now+-5*86400),opts)
// Get hourly usage for Logs returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageLogs(ctx,time.Now().AddDate(0,0,-5),*datadog.NewGetUsageLogsOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageLogs`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageLogs`:\n%s\n",responseContent)}
"""
Get hourly usage for Logs by Index returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_logs_by_index(start_hr=(datetime.now()+relativedelta(days=-5)).isoformat(timespec="seconds"),end_hr=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get hourly usage for Logs by Index returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_logs_by_index((Time.now+-5*86400),opts)
/**
* Get hourly usage for Logs by Index returns "OK" response
*/import{v1}from"@datadog/datadog-api-client";constconfiguration=v1.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageLogsByIndexRequest={startHr: newDate(newDate().getTime()/1000+-5*86400),endHr: newDate(newDate().getTime()/1000+-3*86400),};apiInstance.getUsageLogsByIndex(params).then((data: v1.UsageLogsByIndexResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Get hourly usage for Logs by Index returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageLogsByIndex(ctx,time.Now().AddDate(0,0,-5),*datadog.NewGetUsageLogsByIndexOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageLogsByIndex`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageLogsByIndex`:\n%s\n",responseContent)}
// Get hourly usage for Logs by Index returns "OK" response
importcom.datadog.api.v1.client.ApiClient;importcom.datadog.api.v1.client.ApiException;importcom.datadog.api.v1.client.Configuration;importcom.datadog.api.v1.client.api.UsageMeteringApi;importcom.datadog.api.v1.client.api.UsageMeteringApi.GetUsageLogsByIndexOptionalParameters;importcom.datadog.api.v1.client.model.UsageLogsByIndexResponse;importjava.time.OffsetDateTime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{UsageLogsByIndexResponseresult=apiInstance.getUsageLogsByIndex(OffsetDateTime.now().plusDays(-5),newGetUsageLogsByIndexOptionalParameters().endHr(OffsetDateTime.now().plusDays(-3)));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getUsageLogsByIndex");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
# Get hourly usage for custom metrics returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_timeseries((Time.now+-5*86400),opts)
時間平均に基づくすべてのカスタムメトリクスを取得します。 当月のデータを取得する場合は month パラメータを使用し、日ごとのデータを取得する場合は day パラメータを使用します。2 つのうち 1 つは必須ですが、許可されるのは 1 つのみです。
This endpoint requires the usage_read authorization scope.
引数
クエリ文字列
名前
種類
説明
month
string
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)
day
string
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)
names
array
Comma-separated list of metric names.
limit
integer
Maximum number of results to return (between 1 and 5000) - defaults to 500 results if limit not specified.
next_record_id
string
List following results with a next_record_id provided in the previous query.
"""
Get all custom metrics by hourly average returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_top_avg_metrics(day=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get all custom metrics by hourly average returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={day:(Time.now+-3*86400),}papi_instance.get_usage_top_avg_metrics(opts)
/**
* Get all custom metrics by hourly average returns "OK" response
*/import{v1}from"@datadog/datadog-api-client";constconfiguration=v1.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageTopAvgMetricsRequest={day: newDate(newDate().getTime()/1000+-3*86400),};apiInstance.getUsageTopAvgMetrics(params).then((data: v1.UsageTopAvgMetricsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Get all custom metrics by hourly average returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageTopAvgMetrics(ctx,*datadog.NewGetUsageTopAvgMetricsOptionalParameters().WithDay(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageTopAvgMetrics`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageTopAvgMetrics`:\n%s\n",responseContent)}
// Get all custom metrics by hourly average returns "OK" response
importcom.datadog.api.v1.client.ApiClient;importcom.datadog.api.v1.client.ApiException;importcom.datadog.api.v1.client.Configuration;importcom.datadog.api.v1.client.api.UsageMeteringApi;importcom.datadog.api.v1.client.api.UsageMeteringApi.GetUsageTopAvgMetricsOptionalParameters;importcom.datadog.api.v1.client.model.UsageTopAvgMetricsResponse;importjava.time.OffsetDateTime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{UsageTopAvgMetricsResponseresult=apiInstance.getUsageTopAvgMetrics(newGetUsageTopAvgMetricsOptionalParameters().day(OffsetDateTime.now().plusDays(-3)));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getUsageTopAvgMetrics");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
# Get hourly usage for indexed spans returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_indexed_spans((Time.now+-5*86400),opts)
# Get hourly usage for Synthetics Checks returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newpapi_instance.get_usage_synthetics("2021-11-11T11:11:11.111+00:00")
"""
Get hourly usage for Synthetics API Checks returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_synthetics_api(start_hr=(datetime.now()+relativedelta(days=-5)).isoformat(timespec="seconds"),end_hr=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get hourly usage for Synthetics API Checks returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_synthetics_api((Time.now+-5*86400),opts)
/**
* Get hourly usage for Synthetics API Checks returns "OK" response
*/import{v1}from"@datadog/datadog-api-client";constconfiguration=v1.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageSyntheticsAPIRequest={startHr: newDate(newDate().getTime()/1000+-5*86400),endHr: newDate(newDate().getTime()/1000+-3*86400),};apiInstance.getUsageSyntheticsAPI(params).then((data: v1.UsageSyntheticsAPIResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Get hourly usage for Synthetics API Checks returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageSyntheticsAPI(ctx,time.Now().AddDate(0,0,-5),*datadog.NewGetUsageSyntheticsAPIOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageSyntheticsAPI`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageSyntheticsAPI`:\n%s\n",responseContent)}
// Get hourly usage for Synthetics API Checks returns "OK" response
importcom.datadog.api.v1.client.ApiClient;importcom.datadog.api.v1.client.ApiException;importcom.datadog.api.v1.client.Configuration;importcom.datadog.api.v1.client.api.UsageMeteringApi;importcom.datadog.api.v1.client.api.UsageMeteringApi.GetUsageSyntheticsAPIOptionalParameters;importcom.datadog.api.v1.client.model.UsageSyntheticsAPIResponse;importjava.time.OffsetDateTime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{UsageSyntheticsAPIResponseresult=apiInstance.getUsageSyntheticsAPI(OffsetDateTime.now().plusDays(-5),newGetUsageSyntheticsAPIOptionalParameters().endHr(OffsetDateTime.now().plusDays(-3)));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getUsageSyntheticsAPI");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Get hourly usage for Fargate returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_fargate(start_hr=(datetime.now()+relativedelta(days=-5)).isoformat(timespec="seconds"),end_hr=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get hourly usage for Fargate returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_fargate((Time.now+-5*86400),opts)
// Get hourly usage for Fargate returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageFargate(ctx,time.Now().AddDate(0,0,-5),*datadog.NewGetUsageFargateOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageFargate`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageFargate`:\n%s\n",responseContent)}
"""
Get hourly usage for Lambda returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_lambda(start_hr=(datetime.now()+relativedelta(days=-5)).isoformat(timespec="seconds"),end_hr=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get hourly usage for Lambda returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_lambda((Time.now+-5*86400),opts)
// Get hourly usage for Lambda returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageLambda(ctx,time.Now().AddDate(0,0,-5),*datadog.NewGetUsageLambdaOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageLambda`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageLambda`:\n%s\n",responseContent)}
"""
Get hourly usage for RUM Sessions returns "OK" response
"""fromdatetimeimportdatetimefromdateutil.relativedeltaimportrelativedeltafromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v1.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_usage_rum_sessions(start_hr=(datetime.now()+relativedelta(days=-5)).isoformat(timespec="seconds"),end_hr=(datetime.now()+relativedelta(days=-3)).isoformat(timespec="seconds"),)print(response)
# Get hourly usage for RUM Sessions returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_rum_sessions((Time.now+-5*86400),opts)
/**
* Get hourly usage for RUM Sessions returns "OK" response
*/import{v1}from"@datadog/datadog-api-client";constconfiguration=v1.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageRumSessionsRequest={startHr: newDate(newDate().getTime()/1000+-5*86400),endHr: newDate(newDate().getTime()/1000+-3*86400),};apiInstance.getUsageRumSessions(params).then((data: v1.UsageRumSessionsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
// Get hourly usage for RUM Sessions returns "OK" response
packagemainimport("context""encoding/json""fmt""os""time"datadog"github.com/DataDog/datadog-api-client-go/api/v1/datadog")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)resp,r,err:=apiClient.UsageMeteringApi.GetUsageRumSessions(ctx,time.Now().AddDate(0,0,-5),*datadog.NewGetUsageRumSessionsOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageRumSessions`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageRumSessions`:\n%s\n",responseContent)}
// Get hourly usage for RUM Sessions returns "OK" response
importcom.datadog.api.v1.client.ApiClient;importcom.datadog.api.v1.client.ApiException;importcom.datadog.api.v1.client.Configuration;importcom.datadog.api.v1.client.api.UsageMeteringApi;importcom.datadog.api.v1.client.api.UsageMeteringApi.GetUsageRumSessionsOptionalParameters;importcom.datadog.api.v1.client.model.UsageRumSessionsResponse;importjava.time.OffsetDateTime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=Configuration.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{UsageRumSessionsResponseresult=apiInstance.getUsageRumSessions(OffsetDateTime.now().plusDays(-5),newGetUsageRumSessionsOptionalParameters().endHr(OffsetDateTime.now().plusDays(-3)));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getUsageRumSessions");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}