Mesure d'utilisation
Rapport de recherche Datadog : Bilan sur l'adoption de l'informatique sans serveur Rapport : Bilan sur l'adoption de l'informatique sans serveur

Mesure de l'utilisation

L’API de mesure de l’utilisation vous permet de récupérer des informations sur l’utilisation horaire, journalière et mensuelle de nombreuses facettes de Datadog. Tous les clients Pro et Enterprise peuvent utiliser cette API. Seules les [organisations de niveau parent] peuvent l’utiliser (https://docs.datadoghq.com/account_management/multi_organization/).

Remarque : les données d’utilisation peuvent accuser d’un retard de 72 heures après leur collecte. Elles sont conservées pendant 15 mois.

Get billable usage across your multi-org account

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/billable-summary

Présentation

Get billable usage across your multi-org account.

Arguments

Chaînes de requête

Nom

Type

Description

month

string

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

Réponse

OK

Response with monthly summary of data billed by Datadog.

Expand All

Champ

Type

Description

usage

[object]

An array of objects regarding usage of billable summary.

billing_plan

string

The billing plan.

end_date

date-time

Shows the last date of usage.

num_orgs

int64

The number of organizations.

org_name

string

The organization name.

public_id

string

The organization public ID.

ratio_in_month

int64

Shows usage aggregation for a billing period.

start_date

date-time

Shows the first date of usage.

usage

object

Response with aggregated usage types.

apm_host_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

apm_host_top99p

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

apm_trace_search_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

fargate_container_average

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

infra_container_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

infra_host_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

infra_host_top99p

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

iot_top99p

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

lambda_function_average

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

logs_indexed_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

logs_ingested_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

npm_flow_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

npm_host_top99p

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

rum_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

siem_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

synthetics_api_tests_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

synthetics_browser_checks_sum

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

timeseries_average

object

Response with properties for each aggregated usage type.

account_billable_usage

int64

The total account usage.

elapsed_usage_hours

int64

Elapsed usage hours for some billable product.

first_billable_usage_hour

date-time

The first billable hour for the org.

last_billable_usage_hour

date-time

The last billable hour for the org.

org_billable_usage

int64

The number of units used within the billable timeframe.

percentage_in_account

double

The percentage of account usage the org represents.

usage_unit

string

Units pertaining to the usage.

{
  "usage": [
    {
      "billing_plan": "string",
      "end_date": "2019-09-19T10:00:00.000Z",
      "num_orgs": "integer",
      "org_name": "string",
      "public_id": "string",
      "ratio_in_month": "integer",
      "start_date": "2019-09-19T10:00:00.000Z",
      "usage": {
        "apm_host_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "apm_host_top99p": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "apm_trace_search_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "fargate_container_average": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "infra_container_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "infra_host_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "infra_host_top99p": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "iot_top99p": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "lambda_function_average": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "logs_indexed_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "logs_ingested_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "npm_flow_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "npm_host_top99p": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "rum_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "siem_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "synthetics_api_tests_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "synthetics_browser_checks_sum": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        },
        "timeseries_average": {
          "account_billable_usage": "integer",
          "elapsed_usage_hours": "integer",
          "first_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "last_billable_usage_hour": "2019-09-19T10:00:00.000Z",
          "org_billable_usage": "integer",
          "percentage_in_account": "number",
          "usage_unit": "string"
        }
      }
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Curl command
curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/billable-summary" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    month := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage starting this month. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageBillableSummary(context.Background()).Month(month).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageBillableSummary``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageBillableSummary`: UsageBillableSummaryResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageBillableSummary`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime month = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage starting this month.
        try {
            UsageBillableSummaryResponse result = api.getUsageBillableSummary()
                .month(month)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageBillableSummary");
            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 analyzed logs

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/analyzed_logs

Présentation

Get hourly usage for analyzed logs (Security Monitoring).

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

A response containing the number of analyzed logs for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for analyzed logs.

analyzed_logs

int64

Contains the number of analyzed logs.

hour

date-time

The hour for the usage.

{
  "usage": [
    {
      "analyzed_logs": "integer",
      "hour": "2019-09-19T10:00:00.000Z"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/analyzed_logs?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageAnalyzedLogs(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageAnalyzedLogs``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageAnalyzedLogs`: UsageAnalyzedLogsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageAnalyzedLogs`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour.
        try {
            UsageAnalyzedLogsResponse result = api.getUsageAnalyzedLogs()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageAnalyzedLogs");
            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

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/timeseries

Présentation

Get hourly usage for custom metrics.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing hourly usage of timeseries.

Expand All

Champ

Type

Description

usage

[object]

An array of objects regarding hourly usage of timeseries.

hour

date-time

The hour for the usage.

num_custom_input_timeseries

int64

Contains the number of custom metrics that are inputs for aggregations (metric configured is custom).

num_custom_output_timeseries

int64

Contains the number of custom metrics that are outputs for aggregations (metric configured is custom).

num_custom_timeseries

int64

Contains the number of non-aggregation custom metrics.

{
  "usage": [
    {
      "hour": "2019-09-19T10:00:00.000Z",
      "num_custom_input_timeseries": "integer",
      "num_custom_output_timeseries": "integer",
      "num_custom_timeseries": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/timeseries?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageTimeseries(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageTimeseries``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageTimeseries`: UsageTimeseriesResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageTimeseries`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageTimeseriesResponse result = api.getUsageTimeseries()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageTimeseries");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_custom_metrics_usage(start_date, end_date)

Get hourly usage for Fargate

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/fargate

Présentation

Get hourly usage for Fargate.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of Fargate tasks run and hourly usage.

Expand All

Champ

Type

Description

usage

[object]

Array with the number of hourly Fargate tasks recorded for a given organization.

hour

date-time

The hour for the usage.

tasks_count

int64

The number of Fargate tasks run.

{
  "usage": [
    {
      "hour": "2019-09-19T10:00:00.000Z",
      "tasks_count": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/fargate?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageFargate(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageFargate``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageFargate`: UsageFargateResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageFargate`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageFargateResponse result = api.getUsageFargate()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageFargate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_fargate_usage(start_date, end_date)

Get hourly usage for hosts and containers

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/hosts

Présentation

Get hourly usage for hosts and containers.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Host usage response.

Expand All

Champ

Type

Description

usage

[object]

An array of objects related to host usage.

agent_host_count

int64

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 via Alibaba integration (and were NOT running the Datadog Agent).

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 via the AWS integration (and were NOT running the Datadog Agent).

azure_host_count

int64

Contains the total number of hosts that reported via 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 via the Google Cloud integration (and were NOT running 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.

{
  "usage": [
    {
      "agent_host_count": "integer",
      "alibaba_host_count": "integer",
      "apm_host_count": "integer",
      "aws_host_count": "integer",
      "azure_host_count": "integer",
      "container_count": "integer",
      "gcp_host_count": "integer",
      "host_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/hosts?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageHosts(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageHosts``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageHosts`: UsageHostsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageHosts`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageHostsResponse result = api.getUsageHosts()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_hosts_usage(start_date, end_date)

Get hourly usage for Lambda

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/aws_lambda

Présentation

Get hourly usage for lambda.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of lambda functions and sum of the invocations of all lambda functions for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for Lambda.

func_count

int64

Contains the number of different functions for each region and AWS account.

hour

date-time

The hour for the usage.

invocations_sum

int64

Contains the sum of invocations of all functions.

{
  "usage": [
    {
      "func_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z",
      "invocations_sum": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/aws_lambda?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageLambda(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageLambda``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageLambda`: UsageLambdaResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageLambda`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageLambdaResponse result = api.getUsageLambda()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageLambda");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_aws_lambda_usage(start_date, end_date)

Get hourly usage for Logs

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/logs

Présentation

Get hourly usage for logs.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of logs for each hour.

Expand All

Champ

Type

Description

usage

[object]

An array of objects regarding hourly usage of logs.

billable_ingested_bytes

int64

Contains the number of billable log bytes ingested.

hour

date-time

The hour for the usage.

indexed_events_count

int64

Contains the number of log events indexed.

ingested_events_bytes

int64

Contains the number of log bytes ingested.

{
  "usage": [
    {
      "billable_ingested_bytes": "integer",
      "hour": "2019-09-19T10:00:00.000Z",
      "indexed_events_count": "integer",
      "ingested_events_bytes": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/logs?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageLogs(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageLogs``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageLogs`: UsageLogsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageLogs`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageLogsResponse result = api.getUsageLogs()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageLogs");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_logs_usage(start_date, end_date)

Get hourly usage for Logs by Index

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/logs_by_index

Présentation

Get hourly usage for logs by index.

Arguments

Chaînes de requête

Nom

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.

index_name

array

Comma-separated list of log index names.

Réponse

OK

Response containing the number of indexed logs for each hour and index for a given organization.

Expand All

Champ

Type

Description

usage

[object]

An array of objects regarding hourly usage of logs by index response.

event_count

int64

The total number of indexed logs for the queried hour.

hour

date-time

The hour for the usage.

index_id

string

The index ID for this usage.

index_name

string

The user specified name for this index ID.

retention

int64

The retention period (in days) for this index ID.

{
  "usage": [
    {
      "event_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z",
      "index_id": "string",
      "index_name": "string",
      "retention": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/logs_by_index?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)
    indexName := []string{"Inner_example"} // []string | Comma-separated list of log index names. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageLogsByIndex(context.Background()).StartHr(startHr).EndHr(endHr).IndexName(indexName).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageLogsByIndex``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageLogsByIndex`: UsageLogsByIndexResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageLogsByIndex`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        List<String> indexName = Arrays.asList(); // List<String> | Comma-separated list of log index names.
        try {
            UsageLogsByIndexResponse result = api.getUsageLogsByIndex()
                .startHr(startHr)
                .endHr(endHr)
                .indexName(indexName)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}
# Consult the ruby example
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2020-01-01T00'
end_date='2019-01-01T02'
index_name='main, marketing'

dog.get_logs_by_index_usage(start_date, end_date, index_name)

Get hourly usage for Network Flows

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/network_flows

Présentation

Get hourly usage for network flows.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of netflow events indexed for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for Network Flows.

hour

date-time

The hour for the usage.

indexed_event_count

int64

Contains the number of netflow events indexed.

{
  "usage": [
    {
      "hour": "2019-09-19T10:00:00.000Z",
      "indexed_event_count": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/network_flows?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageNetworkFlows(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageNetworkFlows``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageNetworkFlows`: UsageNetworkFlowsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageNetworkFlows`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour.
        try {
            UsageNetworkFlowsResponse result = api.getUsageNetworkFlows()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageNetworkFlows");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_network_flows_usage(start_date, end_date)

Get hourly usage for Network Hosts

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/network_hosts

Présentation

Get hourly usage for network hosts.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of active NPM hosts for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for NPM hosts.

host_count

int64

Contains the number of active NPM hosts.

hour

date-time

The hour for the usage.

{
  "usage": [
    {
      "host_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/network_hosts?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageNetworkHosts(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageNetworkHosts``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageNetworkHosts`: UsageNetworkHostsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageNetworkHosts`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageNetworkHostsResponse result = api.getUsageNetworkHosts()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageNetworkHosts");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_network_hosts_usage(start_date, end_date)

Get hourly usage for profiled hosts

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/profiling

Présentation

Get hourly usage for profiled hosts.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of profiled hosts for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for profiled hosts.

avg_container_agent_count

int64

Get average number of container agents for that hour.

host_count

int64

Contains the total number of profiled hosts reporting during a given hour.

hour

date-time

The hour for the usage.

{
  "usage": [
    {
      "avg_container_agent_count": "integer",
      "host_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/profiling?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageProfiling(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageProfiling``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageProfiling`: UsageProfilingResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageProfiling`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour.
        try {
            UsageProfilingResponse result = api.getUsageProfiling()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageProfiling");
            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 RUM Sessions

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/rum_sessions

Présentation

Get hourly usage for RUM Sessions.

Arguments

Chaînes de requête

Nom

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.

type

string

RUM type: [browser, mobile]. Defaults to browser.

Réponse

OK

Response containing the number of RUM Sessions for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for RUM Sessions.

hour

date-time

The hour for the usage.

session_count

int64

Contains the number of RUM Sessions.

{
  "usage": [
    {
      "hour": "2019-09-19T10:00:00.000Z",
      "session_count": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/rum_sessions?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)
    type_ := "type__example" // string | RUM type: `[browser, mobile]`. Defaults to `browser`. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageRumSessions(context.Background()).StartHr(startHr).EndHr(endHr).Type_(type_).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageRumSessions``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageRumSessions`: UsageRumSessionsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageRumSessions`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        String type = "type_example"; // String | RUM type: `[browser, mobile]`. Defaults to `browser`.
        try {
            UsageRumSessionsResponse result = api.getUsageRumSessions()
                .startHr(startHr)
                .endHr(endHr)
                .type(type)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_rum_sessions_usage(start_date, end_date)

Get hourly usage for SNMP devices

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/snmp

Présentation

Get hourly usage for SNMP devices.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of SNMP devices for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for SNMP devices.

hour

date-time

The hour for the usage.

snmp_devices

int64

Contains the number of SNMP devices.

{
  "usage": [
    {
      "hour": "2019-09-19T10:00:00.000Z",
      "snmp_devices": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/snmp?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageSNMP(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageSNMP``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageSNMP`: UsageSNMPResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageSNMP`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour.
        try {
            UsageSNMPResponse result = api.getUsageSNMP()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageSNMP");
            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 Synthetics API Checks

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/synthetics_api

Présentation

Get hourly usage for synthetics API checks.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of Synthetics API tests run for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for Synthetics API tests.

check_calls_count

int64

Contains the number of Synthetics API tests run.

hour

date-time

The hour for the usage.

{
  "usage": [
    {
      "check_calls_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/synthetics_api?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageSyntheticsAPI(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageSyntheticsAPI``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageSyntheticsAPI`: UsageSyntheticsAPIResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageSyntheticsAPI`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageSyntheticsAPIResponse result = api.getUsageSyntheticsAPI()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            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();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_synthetics_api_usage(start_date, end_date)

Get hourly usage for Synthetics Browser Checks

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/synthetics_browser

Présentation

Get hourly usage for synthetics browser checks.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of Synthetics Browser tests run for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for Synthetics Browser tests.

browser_check_calls_count

int64

Contains the number of Synthetics Browser tests run.

hour

date-time

The hour for the usage.

{
  "usage": [
    {
      "browser_check_calls_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/synthetics_browser?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageSyntheticsBrowser(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageSyntheticsBrowser``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageSyntheticsBrowser`: UsageSyntheticsBrowserResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageSyntheticsBrowser`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageSyntheticsBrowserResponse result = api.getUsageSyntheticsBrowser()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageSyntheticsBrowser");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_synthetics_browser_usage(start_date, end_date)

Get hourly usage for Synthetics Checks

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/synthetics

Présentation

Get hourly usage for Synthetics checks.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the number of Synthetics API tests run for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Array with the number of hourly Synthetics test run for a given organization.

check_calls_count

int64

Contains the number of Synthetics API tests run.

hour

date-time

The hour for the usage.

{
  "usage": [
    {
      "check_calls_count": "integer",
      "hour": "2019-09-19T10:00:00.000Z"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/synthetics?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageSynthetics(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageSynthetics``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageSynthetics`: UsageSyntheticsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageSynthetics`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageSyntheticsResponse result = api.getUsageSynthetics()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageSynthetics");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/traces

Présentation

Get hourly usage for trace search.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

A response containing trace usage.

Expand All

Champ

Type

Description

usage

[object]

Array with the number of hourly traces indexed for a given organization.

hour

date-time

The hour for the usage.

indexed_events_count

int64

Contains the number of Indexed Spans indexed.

{
  "usage": [
    {
      "hour": "2019-09-19T10:00:00.000Z",
      "indexed_events_count": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/traces?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageTrace(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageTrace``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageTrace`: UsageTraceResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageTrace`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: [YYYY-MM-DDThh] for usage ending **before** this hour.
        try {
            UsageTraceResponse result = api.getUsageTrace()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageTrace");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}
require 'rubygems'
require 'dogapi'

api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

start_date= '2019-10-07T00'
end_date='2019-10-07T02'

dog.get_traces_usage(start_date, end_date)

Get hourly usage for tracing without limits

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/tracing-without-limits

Présentation

Get hourly usage for tracing without limits.

Arguments

Chaînes de requête

Nom

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.

Réponse

OK

Response containing the tracing without limits usage for each hour for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Get hourly usage for tracing without limits.

hour

date-time

The hour for the usage.

ingested_events_bytes

int64

Contains the total number of bytes ingested during a given hour.

{
  "usage": [
    {
      "hour": "2019-09-19T10:00:00.000Z",
      "ingested_events_bytes": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_hr="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/tracing-without-limits?start_hr=${start_hr}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
    endHr := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetTracingWithoutLimits(context.Background()).StartHr(startHr).EndHr(endHr).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetTracingWithoutLimits``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetTracingWithoutLimits`: UsageTracingWithoutLimitsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetTracingWithoutLimits`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
        OffsetDateTime endHr = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour.
        try {
            UsageTracingWithoutLimitsResponse result = api.getTracingWithoutLimits()
                .startHr(startHr)
                .endHr(endHr)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getTracingWithoutLimits");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Get specified daily custom reports

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/daily_custom_reports/{report_id}

Présentation

Get specified daily custom reports.

Arguments

Paramètres du chemin

Nom

Type

Description

report_id [required]

string

The specified ID to search results for.

Réponse

OK

Returns available specified custom reports.

Expand All

Champ

Type

Description

data

object

Response containing date and type for specified custom reports.

attributes

object

The response containing attributes for specified custom reports.

computed_on

string

The date the specified custom report was computed.

end_date

string

The ending date of specified custom report.

location

string

A downloadable file for the specified custom reporting file.

size

int64

size

start_date

string

The starting date of specified custom report.

tags

[string]

A list of tags to apply to specified custom reports.

id

string

The date for specified custom reports.

type

enum

The type of reports. Allowed enum values: reports

meta

object

The object containing document metadata.

page

object

The object containing page total count for specified ID.

total_count

int64

Total page count.

{
  "data": {
    "attributes": {
      "computed_on": "string",
      "end_date": "string",
      "location": "https://an-s3-or-gs-bucket.s3.amazonaws.com",
      "size": "integer",
      "start_date": "string",
      "tags": [
        "env"
      ]
    },
    "id": "string",
    "type": "reports"
  },
  "meta": {
    "page": {
      "total_count": "integer"
    }
  }
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Path parameters
export report_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/daily_custom_reports/${report_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    reportId := "reportId_example" // string | The specified ID to search results for.

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetSpecifiedDailyCustomReports(context.Background(), reportId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetSpecifiedDailyCustomReports``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetSpecifiedDailyCustomReports`: UsageSpecifiedCustomReportsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetSpecifiedDailyCustomReports`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        String reportId = "reportId_example"; // String | The specified ID to search results for.
        try {
            UsageSpecifiedCustomReportsResponse result = api.getSpecifiedDailyCustomReports(reportId)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getSpecifiedDailyCustomReports");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Get specified monthly custom reports

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/monthly_custom_reports/{report_id}

Présentation

Get specified monthly custom reports.

Arguments

Paramètres du chemin

Nom

Type

Description

report_id [required]

string

The specified ID to search results for.

Réponse

OK

Returns available specified custom reports.

Expand All

Champ

Type

Description

data

object

Response containing date and type for specified custom reports.

attributes

object

The response containing attributes for specified custom reports.

computed_on

string

The date the specified custom report was computed.

end_date

string

The ending date of specified custom report.

location

string

A downloadable file for the specified custom reporting file.

size

int64

size

start_date

string

The starting date of specified custom report.

tags

[string]

A list of tags to apply to specified custom reports.

id

string

The date for specified custom reports.

type

enum

The type of reports. Allowed enum values: reports

meta

object

The object containing document metadata.

page

object

The object containing page total count for specified ID.

total_count

int64

Total page count.

{
  "data": {
    "attributes": {
      "computed_on": "string",
      "end_date": "string",
      "location": "https://an-s3-or-gs-bucket.s3.amazonaws.com",
      "size": "integer",
      "start_date": "string",
      "tags": [
        "env"
      ]
    },
    "id": "string",
    "type": "reports"
  },
  "meta": {
    "page": {
      "total_count": "integer"
    }
  }
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Path parameters
export report_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/monthly_custom_reports/${report_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    reportId := "reportId_example" // string | The specified ID to search results for.

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetSpecifiedMonthlyCustomReports(context.Background(), reportId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetSpecifiedMonthlyCustomReports``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetSpecifiedMonthlyCustomReports`: UsageSpecifiedCustomReportsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetSpecifiedMonthlyCustomReports`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        String reportId = "reportId_example"; // String | The specified ID to search results for.
        try {
            UsageSpecifiedCustomReportsResponse result = api.getSpecifiedMonthlyCustomReports(reportId)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getSpecifiedMonthlyCustomReports");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Get the list of available daily custom reports

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/daily_custom_reports

Présentation

Get daily custom reports.

Arguments

Chaînes de requête

Nom

Type

Description

page[size]

integer

The number of files to return in the response. [default=60].

page[number]

integer

The identifier of the first page to return. This parameter is used for the pagination feature [default=0].

sort_dir

string

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

sort

string

The field to sort by: [computed_on, size, start_date, end_date].

Réponse

OK

Response containing available custom reports.

Expand All

Champ

Type

Description

data

[object]

An array of available custom reports.

attributes

object

The response containing attributes for custom reports.

computed_on

string

The date the specified custom report was computed.

end_date

string

The ending date of custom report.

size

int64

size

start_date

string

The starting date of custom report.

tags

[string]

A list of tags to apply to custom reports.

id

string

The date for specified custom reports.

type

enum

The type of reports. Allowed enum values: reports

meta

object

The object containing document metadata.

page

object

The object containing page total count.

total_count

int64

Total page count.

{
  "data": [
    {
      "attributes": {
        "computed_on": "string",
        "end_date": "string",
        "size": "integer",
        "start_date": "string",
        "tags": [
          "env"
        ]
      },
      "id": "string",
      "type": "reports"
    }
  ],
  "meta": {
    "page": {
      "total_count": "integer"
    }
  }
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Curl command
curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/daily_custom_reports" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    pageSize := 987 // int64 | The number of files to return in the response. `[default=60]`. (optional)
    pageNumber := 987 // int64 | The identifier of the first page to return. This parameter is used for the pagination feature `[default=0]`. (optional)
    sortDir := *datadog.NewUsageSortDirection() // UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional) (default to "desc")
    sort := *datadog.NewUsageSort() // UsageSort | The field to sort by: `[computed_on, size, start_date, end_date]`. (optional) (default to "start_date")

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetDailyCustomReports(context.Background()).PageSize(pageSize).PageNumber(pageNumber).SortDir(sortDir).Sort(sort).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetDailyCustomReports``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetDailyCustomReports`: UsageCustomReportsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetDailyCustomReports`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        Long pageSize = 56L; // Long | The number of files to return in the response. `[default=60]`.
        Long pageNumber = 56L; // Long | The identifier of the first page to return. This parameter is used for the pagination feature `[default=0]`.
        UsageSortDirection sortDir = new UsageSortDirection(); // UsageSortDirection | The direction to sort by: `[desc, asc]`.
        UsageSort sort = new UsageSort(); // UsageSort | The field to sort by: `[computed_on, size, start_date, end_date]`.
        try {
            UsageCustomReportsResponse result = api.getDailyCustomReports()
                .pageSize(pageSize)
                .pageNumber(pageNumber)
                .sortDir(sortDir)
                .sort(sort)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getDailyCustomReports");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Get the list of available monthly custom reports

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/monthly_custom_reports

Présentation

Get monthly custom reports.

Arguments

Chaînes de requête

Nom

Type

Description

page[size]

integer

The number of files to return in the response [default=60].

page[number]

integer

The identifier of the first page to return. This parameter is used for the pagination feature [default=0].

sort_dir

string

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

sort

string

The field to sort by: [computed_on, size, start_date, end_date].

Réponse

OK

Response containing available custom reports.

Expand All

Champ

Type

Description

data

[object]

An array of available custom reports.

attributes

object

The response containing attributes for custom reports.

computed_on

string

The date the specified custom report was computed.

end_date

string

The ending date of custom report.

size

int64

size

start_date

string

The starting date of custom report.

tags

[string]

A list of tags to apply to custom reports.

id

string

The date for specified custom reports.

type

enum

The type of reports. Allowed enum values: reports

meta

object

The object containing document metadata.

page

object

The object containing page total count.

total_count

int64

Total page count.

{
  "data": [
    {
      "attributes": {
        "computed_on": "string",
        "end_date": "string",
        "size": "integer",
        "start_date": "string",
        "tags": [
          "env"
        ]
      },
      "id": "string",
      "type": "reports"
    }
  ],
  "meta": {
    "page": {
      "total_count": "integer"
    }
  }
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Curl command
curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/monthly_custom_reports" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    pageSize := 987 // int64 | The number of files to return in the response `[default=60].` (optional)
    pageNumber := 987 // int64 | The identifier of the first page to return. This parameter is used for the pagination feature `[default=0]`. (optional)
    sortDir := *datadog.NewUsageSortDirection() // UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional) (default to "desc")
    sort := *datadog.NewUsageSort() // UsageSort | The field to sort by: `[computed_on, size, start_date, end_date]`. (optional) (default to "start_date")

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetMonthlyCustomReports(context.Background()).PageSize(pageSize).PageNumber(pageNumber).SortDir(sortDir).Sort(sort).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetMonthlyCustomReports``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetMonthlyCustomReports`: UsageCustomReportsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetMonthlyCustomReports`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        Long pageSize = 56L; // Long | The number of files to return in the response `[default=60].`
        Long pageNumber = 56L; // Long | The identifier of the first page to return. This parameter is used for the pagination feature `[default=0]`.
        UsageSortDirection sortDir = new UsageSortDirection(); // UsageSortDirection | The direction to sort by: `[desc, asc]`.
        UsageSort sort = new UsageSort(); // UsageSort | The field to sort by: `[computed_on, size, start_date, end_date]`.
        try {
            UsageCustomReportsResponse result = api.getMonthlyCustomReports()
                .pageSize(pageSize)
                .pageNumber(pageNumber)
                .sortDir(sortDir)
                .sort(sort)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getMonthlyCustomReports");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Get top 500 custom metrics by hourly average

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/top_avg_metrics

Présentation

Get top custom metrics by hourly average.

Arguments

Chaînes de requête

Nom

Type

Description

month [required]

string

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

names

array

Comma-separated list of metric names.

Réponse

OK

Response containing the number of hourly recorded custom metrics for a given organization.

Expand All

Champ

Type

Description

usage

[object]

Number of hourly recorded custom metrics for a given organization.

avg_metric_hour

int64

Average number of timeseries per hour in which the metric occurs.

max_metric_hour

int64

Maximum number of timeseries per hour in which the metric occurs.

metric_category

enum

Contains the metric category. Allowed enum values: standard,custom

metric_name

string

Contains the custom metric name.

{
  "usage": [
    {
      "avg_metric_hour": "integer",
      "max_metric_hour": "integer",
      "metric_category": "string",
      "metric_name": "string"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export month="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/top_avg_metrics?month=${month}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    month := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning at this hour.
    names := []string{"Inner_example"} // []string | Comma-separated list of metric names. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageTopAvgMetrics(context.Background()).Month(month).Names(names).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageTopAvgMetrics``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageTopAvgMetrics`: UsageTopAvgMetricsResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageTopAvgMetrics`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime month = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning at this hour.
        List<String> names = Arrays.asList(); // List<String> | Comma-separated list of metric names.
        try {
            UsageTopAvgMetricsResponse result = api.getUsageTopAvgMetrics()
                .month(month)
                .names(names)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            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 usage across your multi-org account

GET https://api.datadoghq.comhttps://api.datadoghq.eu/api/v1/usage/summary

Présentation

Get usage across your multi-org account.

Arguments

Chaînes de requête

Nom

Type

Description

start_month [required]

string

Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for usage beginning in this month. Maximum of 15 months ago.

end_month

string

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

include_org_details

boolean

Include usage summaries for each sub-org.

Réponse

OK

Response with hourly report of all data billed by Datadog all organizations.

Expand All

Champ

Type

Description

agent_host_top99p_sum

int64

Shows the 99th percentile of all agent hosts over all hours in the current month(s) for all organizations.

apm_host_top99p_sum

int64

Shows the 99th percentile of all distinct APM hosts over all hours in the current month(s) for all organizations.

aws_host_top99p_sum

int64

Shows the 99th percentile of all AWS hosts over all hours in the current month(s) for all organizations.

aws_lambda_func_count

int64

Shows the average of the number of functions that executed 1 or more times each hour in the current month(s) for all organizations.

aws_lambda_invocations_sum

int64

Shows the sum of all AWS Lambda invocations over all hours in the current month(s) for all organizations.

azure_app_service_top99p_sum

int64

Shows the 99th percentile of all Azure app services over all hours in the current month(s) for all organizations.

azure_host_top99p_sum

int64

Shows the 99th percentile of all Azure hosts over all hours in the current month(s) for all organizations.

billable_ingested_bytes_agg_sum

int64

Shows the sum of all log bytes ingested over all hours in the current month(s) for all organizations.

container_avg_sum

int64

Shows the average of all distinct containers over all hours in the current month(s) for all organizations.

container_hwm_sum

int64

Shows the high watermark of all distinct containers over all hours in the current month(s) for all organizations.

custom_ts_sum

int64

Shows the average number of distinct custom metrics over all hours in the current month(s) for all organizations.

end_date

date-time

Shows the last date of usage in the current month(s) for all organizations.

fargate_tasks_count_avg_sum

int64

Shows the average of all Fargate tasks over all hours in the current month(s) for all organizations.

fargate_tasks_count_hwm_sum

int64

Shows the high watermark of all Fargate tasks over all hours in the current month(s) for all organizations.

gcp_host_top99p_sum

int64

Shows the 99th percentile of all GCP hosts over all hours in the current month(s) for all organizations.

indexed_events_count_agg_sum

int64

Shows the sum of all log events indexed over all hours in the current month(s) for all organizations.

infra_host_top99p_sum

int64

Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current month(s) for all organizations.

ingested_events_bytes_agg_sum

int64

Shows the sum of all log bytes ingested over all hours in the current month(s) for all organizations.

last_updated

date-time

Shows the the most recent hour in the current month(s) for all organizations for which all usages were calculated.

mobile_rum_session_count_agg_sum

int64

Shows the sum of all mobile RUM Sessions over all hours in the current month(s) for all organizations.

netflow_indexed_events_count_agg_sum

int64

Shows the sum of all Network flows indexed over all hours in the current month(s) for all organizations.

npm_host_top99p_sum

int64

Shows the 99th percentile of all distinct Networks hosts over all hours in the current month(s) for all organizations.

profiling_container_agent_count_avg

int64

Shows the average number of profiled containers over all hours in the current month(s) for all organizations.

profiling_host_count_top99p_sum

int64

Shows the 99th percentile of all profiled hosts over all hours in the current month(s) for all organizations.

rum_session_count_agg_sum

int64

Shows the sum of all browser RUM Sessions over all hours in the current month(s) for all organizations.

start_date

date-time

Shows the first date of usage in the current month(s) for all organizations.

synthetics_browser_check_calls_count_agg_sum

int64

Shows the sum of all Synthetic browser tests over all hours in the current month(s) for all organizations.

synthetics_check_calls_count_agg_sum

int64

Shows the sum of all Synthetic API tests over all hours in the current month(s) for all organizations.

trace_search_indexed_events_count_agg_sum

int64

Shows the sum of all Indexed Spans indexed over all hours in the current month(s) for all organizations.

twol_ingested_events_bytes_agg_sum

int64

Shows the sum of all tracing without limits bytes ingested over all hours in the current month(s) for all organizations.

usage

[object]

An array of objects regarding hourly usage.

agent_host_top99p

int64

Shows the 99th percentile of all agent hosts over all hours in the current date for all organizations.

apm_host_top99p

int64

Shows the 99th percentile of all distinct APM hosts over all hours in the current date for all organizations.

aws_host_top99p

int64

Shows the 99th percentile of all AWS hosts over all hours in the current date for all organizations.

aws_lambda_func_count

int64

Shows the average of the number of functions that executed 1 or more times each hour in the current date for all organizations.

aws_lambda_invocations_sum

int64

Shows the sum of all AWS Lambda invocations over all hours in the current date for all organizations.

azure_app_service_top99p

int64

Shows the 99th percentile of all Azure app services over all hours in the current date for all organizations.

billable_ingested_bytes_sum

int64

Shows the sum of all log bytes ingested over all hours in the current date for all organizations.

container_avg

int64

Shows the average of all distinct containers over all hours in the current date for all organizations.

container_hwm

int64

Shows the high watermark of all distinct containers over all hours in the current date for all organizations.

custom_ts_avg

int64

Shows the average number of distinct custom metrics over all hours in the current date for all organizations.

date

date-time

The date for the usage.

fargate_tasks_count_avg

int64

Shows the high watermark of all Fargate tasks over all hours in the current date for all organizations.

fargate_tasks_count_hwm

int64

Shows the average of all Fargate tasks over all hours in the current date for all organizations.

gcp_host_top99p

int64

Shows the 99th percentile of all GCP hosts over all hours in the current date for all organizations.

indexed_events_count_sum

int64

Shows the sum of all log events indexed over all hours in the current date for all organizations.

infra_host_top99p

int64

Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for all organizations.

ingested_events_bytes_sum

int64

Shows the sum of all log bytes ingested over all hours in the current date for all organizations.

mobile_rum_session_count_sum

int64

Shows the sum of all mobile RUM Sessions over all hours in the current date for all organizations

netflow_indexed_events_count_sum

int64

Shows the sum of all Network flows indexed over all hours in the current date for all organizations.

npm_host_top99p

int64

Shows the 99th percentile of all distinct Networks hosts over all hours in the current date for all organizations.

orgs

[object]

Organizations associated with a user.

agent_host_top99p

int64

Shows the 99th percentile of all agent hosts over all hours in the current date for the given org.

apm_host_top99p

int64

Shows the 99th percentile of all distinct APM hosts over all hours in the current date for the given org.

aws_host_top99p

int64

Shows the 99th percentile of all AWS hosts over all hours in the current date for the given org.

aws_lambda_func_count

int64

Shows the sum of all AWS Lambda invocations over all hours in the current date for the given org.

aws_lambda_invocations_sum

int64

Shows the sum of all AWS Lambda invocations over all hours in the current date for the given org.

billable_ingested_bytes_sum

int64

Shows the sum of all log bytes ingested over all hours in the current date for the given org.

container_avg

int64

Shows the average of all distinct containers over all hours in the current date for the given org.

container_hwm

int64

Shows the high watermark of all distinct containers over all hours in the current date for the given org.

custom_ts_avg

int64

Shows the average number of distinct custom metrics over all hours in the current date for the given org.

fargate_tasks_count_avg

int64

The average task count for Fargate.

fargate_tasks_count_hwm

int64

Shows the high watermark of all Fargate tasks over all hours in the current date for the given org.

gcp_host_top99p

int64

Shows the 99th percentile of all GCP hosts over all hours in the current date for the given org.

id

string

The organization id.

indexed_events_count_sum

int64

Shows the sum of all log events indexed over all hours in the current date for the given org.

infra_host_top99p

int64

Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for the given org.

ingested_events_bytes_sum

int64

Shows the sum of all log bytes ingested over all hours in the current date for the given org.

mobile_rum_session_count_sum

int64

Shows the sum of all mobile RUM Sessions over all hours in the current date for the given org.

name

string

The organization name.

netflow_indexed_events_count_sum

int64

Shows the sum of all Network flows indexed over all hours in the current date for the given org.

npm_host_top99p

int64

Shows the 99th percentile of all distinct Networks hosts over all hours in the current date for the given org.

profiling_host_top99p

int64

Shows the 99th percentile of all profiled hosts over all hours in the current date for the given org.

public_id

string

The organization public id.

rum_session_count_sum

int64

Shows the sum of all browser RUM Sessions over all hours in the current date for the given org.

synthetics_browser_check_calls_count_sum

int64

Shows the sum of all Synthetic browser tests over all hours in the current date for the given org.

synthetics_check_calls_count_sum

int64

Shows the sum of all Synthetic API tests over all hours in the current date for the given org.

trace_search_indexed_events_count_sum

int64

Shows the sum of all Indexed Spans indexed over all hours in the current date for the given org.

twol_ingested_events_bytes_sum

int64

Shows the sum of all tracing without limits bytes ingested over all hours in the current date for the given org.

profiling_host_top99p

int64

Shows the 99th percentile of all profiled hosts over all hours in the current date for all organizations.

rum_session_count_sum

int64

Shows the sum of all browser RUM Sessions over all hours in the current date for all organizations

synthetics_browser_check_calls_count_sum

int64

Shows the sum of all Synthetic browser tests over all hours in the current date for all organizations.

synthetics_check_calls_count_sum

int64

Shows the sum of all Synthetic API tests over all hours in the current date for all organizations.

trace_search_indexed_events_count_sum

int64

Shows the sum of all Indexed Spans indexed over all hours in the current date for all organizations.

twol_ingested_events_bytes_sum

int64

Shows the sum of all tracing without limits bytes ingested over all hours in the current date for all organizations.

{
  "agent_host_top99p_sum": "integer",
  "apm_host_top99p_sum": "integer",
  "aws_host_top99p_sum": "integer",
  "aws_lambda_func_count": "integer",
  "aws_lambda_invocations_sum": "integer",
  "azure_app_service_top99p_sum": "integer",
  "azure_host_top99p_sum": "integer",
  "billable_ingested_bytes_agg_sum": "integer",
  "container_avg_sum": "integer",
  "container_hwm_sum": "integer",
  "custom_ts_sum": "integer",
  "end_date": "2019-09-19T10:00:00.000Z",
  "fargate_tasks_count_avg_sum": "integer",
  "fargate_tasks_count_hwm_sum": "integer",
  "gcp_host_top99p_sum": "integer",
  "indexed_events_count_agg_sum": "integer",
  "infra_host_top99p_sum": "integer",
  "ingested_events_bytes_agg_sum": "integer",
  "last_updated": "2019-09-19T10:00:00.000Z",
  "mobile_rum_session_count_agg_sum": "integer",
  "netflow_indexed_events_count_agg_sum": "integer",
  "npm_host_top99p_sum": "integer",
  "profiling_container_agent_count_avg": "integer",
  "profiling_host_count_top99p_sum": "integer",
  "rum_session_count_agg_sum": "integer",
  "start_date": "2019-09-19T10:00:00.000Z",
  "synthetics_browser_check_calls_count_agg_sum": "integer",
  "synthetics_check_calls_count_agg_sum": "integer",
  "trace_search_indexed_events_count_agg_sum": "integer",
  "twol_ingested_events_bytes_agg_sum": "integer",
  "usage": [
    {
      "agent_host_top99p": "integer",
      "apm_host_top99p": "integer",
      "aws_host_top99p": "integer",
      "aws_lambda_func_count": "integer",
      "aws_lambda_invocations_sum": "integer",
      "azure_app_service_top99p": "integer",
      "billable_ingested_bytes_sum": "integer",
      "container_avg": "integer",
      "container_hwm": "integer",
      "custom_ts_avg": "integer",
      "date": "2019-09-19T10:00:00.000Z",
      "fargate_tasks_count_avg": "integer",
      "fargate_tasks_count_hwm": "integer",
      "gcp_host_top99p": "integer",
      "indexed_events_count_sum": "integer",
      "infra_host_top99p": "integer",
      "ingested_events_bytes_sum": "integer",
      "mobile_rum_session_count_sum": "integer",
      "netflow_indexed_events_count_sum": "integer",
      "npm_host_top99p": "integer",
      "orgs": [
        {
          "agent_host_top99p": "integer",
          "apm_host_top99p": "integer",
          "aws_host_top99p": "integer",
          "aws_lambda_func_count": "integer",
          "aws_lambda_invocations_sum": "integer",
          "billable_ingested_bytes_sum": "integer",
          "container_avg": "integer",
          "container_hwm": "integer",
          "custom_ts_avg": "integer",
          "fargate_tasks_count_avg": "integer",
          "fargate_tasks_count_hwm": "integer",
          "gcp_host_top99p": "integer",
          "id": "string",
          "indexed_events_count_sum": "integer",
          "infra_host_top99p": "integer",
          "ingested_events_bytes_sum": "integer",
          "mobile_rum_session_count_sum": "integer",
          "name": "string",
          "netflow_indexed_events_count_sum": "integer",
          "npm_host_top99p": "integer",
          "profiling_host_top99p": "integer",
          "public_id": "string",
          "rum_session_count_sum": "integer",
          "synthetics_browser_check_calls_count_sum": "integer",
          "synthetics_check_calls_count_sum": "integer",
          "trace_search_indexed_events_count_sum": "integer",
          "twol_ingested_events_bytes_sum": "integer"
        }
      ],
      "profiling_host_top99p": "integer",
      "rum_session_count_sum": "integer",
      "synthetics_browser_check_calls_count_sum": "integer",
      "synthetics_check_calls_count_sum": "integer",
      "trace_search_indexed_events_count_sum": "integer",
      "twol_ingested_events_bytes_sum": "integer"
    }
  ]
}

Bad Request

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden - User is not authorized

Error response object.

Expand All

Champ

Type

Description

errors [required]

[string]

Array of errors returned by the API.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


                                        # Required query arguments
export start_month="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.com"https://api.datadoghq.eu/api/v1/usage/summary?start_month=${start_month}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)

func main() {
    ctx := context.WithValue(
        context.Background(),
        datadog.ContextAPIKeys,
        map[string]datadog.APIKey{
            "apiKeyAuth": {
                Key: os.Getenv("DD_CLIENT_API_KEY"),
            },
            "appKeyAuth": {
                Key: os.Getenv("DD_CLIENT_APP_KEY"),
            },
        },
    )

    startMonth := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago.
    endMonth := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month. (optional)
    includeOrgDetails := true // bool | Include usage summaries for each sub-org. (optional)

    configuration := datadog.NewConfiguration()
    api_client := datadog.NewAPIClient(configuration)
    resp, r, err := api_client.UsageMeteringApi.GetUsageSummary(context.Background()).StartMonth(startMonth).EndMonth(endMonth).IncludeOrgDetails(includeOrgDetails).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageSummary``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetUsageSummary`: UsageSummaryResponse
    fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageSummary`: %v\n", resp)
}
// Import classes:
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.UsageMeteringApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        // Configure the Datadog site to send API calls to
        HashMap<String, String> serverVariables = new HashMap<String, String>();
        String site = System.getenv("DD_SITE");
        if (site != null) {
            serverVariables.put("site", site);
            defaultClient.setServerVariables(serverVariables);
        }
        // Configure API key authorization: 
        HashMap<String, String> secrets = new HashMap<String, String>();
        secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
        secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
        defaultClient.configureApiKeys(secrets);

        UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient);
        OffsetDateTime startMonth = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago.
        OffsetDateTime endMonth = new OffsetDateTime(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month.
        Boolean includeOrgDetails = true; // Boolean | Include usage summaries for each sub-org.
        try {
            UsageSummaryResponse result = api.getUsageSummary()
                .startMonth(startMonth)
                .endMonth(endMonth)
                .includeOrgDetails(includeOrgDetails)
                .execute();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling UsageMeteringApi#getUsageSummary");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}