- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
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.
항목
유형
설명
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.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Get all span-based metrics returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_spans_metrics::SpansMetricsAPI;
#[tokio::main]
async fn main() {
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.list_spans_metrics().await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
First install the library and its dependencies and then save the example to src/main.rs
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>" cargo run
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.
The definition of the new span-based metric.
항목
유형
설명
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.
항목
유형
설명
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.
{
"errors": [
"Bad Request"
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Conflict
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Create a span-based metric returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_spans_metrics::SpansMetricsAPI;
use datadog_api_client::datadogV2::model::SpansMetricCompute;
use datadog_api_client::datadogV2::model::SpansMetricComputeAggregationType;
use datadog_api_client::datadogV2::model::SpansMetricCreateAttributes;
use datadog_api_client::datadogV2::model::SpansMetricCreateData;
use datadog_api_client::datadogV2::model::SpansMetricCreateRequest;
use datadog_api_client::datadogV2::model::SpansMetricFilter;
use datadog_api_client::datadogV2::model::SpansMetricGroupBy;
use datadog_api_client::datadogV2::model::SpansMetricType;
#[tokio::main]
async fn main() {
let body = SpansMetricCreateRequest::new(SpansMetricCreateData::new(
SpansMetricCreateAttributes::new(
SpansMetricCompute::new(SpansMetricComputeAggregationType::DISTRIBUTION)
.include_percentiles(false)
.path("@duration".to_string()),
)
.filter(
SpansMetricFilter::new().query("@http.status_code:200 service:my-service".to_string()),
)
.group_by(vec![SpansMetricGroupBy::new("resource_name".to_string())
.tag_name("resource_name".to_string())]),
"ExampleSpansMetric".to_string(),
SpansMetricType::SPANS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.create_spans_metric(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
First install the library and its dependencies and then save the example to src/main.rs
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>" cargo run
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.
항목
유형
설명
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.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Get a span-based metric returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_spans_metrics::SpansMetricsAPI;
#[tokio::main]
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.get_spans_metric(spans_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
First install the library and its dependencies and then save the example to src/main.rs
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>" cargo run
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.
New definition of the span-based metric.
항목
유형
설명
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.
항목
유형
설명
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.
{
"errors": [
"Bad Request"
]
}
Not Authorized
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Update a span-based metric returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_spans_metrics::SpansMetricsAPI;
use datadog_api_client::datadogV2::model::SpansMetricFilter;
use datadog_api_client::datadogV2::model::SpansMetricGroupBy;
use datadog_api_client::datadogV2::model::SpansMetricType;
use datadog_api_client::datadogV2::model::SpansMetricUpdateAttributes;
use datadog_api_client::datadogV2::model::SpansMetricUpdateCompute;
use datadog_api_client::datadogV2::model::SpansMetricUpdateData;
use datadog_api_client::datadogV2::model::SpansMetricUpdateRequest;
#[tokio::main]
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let body = SpansMetricUpdateRequest::new(SpansMetricUpdateData::new(
SpansMetricUpdateAttributes::new()
.compute(SpansMetricUpdateCompute::new().include_percentiles(false))
.filter(
SpansMetricFilter::new()
.query("@http.status_code:200 service:my-service-updated".to_string()),
)
.group_by(vec![SpansMetricGroupBy::new("resource_name".to_string())
.tag_name("resource_name".to_string())]),
SpansMetricType::SPANS_METRICS,
));
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api
.update_spans_metric(spans_metric_data_id.clone(), body)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
First install the library and its dependencies and then save the example to src/main.rs
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>" cargo run
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.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
Too many requests
API error response.
{
"errors": [
"Bad Request"
]
}
// Delete a span-based metric returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_spans_metrics::SpansMetricsAPI;
#[tokio::main]
async fn main() {
// there is a valid "spans_metric" in the system
let spans_metric_data_id = std::env::var("SPANS_METRIC_DATA_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = SpansMetricsAPI::with_config(configuration);
let resp = api.delete_spans_metric(spans_metric_data_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
First install the library and its dependencies and then save the example to src/main.rs
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>" cargo run