이 페이지는 아직 영어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Spans Metrics

Manage configuration of span-based metrics for your organization. See Generate Metrics from Spans for more information.

GET https://api.ap1.datadoghq.com/api/v2/apm/config/metricshttps://api.datadoghq.eu/api/v2/apm/config/metricshttps://api.ddog-gov.com/api/v2/apm/config/metricshttps://api.datadoghq.com/api/v2/apm/config/metricshttps://api.us3.datadoghq.com/api/v2/apm/config/metricshttps://api.us5.datadoghq.com/api/v2/apm/config/metrics

개요

Get the list of configured span-based metrics with their definitions. This endpoint requires the apm_read permission.

응답

OK

All the available span-based metric objects.

Expand All

항목

유형

설명

data

[object]

A list of span-based metric objects.

attributes

object

The object describing a Datadog span-based metric.

compute

object

The compute rule to compute the span-based metric.

aggregation_type

enum

The type of aggregation to use. Allowed enum values: count,distribution

include_percentiles

boolean

Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.

path

string

The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution").

filter

object

The span-based metric filter. Spans matching this filter will be aggregated in this metric.

query

string

The search query - following the span search syntax.

group_by

[object]

The rules for the group by.

path

string

The path to the value the span-based metric will be aggregated over.

tag_name

string

Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.

id

string

The name of the span-based metric.

type

enum

The type of resource. The value should always be spans_metrics. Allowed enum values: spans_metrics

default: spans_metrics

{
  "data": [
    {
      "attributes": {
        "compute": {
          "aggregation_type": "distribution",
          "include_percentiles": false,
          "path": "@duration"
        },
        "filter": {
          "query": "@http.status_code:200 service:my-service"
        },
        "group_by": [
          {
            "path": "resource_name",
            "tag_name": "resource_name"
          }
        ]
      },
      "id": "my.metric",
      "type": "spans_metrics"
    }
  ]
}

Not Authorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

"""
Get all span-based metrics returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SpansMetricsApi(api_client)
    response = api_instance.list_spans_metrics()

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

POST https://api.ap1.datadoghq.com/api/v2/apm/config/metricshttps://api.datadoghq.eu/api/v2/apm/config/metricshttps://api.ddog-gov.com/api/v2/apm/config/metricshttps://api.datadoghq.com/api/v2/apm/config/metricshttps://api.us3.datadoghq.com/api/v2/apm/config/metricshttps://api.us5.datadoghq.com/api/v2/apm/config/metrics

개요

Create a metric based on your ingested spans in your organization. Returns the span-based metric object from the request body when the request is successful. This endpoint requires the apm_generate_metrics permission.

요청

Body Data (required)

The definition of the new span-based metric.

Expand All

항목

유형

설명

data [required]

object

The new span-based metric properties.

attributes [required]

object

The object describing the Datadog span-based metric to create.

compute [required]

object

The compute rule to compute the span-based metric.

aggregation_type [required]

enum

The type of aggregation to use. Allowed enum values: count,distribution

include_percentiles

boolean

Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.

path

string

The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution").

filter

object

The span-based metric filter. Spans matching this filter will be aggregated in this metric.

query

string

The search query - following the span search syntax.

default: *

group_by

[object]

The rules for the group by.

path [required]

string

The path to the value the span-based metric will be aggregated over.

tag_name

string

Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.

id [required]

string

The name of the span-based metric.

type [required]

enum

The type of resource. The value should always be spans_metrics. Allowed enum values: spans_metrics

default: spans_metrics

{
  "data": {
    "attributes": {
      "compute": {
        "aggregation_type": "distribution",
        "include_percentiles": false,
        "path": "@duration"
      },
      "filter": {
        "query": "@http.status_code:200 service:my-service"
      },
      "group_by": [
        {
          "path": "resource_name",
          "tag_name": "resource_name"
        }
      ]
    },
    "id": "ExampleSpansMetric",
    "type": "spans_metrics"
  }
}

응답

OK

The span-based metric object.

Expand All

항목

유형

설명

data

object

The span-based metric properties.

attributes

object

The object describing a Datadog span-based metric.

compute

object

The compute rule to compute the span-based metric.

aggregation_type

enum

The type of aggregation to use. Allowed enum values: count,distribution

include_percentiles

boolean

Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.

path

string

The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution").

filter

object

The span-based metric filter. Spans matching this filter will be aggregated in this metric.

query

string

The search query - following the span search syntax.

group_by

[object]

The rules for the group by.

path

string

The path to the value the span-based metric will be aggregated over.

tag_name

string

Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.

id

string

The name of the span-based metric.

type

enum

The type of resource. The value should always be spans_metrics. Allowed enum values: spans_metrics

default: spans_metrics

{
  "data": {
    "attributes": {
      "compute": {
        "aggregation_type": "distribution",
        "include_percentiles": false,
        "path": "@duration"
      },
      "filter": {
        "query": "@http.status_code:200 service:my-service"
      },
      "group_by": [
        {
          "path": "resource_name",
          "tag_name": "resource_name"
        }
      ]
    },
    "id": "my.metric",
    "type": "spans_metrics"
  }
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Authorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Conflict

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

"""
Create a span-based metric returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi
from datadog_api_client.v2.model.spans_metric_compute import SpansMetricCompute
from datadog_api_client.v2.model.spans_metric_compute_aggregation_type import SpansMetricComputeAggregationType
from datadog_api_client.v2.model.spans_metric_create_attributes import SpansMetricCreateAttributes
from datadog_api_client.v2.model.spans_metric_create_data import SpansMetricCreateData
from datadog_api_client.v2.model.spans_metric_create_request import SpansMetricCreateRequest
from datadog_api_client.v2.model.spans_metric_filter import SpansMetricFilter
from datadog_api_client.v2.model.spans_metric_group_by import SpansMetricGroupBy
from datadog_api_client.v2.model.spans_metric_type import SpansMetricType

body = SpansMetricCreateRequest(
    data=SpansMetricCreateData(
        attributes=SpansMetricCreateAttributes(
            compute=SpansMetricCompute(
                aggregation_type=SpansMetricComputeAggregationType.DISTRIBUTION,
                include_percentiles=False,
                path="@duration",
            ),
            filter=SpansMetricFilter(
                query="@http.status_code:200 service:my-service",
            ),
            group_by=[
                SpansMetricGroupBy(
                    path="resource_name",
                    tag_name="resource_name",
                ),
            ],
        ),
        id="ExampleSpansMetric",
        type=SpansMetricType.SPANS_METRICS,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SpansMetricsApi(api_client)
    response = api_instance.create_spans_metric(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

GET https://api.ap1.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.datadoghq.eu/api/v2/apm/config/metrics/{metric_id}https://api.ddog-gov.com/api/v2/apm/config/metrics/{metric_id}https://api.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.us3.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.us5.datadoghq.com/api/v2/apm/config/metrics/{metric_id}

개요

Get a specific span-based metric from your organization. This endpoint requires the apm_read permission.

인수

경로 파라미터

이름

유형

설명

metric_id [required]

string

The name of the span-based metric.

응답

OK

The span-based metric object.

Expand All

항목

유형

설명

data

object

The span-based metric properties.

attributes

object

The object describing a Datadog span-based metric.

compute

object

The compute rule to compute the span-based metric.

aggregation_type

enum

The type of aggregation to use. Allowed enum values: count,distribution

include_percentiles

boolean

Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.

path

string

The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution").

filter

object

The span-based metric filter. Spans matching this filter will be aggregated in this metric.

query

string

The search query - following the span search syntax.

group_by

[object]

The rules for the group by.

path

string

The path to the value the span-based metric will be aggregated over.

tag_name

string

Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.

id

string

The name of the span-based metric.

type

enum

The type of resource. The value should always be spans_metrics. Allowed enum values: spans_metrics

default: spans_metrics

{
  "data": {
    "attributes": {
      "compute": {
        "aggregation_type": "distribution",
        "include_percentiles": false,
        "path": "@duration"
      },
      "filter": {
        "query": "@http.status_code:200 service:my-service"
      },
      "group_by": [
        {
          "path": "resource_name",
          "tag_name": "resource_name"
        }
      ]
    },
    "id": "my.metric",
    "type": "spans_metrics"
  }
}

Not Authorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

"""
Get a span-based metric returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi

# there is a valid "spans_metric" in the system
SPANS_METRIC_DATA_ID = environ["SPANS_METRIC_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SpansMetricsApi(api_client)
    response = api_instance.get_spans_metric(
        metric_id=SPANS_METRIC_DATA_ID,
    )

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

PATCH https://api.ap1.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.datadoghq.eu/api/v2/apm/config/metrics/{metric_id}https://api.ddog-gov.com/api/v2/apm/config/metrics/{metric_id}https://api.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.us3.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.us5.datadoghq.com/api/v2/apm/config/metrics/{metric_id}

개요

Update a specific span-based metric from your organization. Returns the span-based metric object from the request body when the request is successful. This endpoint requires the apm_generate_metrics permission.

인수

경로 파라미터

이름

유형

설명

metric_id [required]

string

The name of the span-based metric.

요청

Body Data (required)

New definition of the span-based metric.

Expand All

항목

유형

설명

data [required]

object

The new span-based metric properties.

attributes [required]

object

The span-based metric properties that will be updated.

compute

object

The compute rule to compute the span-based metric.

include_percentiles

boolean

Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.

filter

object

The span-based metric filter. Spans matching this filter will be aggregated in this metric.

query

string

The search query - following the span search syntax.

default: *

group_by

[object]

The rules for the group by.

path [required]

string

The path to the value the span-based metric will be aggregated over.

tag_name

string

Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.

type [required]

enum

The type of resource. The value should always be spans_metrics. Allowed enum values: spans_metrics

default: spans_metrics

{
  "data": {
    "attributes": {
      "compute": {
        "include_percentiles": false
      },
      "filter": {
        "query": "@http.status_code:200 service:my-service-updated"
      },
      "group_by": [
        {
          "path": "resource_name",
          "tag_name": "resource_name"
        }
      ]
    },
    "type": "spans_metrics"
  }
}

응답

OK

The span-based metric object.

Expand All

항목

유형

설명

data

object

The span-based metric properties.

attributes

object

The object describing a Datadog span-based metric.

compute

object

The compute rule to compute the span-based metric.

aggregation_type

enum

The type of aggregation to use. Allowed enum values: count,distribution

include_percentiles

boolean

Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the aggregation_type is distribution.

path

string

The path to the value the span-based metric will aggregate on (only used if the aggregation type is a "distribution").

filter

object

The span-based metric filter. Spans matching this filter will be aggregated in this metric.

query

string

The search query - following the span search syntax.

group_by

[object]

The rules for the group by.

path

string

The path to the value the span-based metric will be aggregated over.

tag_name

string

Eventual name of the tag that gets created. By default, the path attribute is used as the tag name.

id

string

The name of the span-based metric.

type

enum

The type of resource. The value should always be spans_metrics. Allowed enum values: spans_metrics

default: spans_metrics

{
  "data": {
    "attributes": {
      "compute": {
        "aggregation_type": "distribution",
        "include_percentiles": false,
        "path": "@duration"
      },
      "filter": {
        "query": "@http.status_code:200 service:my-service"
      },
      "group_by": [
        {
          "path": "resource_name",
          "tag_name": "resource_name"
        }
      ]
    },
    "id": "my.metric",
    "type": "spans_metrics"
  }
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Authorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

"""
Update a span-based metric returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi
from datadog_api_client.v2.model.spans_metric_filter import SpansMetricFilter
from datadog_api_client.v2.model.spans_metric_group_by import SpansMetricGroupBy
from datadog_api_client.v2.model.spans_metric_type import SpansMetricType
from datadog_api_client.v2.model.spans_metric_update_attributes import SpansMetricUpdateAttributes
from datadog_api_client.v2.model.spans_metric_update_compute import SpansMetricUpdateCompute
from datadog_api_client.v2.model.spans_metric_update_data import SpansMetricUpdateData
from datadog_api_client.v2.model.spans_metric_update_request import SpansMetricUpdateRequest

# there is a valid "spans_metric" in the system
SPANS_METRIC_DATA_ATTRIBUTES_FILTER_QUERY = environ["SPANS_METRIC_DATA_ATTRIBUTES_FILTER_QUERY"]
SPANS_METRIC_DATA_ID = environ["SPANS_METRIC_DATA_ID"]

body = SpansMetricUpdateRequest(
    data=SpansMetricUpdateData(
        attributes=SpansMetricUpdateAttributes(
            compute=SpansMetricUpdateCompute(
                include_percentiles=False,
            ),
            filter=SpansMetricFilter(
                query="@http.status_code:200 service:my-service-updated",
            ),
            group_by=[
                SpansMetricGroupBy(
                    path="resource_name",
                    tag_name="resource_name",
                ),
            ],
        ),
        type=SpansMetricType.SPANS_METRICS,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SpansMetricsApi(api_client)
    response = api_instance.update_spans_metric(metric_id=SPANS_METRIC_DATA_ID, body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"

DELETE https://api.ap1.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.datadoghq.eu/api/v2/apm/config/metrics/{metric_id}https://api.ddog-gov.com/api/v2/apm/config/metrics/{metric_id}https://api.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.us3.datadoghq.com/api/v2/apm/config/metrics/{metric_id}https://api.us5.datadoghq.com/api/v2/apm/config/metrics/{metric_id}

개요

Delete a specific span-based metric from your organization. This endpoint requires the apm_generate_metrics permission.

인수

경로 파라미터

이름

유형

설명

metric_id [required]

string

The name of the span-based metric.

응답

OK

Not Authorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

코드 사례

"""
Delete a span-based metric returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.spans_metrics_api import SpansMetricsApi

# there is a valid "spans_metric" in the system
SPANS_METRIC_DATA_ID = environ["SPANS_METRIC_DATA_ID"]

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SpansMetricsApi(api_client)
    api_instance.delete_spans_metric(
        metric_id=SPANS_METRIC_DATA_ID,
    )

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"