Skip to content

Commit 9ac8cd6

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
add docs for pagination in /api/v2/metrics endpoint (#2174)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent c1b9688 commit 9ac8cd6

14 files changed

+567
-5
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-12-11 20:35:43.977265",
8-
"spec_repo_commit": "7b62d196"
7+
"regenerated": "2024-12-12 13:29:31.187829",
8+
"spec_repo_commit": "f0c3c0f4"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-12-11 20:35:43.995051",
13-
"spec_repo_commit": "7b62d196"
12+
"regenerated": "2024-12-12 13:29:31.206413",
13+
"spec_repo_commit": "f0c3c0f4"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16012,6 +16012,36 @@ components:
1601216012
- COUNT
1601316013
- RATE
1601416014
- GAUGE
16015+
MetricMetaPage:
16016+
description: Paging attributes. Only present if pagination query parameters
16017+
were provided.
16018+
properties:
16019+
cursor:
16020+
description: The cursor used to get the current results, if any.
16021+
nullable: true
16022+
type: string
16023+
limit:
16024+
description: Number of results returned
16025+
format: int32
16026+
maximum: 20000
16027+
minimum: 0
16028+
type: integer
16029+
next_cursor:
16030+
description: The cursor used to get the next results, if any.
16031+
nullable: true
16032+
type: string
16033+
type:
16034+
$ref: '#/components/schemas/MetricMetaPageType'
16035+
type: object
16036+
MetricMetaPageType:
16037+
default: cursor_limit
16038+
description: Type of metric pagination.
16039+
enum:
16040+
- cursor_limit
16041+
example: cursor_limit
16042+
type: string
16043+
x-enum-varnames:
16044+
- CURSOR_LIMIT
1601516045
MetricMetadata:
1601616046
description: Metadata for the metric.
1601716047
properties:
@@ -16094,6 +16124,12 @@ components:
1609416124
maximum: 1000
1609516125
type: integer
1609616126
type: object
16127+
MetricPaginationMeta:
16128+
description: Response metadata object.
16129+
properties:
16130+
pagination:
16131+
$ref: '#/components/schemas/MetricMetaPage'
16132+
type: object
1609716133
MetricPayload:
1609816134
description: The metrics' payload.
1609916135
properties:
@@ -16570,6 +16606,10 @@ components:
1657016606
items:
1657116607
$ref: '#/components/schemas/MetricsAndMetricTagConfigurations'
1657216608
type: array
16609+
links:
16610+
$ref: '#/components/schemas/MetricsListResponseLinks'
16611+
meta:
16612+
$ref: '#/components/schemas/MetricPaginationMeta'
1657316613
readOnly: true
1657416614
type: object
1657516615
MetricsDataSource:
@@ -16583,6 +16623,29 @@ components:
1658316623
x-enum-varnames:
1658416624
- METRICS
1658516625
- CLOUD_COST
16626+
MetricsListResponseLinks:
16627+
description: Pagination links. Only present if pagination query parameters were
16628+
provided.
16629+
properties:
16630+
first:
16631+
description: Link to the first page.
16632+
type: string
16633+
last:
16634+
description: Link to the last page.
16635+
nullable: true
16636+
type: string
16637+
next:
16638+
description: Link to the next page.
16639+
nullable: true
16640+
type: string
16641+
prev:
16642+
description: Link to previous page.
16643+
nullable: true
16644+
type: string
16645+
self:
16646+
description: Link to current page.
16647+
type: string
16648+
type: object
1658616649
MetricsScalarQuery:
1658716650
description: An individual scalar metrics query.
1658816651
properties:
@@ -35773,7 +35836,12 @@ paths:
3577335836
get:
3577435837
description: "Returns all metrics that can be configured in the Metrics Summary
3577535838
page or with Metrics without Limits\u2122 (matching additional filters if
35776-
specified)."
35839+
specified).\nOptionally, paginate by using the `page[cursor]` and/or `page[size]`
35840+
query parameters.\nTo fetch the first page, pass in a query parameter with
35841+
either a valid `page[size]` or an empty cursor like `page[cursor]=`. To fetch
35842+
the next page, pass in the `next_cursor` value from the response as the new
35843+
`page[cursor]` value.\nOnce the `meta.pagination.next_cursor` value is null,
35844+
all pages have been retrieved."
3577735845
operationId: ListTagConfigurations
3577835846
parameters:
3577935847
- description: Filter custom metrics that have configured tags.
@@ -35838,6 +35906,27 @@ paths:
3583835906
schema:
3583935907
format: int64
3584035908
type: integer
35909+
- description: Maximum number of results returned.
35910+
in: query
35911+
name: page[size]
35912+
required: false
35913+
schema:
35914+
default: 10000
35915+
format: int32
35916+
maximum: 10000
35917+
minimum: 1
35918+
type: integer
35919+
- description: 'String to query the next page of results.
35920+
35921+
This key is provided with each valid response from the API in `meta.pagination.next_cursor`.
35922+
35923+
Once the `meta.pagination.next_cursor` key is null, all pages have been
35924+
retrieved.'
35925+
in: query
35926+
name: page[cursor]
35927+
required: false
35928+
schema:
35929+
type: string
3584135930
responses:
3584235931
'200':
3584335932
content:
@@ -35871,6 +35960,11 @@ paths:
3587135960
summary: Get a list of metrics
3587235961
tags:
3587335962
- Metrics
35963+
x-pagination:
35964+
cursorParam: page[cursor]
35965+
cursorPath: meta.pagination.next_cursor
35966+
limitParam: page[size]
35967+
resultsPath: data
3587435968
x-permission:
3587535969
operator: OR
3587635970
permissions:

docs/datadog_api_client.v2.model.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6815,6 +6815,20 @@ datadog\_api\_client.v2.model.metric\_intake\_type module
68156815
:members:
68166816
:show-inheritance:
68176817

6818+
datadog\_api\_client.v2.model.metric\_meta\_page module
6819+
-------------------------------------------------------
6820+
6821+
.. automodule:: datadog_api_client.v2.model.metric_meta_page
6822+
:members:
6823+
:show-inheritance:
6824+
6825+
datadog\_api\_client.v2.model.metric\_meta\_page\_type module
6826+
-------------------------------------------------------------
6827+
6828+
.. automodule:: datadog_api_client.v2.model.metric_meta_page_type
6829+
:members:
6830+
:show-inheritance:
6831+
68186832
datadog\_api\_client.v2.model.metric\_metadata module
68196833
-----------------------------------------------------
68206834

@@ -6857,6 +6871,13 @@ datadog\_api\_client.v2.model.metric\_origin module
68576871
:members:
68586872
:show-inheritance:
68596873

6874+
datadog\_api\_client.v2.model.metric\_pagination\_meta module
6875+
-------------------------------------------------------------
6876+
6877+
.. automodule:: datadog_api_client.v2.model.metric_pagination_meta
6878+
:members:
6879+
:show-inheritance:
6880+
68606881
datadog\_api\_client.v2.model.metric\_payload module
68616882
----------------------------------------------------
68626883

@@ -7060,6 +7081,13 @@ datadog\_api\_client.v2.model.metrics\_data\_source module
70607081
:members:
70617082
:show-inheritance:
70627083

7084+
datadog\_api\_client.v2.model.metrics\_list\_response\_links module
7085+
-------------------------------------------------------------------
7086+
7087+
.. automodule:: datadog_api_client.v2.model.metrics_list_response_links
7088+
:members:
7089+
:show-inheritance:
7090+
70637091
datadog\_api\_client.v2.model.metrics\_scalar\_query module
70647092
-----------------------------------------------------------
70657093

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Get a list of metrics returns "Success" response with pagination
3+
"""
4+
5+
from datadog_api_client import ApiClient, Configuration
6+
from datadog_api_client.v2.api.metrics_api import MetricsApi
7+
8+
configuration = Configuration()
9+
with ApiClient(configuration) as api_client:
10+
api_instance = MetricsApi(api_client)
11+
items = api_instance.list_tag_configurations_with_pagination(
12+
page_size=2,
13+
)
14+
for item in items:
15+
print(item)

0 commit comments

Comments
 (0)