Metrics

Query Metrics

Post a query to the endpoint to retrieve aggregated metrics down to the minute. Data can be requested to group by any 2 dimensions, and any number of filter conditions.

post

Body

application/json

MetricsV2Dto

A query to launch at the API

metricsarray[string]required

List of aggregated metrics to collect across the requested time span. If no metrics are specified, request_count will be computed by default.

Allowed values:kong_latency_averagekong_latency_p50kong_latency_p95kong_latency_p99request_countrequest_per_minuterequest_size_averagerequest_size_p50request_size_p95request_size_p99request_size_sumresponse_latency_averageresponse_latency_p50response_latency_p95response_latency_p99response_size_averageresponse_size_p50response_size_p95response_size_p99response_size_sumupstream_latency_averageupstream_latency_p50upstream_latency_p95upstream_latency_p99

Default:request_count

<= 3 items

dimensionsarray[string]

List of attributes or entity types to group by.

Allowed values:apiapi_packageapi_productapi_product_versionapplicationconsumercontrol_planecontrol_plane_groupcountry_codedata_plane_nodedata_plane_node_versiongateway_serviceportalresponse_sourceroutestatus_codestatus_code_groupedtimeupstream_status_codeupstream_status_code_grouped

<= 2 items

Example:["status_code_grouped"]

filtersOne Of
array

A list of filters to apply to the query.

Filter by apiOne Of
Multiselect filtersobject
Show Child Parameters
granularitystring

Force time grouping into buckets of the specified duration. Only has an effect if “time” is in the “dimensions” list.

The granularity of the result may be coarser than requested. The finest allowed granularity depends on the query’s time range: data farther in the past may have coarser granularity. The exact result granularity will be reported in the response meta.granularity_ms field.

If granularity is not specified and “time” is in the dimensions list, a default will be chosen based on the time range requested.

Different relative times support different granularities:

  • 15m => tenSecondly, thirtySecondly, minutely
  • 1h => tenSecondly, thirtySecondly, minutely, fiveMinutely, tenMinutely
  • 6h => thirtySecondly, minutely, fiveMinutely, tenMinutely, thirtyMinutely, hourly
  • 12h => minutely, fiveMinutely, tenMinutely, thirtyMinutely, hourly
  • 24h => fiveMinutely, tenMinutely, thirtyMinutely, hourly
  • 7d => thirtyMinutely, hourly, twoHourly, twelveHourly, daily
  • 30d => hourly, twoHourly, twelveHourly, daily, weekly

For special time ranges:

  • current_week, previous_week => thirtyMinutely, hourly, twoHourly, twelveHourly, daily
  • current_month, previous_month => hourly, twoHourly, twelveHourly, daily, weekly

For absolute time ranges, daily will be used.

Allowed values:tenSecondlythirtySecondlyminutelyfiveMinutelytenMinutelythirtyMinutelyhourlytwoHourlytwelveHourlydailyweekly

time_rangeOne Of

The time range to query.

Default:{"type":"relative","time_range":"1h"}

Relative time rangeobject

A duration representing a relative-to-now span of time. Generally the start time is floored to the requested granularity. Eg 7d from now, with 1day granularity initiated at 2024-01-08T17:11:00+05:00 will query for the time range from 2024-01-01T00:00:00+05:00 to 2024-01-08T17:11:00+05:00. The exact start and end timestamps are returned in the result query in the meta.start and meta.end fields. If the granularity for the previous query was 1hour, it would query a time range from 2024-01-01T17:00:00+05:00 to 2024-01-08T17:11:00+05:00.

Show Child Parameters
limitnumber

Limits the number of distinct metric groups to return.

Default:50

<= 1000

Response

application/json

Aggregated results of the query

MetricsResultV2

The result of a metrics query. Contains the data and metadata about the query.

dataarray[object]requiredread-only

A result with metrics grouped by the dimensions specified in the query, at a particular time

The example represents a result group that has a summed request_count, and response_latency_p99 for a gateway_service at 2024-01-16T00:00:00Z.

Example:{"event":{"gateway_service":"d5ac5d88-efed-4e10-9dfe-0b0a6646c219:bf16907c-8673-4f9d-aa83-1f2ea9215055","request_count":1000,"response_latency_p99":23},"timestamp":"2024-01-16T00:00:00Z"}

Show Child Parameters
metaobjectrequiredread-only

Metadata about the query response. This includes the start and end times of the query, the granularity of the result, whether the result was truncated, the limit of the result, and the query_id.

Example:{"start":"2024-01-16T18:00:00.000Z","end":"2024-01-16T18:16:40.000Z","display":{"gateway_service":{"d5ac5d88-efed-4e10-9dfe-0b0a6646c219:bf16907c-8673-4f9d-aa83-111111111111":{"id":"d5ac5d88-efed-4e10-9dfe-0b0a6646c219:bf16907c-8673-4f9d-aa83-111111111111","deleted":true,"name":"Gateway Service Alpha"},"d5ac5d88-efed-4e10-9dfe-0b0a6646c219:bf16907c-8673-4f9d-aa83-1f2ea9215055":{"id":"d5ac5d88-efed-4e10-9dfe-0b0a6646c219:bf16907c-8673-4f9d-aa83-1f2ea9215055","deleted":false,"name":"Gateway Service Beta"}}},"metric_units":{"request_count":"count","response_latency_p99":"ms"},"granularity_ms":60000,"truncated":false,"limit":50,"query_id":"requested-query-id"}

Show Child Parameters
post/metrics

Body

{ "time_range": { "type": "relative", "time_range": "24h", "tz": "EST" }, "dimensions": [ "time", "gateway_service" ], "filters": [ { "operator": "in", "field": "control_plane", "value": [ "d5ac5d88-efed-4e10-9dfe-0b0a6646c219" ] } ], "granularity": "hourly", "metrics": [ "request_count", "response_latency_p99" ] }
 
application/json

MetricsV2Dto

object

A query to launch at the API

metricsarray[string]required

List of aggregated metrics to collect across the requested time span. If no metrics are specified, request_count will be computed by default.

Allowed values:kong_latency_averagekong_latency_p50kong_latency_p95kong_latency_p99request_countrequest_per_minuterequest_size_averagerequest_size_p50request_size_p95request_size_p99request_size_sumresponse_latency_averageresponse_latency_p50response_latency_p95response_latency_p99response_size_averageresponse_size_p50response_size_p95response_size_p99response_size_sumupstream_latency_averageupstream_latency_p50upstream_latency_p95upstream_latency_p99

Default:request_count

<= 3 items

dimensionsarray[string]

List of attributes or entity types to group by.

Allowed values:apiapi_packageapi_productapi_product_versionapplicationconsumercontrol_planecontrol_plane_groupcountry_codedata_plane_nodedata_plane_node_versiongateway_serviceportalresponse_sourceroutestatus_codestatus_code_groupedtimeupstream_status_codeupstream_status_code_grouped

<= 2 items

Example:status_code_grouped

filtersOne Of
array

A list of filters to apply to the query.

Filter by apiOne Of
Multiselect filtersobject
Show Child Parameters
granularitystring

Force time grouping into buckets of the specified duration. Only has an effect if “time” is in the “dimensions” list.

The granularity of the result may be coarser than requested. The finest allowed granularity depends on the query’s time range: data farther in the past may have coarser granularity. The exact result granularity will be reported in the response meta.granularity_ms field.

If granularity is not specified and “time” is in the dimensions list, a default will be chosen based on the time range requested.

Different relative times support different granularities:

  • 15m => tenSecondly, thirtySecondly, minutely
  • 1h => tenSecondly, thirtySecondly, minutely, fiveMinutely, tenMinutely
  • 6h => thirtySecondly, minutely, fiveMinutely, tenMinutely, thirtyMinutely, hourly
  • 12h => minutely, fiveMinutely, tenMinutely, thirtyMinutely, hourly
  • 24h => fiveMinutely, tenMinutely, thirtyMinutely, hourly
  • 7d => thirtyMinutely, hourly, twoHourly, twelveHourly, daily
  • 30d => hourly, twoHourly, twelveHourly, daily, weekly

For special time ranges:

  • current_week, previous_week => thirtyMinutely, hourly, twoHourly, twelveHourly, daily
  • current_month, previous_month => hourly, twoHourly, twelveHourly, daily, weekly

For absolute time ranges, daily will be used.

Allowed values:tenSecondlythirtySecondlyminutelyfiveMinutelytenMinutelythirtyMinutelyhourlytwoHourlytwelveHourlydailyweekly

time_rangeOne Of

The time range to query.

Default:{"type":"relative","time_range":"1h"}

Relative time rangeobject

A duration representing a relative-to-now span of time. Generally the start time is floored to the requested granularity. Eg 7d from now, with 1day granularity initiated at 2024-01-08T17:11:00+05:00 will query for the time range from 2024-01-01T00:00:00+05:00 to 2024-01-08T17:11:00+05:00. The exact start and end timestamps are returned in the result query in the meta.start and meta.end fields. If the granularity for the previous query was 1hour, it would query a time range from 2024-01-01T17:00:00+05:00 to 2024-01-08T17:11:00+05:00.

Show Child Parameters
limitnumber

Limits the number of distinct metric groups to return.

Default:50

<= 1000

Example

MetricsResult

object

A result with metrics grouped by the dimensions specified in the query, at a particular time

The example represents a result group that has a summed request_count, and response_latency_p99 for a gateway_service at 2024-01-16T00:00:00Z.

timestampstringrequiredread-only
eventobjectrequiredread-only
Example

DisplayEntry

object
idstringrequired
namestringrequired
deletedboolean
is_other_groupboolean
Example