v1

latestOpenAPI 3.0.02026-07-141,4077,1665.2 MB
Spans Metrics

Create a span-based metric

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.

post/api/v2/apm/config/metrics

Request body

Example request

{
  "data": {
    "attributes": {
      "compute": {
        "aggregation_type": "distribution",
        "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"
  }
}

Response

OK

Example response

{
  "data": {
    "attributes": {
      "compute": {
        "aggregation_type": "distribution",
        "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"
  }
}