Get hourly usage for CI visibility (tests, pipeline, and spans).
Note: This endpoint has been deprecated. Hourly usage data for all products is now available in the Get hourly usage by product family API. Refer to Migrating from the V1 Hourly Usage APIs to V2 for the associated migration guide.
This endpoint requires the usage_read permission.
OAuth apps require the usage_read authorization scope to access this endpoint.
Arguments
Query Strings
Name
Type
Description
start_hr [required]
string
Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
end_hr
string
Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending
before this hour.
The number of spans for pipelines in the queried hour.
ci_test_indexed_spans
int64
The number of spans for tests in the queried hour.
ci_visibility_itr_committers
int64
Shows the total count of all active Git committers for Intelligent Test Runner in the current month. A committer is active if they commit at least 3 times in a given month.
ci_visibility_pipeline_committers
int64
Shows the total count of all active Git committers for Pipelines in the current month. A committer is active if they commit at least 3 times in a given month.
ci_visibility_test_committers
int64
The total count of all active Git committers for tests in the current month. A committer is active if they commit at least 3 times in a given month.
"""
Get hourly usage for CI visibility 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_ci_app(start_hr=(datetime.now()+relativedelta(days=-5)),end_hr=(datetime.now()+relativedelta(days=-3)),)print(response)
# Get hourly usage for CI visibility returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V1::UsageMeteringAPI.newopts={end_hr:(Time.now+-3*86400),}papi_instance.get_usage_ci_app((Time.now+-5*86400),opts)
// Get hourly usage for CI visibility returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""time""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV1")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV1.NewUsageMeteringApi(apiClient)resp,r,err:=api.GetUsageCIApp(ctx,time.Now().AddDate(0,0,-5),*datadogV1.NewGetUsageCIAppOptionalParameters().WithEndHr(time.Now().AddDate(0,0,-3)))iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetUsageCIApp`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetUsageCIApp`:\n%s\n",responseContent)}
// Get hourly usage for CI visibility returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v1.api.UsageMeteringApi;importcom.datadog.api.client.v1.api.UsageMeteringApi.GetUsageCIAppOptionalParameters;importcom.datadog.api.client.v1.model.UsageCIVisibilityResponse;importjava.time.OffsetDateTime;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{UsageCIVisibilityResponseresult=apiInstance.getUsageCIApp(OffsetDateTime.now().plusDays(-5),newGetUsageCIAppOptionalParameters().endHr(OffsetDateTime.now().plusDays(-3)));System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getUsageCIApp");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 CI visibility returns "OK" response
usechrono::{DateTime,Utc};usedatadog_api_client::datadog;usedatadog_api_client::datadogV1::api_usage_metering::GetUsageCIAppOptionalParams;usedatadog_api_client::datadogV1::api_usage_metering::UsageMeteringAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsageMeteringAPI::with_config(configuration);letresp=api.get_usage_ci_app(DateTime::parse_from_rfc3339("2021-11-06T11:11:11+00:00").expect("Failed to parse datetime").with_timezone(&Utc),GetUsageCIAppOptionalParams::default().end_hr(DateTime::parse_from_rfc3339("2021-11-08T11:11:11+00:00").expect("Failed to parse datetime").with_timezone(&Utc),),).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get hourly usage for CI visibility returns "OK" response
*/import{client,v1}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv1.UsageMeteringApi(configuration);constparams: v1.UsageMeteringApiGetUsageCIAppRequest={startHr: newDate(newDate().getTime()+-5*86400*1000),endHr: newDate(newDate().getTime()+-3*86400*1000),};apiInstance.getUsageCIApp(params).then((data: v1.UsageCIVisibilityResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));