-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
1636 lines (1606 loc) · 53.3 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.3
info:
title: Prometheus HTTP
description: |
The current stable HTTP API is reachable under /api/v1 on a Prometheus server. Any non-breaking additions will be added under that endpoint.
version: v1
servers:
- url: /api/v1
tags:
- name: Expression query
description: |
Query language expressions may be evaluated at a single instant or over a range of time.
- name: Querying metadata
description: |
Query metadata about series and their labels.
- name: Default
- name: Status
description: |
Expose current Prometheus configuration.
- name: TSDB Admin API
description: "Expose database functionalities for the advanced user. Requires --web.enable-admin-api.\n"
paths:
/admin/tsdb/clean_tombstones:
post:
tags:
- TSDB Admin API
summary: Removes deleted data
description: |
CleanTombstones removes the deleted data from disk and cleans up the existing tombstones. This can be used after deleting series to free up space.
operationId: cleanTombstones
responses:
204:
description: Successful
content: {}
/admin/tsdb/delete_series:
post:
tags:
- TSDB Admin API
summary: Deletes selected data
description: |
DeleteSeries deletes data for a selection of series in a time range. The actual data still exists on disk and is cleaned up in future compactions or can be explicitly cleaned up by hitting the [Clean Tombstones](https://prometheus.io/docs/prometheus/latest/querying/api/#clean-tombstones) endpoint.
**NOTE:** This endpoint marks samples from series as deleted, but will not necessarily prevent associated series metadata from still being returned in metadata queries for the affected time range (even after cleaning tombstones). The exact extent of metadata deletion is an implementation detail that may change in the future.
operationId: deleteSeries
parameters:
- name: match
in: query
description: |
Repeated label matcher argument that selects the series to delete. At least one match[] argument must be provided.
required: true
schema:
type: array
items:
type: string
format: series_selector
minItems: 1
explode: true
- name: start
in: query
description: Start timestamp. Optional and defaults to minimum possible time.
schema:
type: string
format: rfc3339 | unix_timestamp
- name: end
in: query
description: |
End timestamp. Optional and defaults to maximum possible time.
Not mentioning both start and end times would clear all the data for the matched series in the database.
schema:
type: string
format: rfc3339 | unix_timestamp
responses:
204:
description: Successful
content: {}
/admin/tsdb/snapshot:
post:
tags:
- TSDB Admin API
summary: Creates Snapshot of current data
description: |
Snapshot creates a snapshot of all current data into ```snapshots/<datetime>-<rand>``` under the TSDB's data directory and returns the directory as response. It will optionally skip snapshotting data that is only present in the head block, and which has not yet been compacted to disk.
operationId: createSnapshot
parameters:
- name: skip_head
in: query
description: |
Skip data present in the head block. Optional.
schema:
type: boolean
responses:
200:
description: The snapshot now exists at ```<data-dir>/snapshots/20171210T211224Z-2be650b6d019eb54```
content:
application/json:
schema:
$ref: '#/components/schemas/SnapshotCreateResponse'
example:
status: success
data:
name: 20171210T211224Z-2be650b6d019eb54
/alertmanagers:
get:
tags:
- Default
summary: Returns current alertmanager discovery
description: |
Returns an overview of the current state of the Prometheus alertmanager discovery
Both the active and dropped Alertmanagers are part of the response.
operationId: readAlertManagers
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AlertManagerReadResponse'
example:
status: success
data:
activeAlertmanagers:
- url: http://127.0.0.1:9090/api/v1/alerts
droppedAlertmanagers:
- url: http://127.0.0.1:9093/api/v1/alerts
/alerts:
get:
tags:
- Default
summary: Returns active alerts
description: |
The /alerts endpoint returns a list of all active alerts.
As the /alerts endpoint is fairly new, it does not have the same stability guarantees as the overarching API v1.
operationId: readAlerts
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/AlertReadResponse'
example:
data:
alerts:
- activeAt: 2018-07-04T20:27:12.60602144+02:00
annotations: {}
labels:
alertname: my-alert
state: firing
value: 1e+00
status: success
/label/{label_name}/values:
get:
tags:
- Querying metadata
summary: Returns label values
description: |
The following endpoint returns a list of label values for a provided label name
The `data` section of the JSON response is a list of string label values.
**NOTE:** These API endpoints may return metadata for series for which there is no sample within the selected time range, and/or for series whose samples have been marked as deleted via the deletion API endpoint. The exact extent of additionally returned series metadata is an implementation detail that may change in the future.
operationId: readLabelValues
parameters:
- name: label_name
in: path
description: Label name.
required: true
schema:
type: string
- name: start
in: query
description: Start timestamp.
required: true
schema:
type: string
format: rfc3339 | unix_timestamp
- name: end
in: query
description: End timestamp.
required: false
schema:
type: string
format: rfc3339 | unix_timestamp
- name: match
in: query
description: |
Repeated series selector argument that selects the series from which to read the label values.
required: false
schema:
type: array
items:
type: string
format: series_selector
explode: true
responses:
200:
description: |
Success
This example queries for all label values for the job label
content:
application/json:
schema:
$ref: '#/components/schemas/LabelValuesReadResponse'
example:
status: success
data:
- node
- prometheus
/labels:
get:
tags:
- Querying metadata
summary: Returns label names
description: |
The following endpoint returns a list of label names.
The `data` section of the JSON response is a list of string label names.
**NOTE:** These API endpoints may return metadata for series for which there is no sample within the selected time range, and/or for series whose samples have been marked as deleted via the deletion API endpoint. The exact extent of additionally returned series metadata is an implementation detail that may change in the future.
operationId: readLabelNames
parameters:
- name: start
in: query
description: |
Start timestamp.
required: false
schema:
type: string
format: rfc3339 | unix_timestamp
- name: end
in: query
description: |
End timestamp.
required: false
schema:
type: string
format: rfc3339 | unix_timestamp
- name: match
in: query
description: |
Repeated series selector argument that selects the series from which to read the label values. Optional.
schema:
type: array
items:
type: string
format: series_selector
explode: true
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/LabelNamesReadResponse'
example:
status: success
data:
- __name__
- call
- code
- config
- dialer_name
- endpoint
- event
- goversion
- handler
- instance
- interval
- job
- le
- listener_name
- name
- quantile
- reason
- role
- scrape_job
- slice
- version
/metadata:
get:
summary: Returns metric metadata
description: |
It returns metadata about metrics currently scrapped from targets. However, it does not provide any target information. This is considered experimental and might change in the future.
The data section of the query result consists of an object where each key is a metric name and each value is a list of unique metadata objects, as exposed for that metric name across all targets.
operationId: MetricMetadataReadResponse
parameters:
- name: limit
in: query
description: Maximum number of metrics to return.
required: true
schema:
type: integer
format: int32
- name: metric
in: query
description: A metric name to filter metadata for. All metric metadata is retrieved if left empty.
schema:
type: string
responses:
200:
description: |
Success
The following example returns two metrics. Note that the metric ```http_requests_total``` has more than one object in the list. At least one target has a value for ```HELP``` that do not match with the rest.
content:
application/json:
schema:
$ref: '#/components/schemas/MetadataReadResponse'
example:
status: success
data:
cortex_ring_tokens:
- type: gauge
help: Number of tokens in the ring
unit: ""
http_requests_total:
- type: counter
help: Number of HTTP requests
unit: ""
- type: counter
help: Amount of HTTP requests
unit: ""
201:
description: |
Success
The following example returns metadata only for the metric ```http_requests_total```.
content:
application/json:
schema:
$ref: '#/components/schemas/MetadataReadResponse'
example:
status: success
data:
http_requests_total:
- type: counter
help: Number of HTTP requests
unit: ""
- type: counter
help: Amount of HTTP requests
unit: ""
/query:
get:
tags:
- Expression query
summary: Evaluates instant query
description: |
The following endpoint evaluates an instant query at a single point in time
You can URL-encode these parameters directly in the request body by using the ```POST``` method and ```Content-Type: application/x-www-form-urlencoded``` header. This is useful when specifying a large query that may breach server-side URL character limits.
The data section of the query result has the following format
```
{
"resultType": "matrix" | "vector" | "scalar" | "string",
"result": <value>
}
```
```<value>``` refers to the query result data, which has varying formats depending on the ```resultType```. See the [expression query result formats](https://prometheus.io/docs/prometheus/latest/querying/api/#expression-query-result-formats).
operationId: evaluateQueryInstant
parameters:
- name: query
in: query
description: |
Prometheus expression query string.
required: true
schema:
type: string
- name: time
in: query
description: |
Evaluation timestamp. Optional.
The current server time is used if the time parameter is omitted.
schema:
type: string
format: rfc3339 | unix_timestamp
- name: timeout
in: query
description: |
Evaluation timeout. Optional. Defaults to and is capped by the value of the ```-query.timeout``` flag.
schema:
type: string
format: duration
responses:
200:
description: |
Success
content:
application/json:
schema:
$ref: '#/components/schemas/QueryDataReadResponse'
example:
status: success
data:
resultType: vector
result:
- metric:
__name__: up
job: prometheus
instance: localhost:9090
value:
- 1.435781451781E9
- "1"
- metric:
__name__: up
job: node
instance: localhost:9100
value:
- 1.435781451781E9
- "0"
/query_exemplars:
get:
tags:
- Expression query
summary: Returns list of Exemplars
description: |
This is <b>experimental</b> and might change in the future. The following endpoint returns a list of exemplars for a valid PromQL query for a specific time range
operationId: readQueryExemplars
x-stability: experimental
parameters:
- name: query
in: query
description: |
Prometheus expression query string.
required: true
schema:
type: string
- name: start
in: query
description: |
Start timestamp.
schema:
type: string
format: rfc3339 | unix_timestamp
- name: end
in: query
description: |
End timestamp.
schema:
type: string
format: rfc3339 | unix_timestamp
responses:
200:
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/QueryExemplarsReadResponse"
example:
status: success
data:
- seriesLabels:
__name__: test_exemplar_metric_total
instance: localhost:8090
job: prometheus
service: bar
exemplars:
- labels:
traceID: EpTxMJ40fUus7aGY
value: "6"
timestamp: 1.600096945479E9
- seriesLabels:
__name__: test_exemplar_metric_total
instance: localhost:8090
job: prometheus
service: foo
exemplars:
- labels:
traceID: Olp9XHlq763ccsfa
value: "19"
timestamp: 1.600096955479E9
- labels:
traceID: hCtjygkIHwAN9vs4
value: "20"
timestamp: 1.600096965489E9
/query_range:
get:
tags:
- Expression query
summary: Evaluates query over range of time.
description: |
The following endpoint evaluates an expression query over a range of time
You can URL-encode these parameters directly in the request body by using the ```POST``` method and ```Content-Type: application/x-www-form-urlencoded``` header. This is useful when specifying a large query that may breach server-side URL character limits.
The data section of the query result has the following format
```
{
"resultType": "matrix",
"result": <value>
}
```
For the format of the ```<value>``` placeholder, see the [range-vector result format](https://prometheus.io/docs/prometheus/latest/querying/api/#range-vectors).
operationId: evaluateQueryRange
parameters:
- name: query
in: query
description: |
Prometheus expression query string.
required: true
schema:
type: string
- name: start
in: query
description: |
Start timestamp.
schema:
type: string
format: rfc3339 | unix_timestamp
- name: end
in: query
description: |
End timestamp.
schema:
type: string
format: rfc3339 | unix_timestamp
- name: step
in: query
description: |
Query resolution step width in ```duration``` format or float number of seconds.
schema:
type: string
format: duration | float
- name: timeout
in: query
description: |
Evaluation timeout. Optional. Defaults to and is capped by the value of the ```-query.timeout``` flag.
schema:
type: string
format: duration
responses:
200:
description: |
Success
The following example evaluates the expression ```up``` over a 30-second range with a query resolution of 15 seconds.
content:
application/json:
schema:
$ref: "#/components/schemas/responseQuery_range"
example:
status: success
data:
resultType: matrix
result:
- metric:
__name__: up
job: prometheus
instance: localhost:9090
values:
- - 1.435781430781E9
- "1"
- - 1.435781445781E9
- "1"
- - 1.435781460781E9
- "1"
- metric:
__name__: up
job: node
instance: localhost:9091
values:
- - 1.435781430781E9
- "0"
- - 1.435781445781E9
- "0"
- - 1.435781460781E9
- "1"
/rules:
get:
tags:
- Default
summary: Returns currently loaded rules
description: |-
The ```/rules``` API endpoint returns a list of alerting and recording rules that are currently loaded. In addition it returns the currently active alerts fired by the Prometheus instance of each alerting rule.
As the ```/rules``` endpoint is fairly new, it does not have the same stability guarantees as the overarching API v1.
operationId: readRules
parameters:
- name: type
in: query
description: |
Return only the alerting rules (e.g. ```type=alert```) or the recording rules (e.g. ```type=record```). When the parameter is absent or empty, no filtering is done.
schema:
type: string
enum:
- alert
- record
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/RuleReadResponse'
example:
data:
groups:
- rules:
- alerts:
- activeAt: 2018-07-04T20:27:12.60602144+02:00
annotations:
summary: High request latency
labels:
alertname: HighRequestLatency
severity: page
state: firing
value: 1e+00
annotations:
summary: High request latency
duration: 600
health: ok
labels:
severity: page
name: HighRequestLatency
query: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
type: alerting
- health: ok
name: job:http_inprogress_requests:sum
query: sum by (job) (http_inprogress_requests)
type: recording
file: /rules.yaml
interval: 60
name: example
status: success
/series:
get:
tags:
- Querying metadata
summary: Returns time series
description: |
The following endpoint returns the list of time series that match a certain label set.
You can URL-encode these parameters directly in the request body by using the ```POST``` method and ```Content-Type: application/x-www-form-urlencoded``` header. This is useful when specifying a large or dynamic number of series selectors that may breach server-side URL character limits.
The ```data``` section of the query result consists of a list of objects that contain the label name/value pairs which identify each series.
operationId: readSeries
parameters:
- name: start
in: query
description: |
Start timestamp. Optional.
schema:
type: string
format: rfc3339 | unix_timestamp
- name: end
in: query
description: |
End timestamp. Optional.
schema:
type: string
format: rfc3339 | unix_timestamp
- name: match
in: query
description: |
Repeated series selector argument that selects the series to return. At least one ```match[]``` argument must be provided.
required: true
schema:
type: array
items:
type: string
format: series_selector
minItems: 1
explode: true
responses:
200:
description: |
Success
The following example returns all series that match either of the selectors ```up``` or ```process_start_time_seconds{job="prometheus"}```
content:
application/json:
schema:
$ref: '#/components/schemas/responseSeries'
example:
status: success
data:
- __name__: up
job: prometheus
instance: localhost:9090
- __name__: up
job: node
instance: localhost:9091
- __name__: process_start_time_seconds
job: prometheus
instance: localhost:9090
/status/buildinfo:
get:
tags:
- Status
summary: Returns build information
description: |
The following endpoint returns various build information properties about the Prometheus server.
operationId: readServerBuildInfo
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/PrometheusBuildInfoReadResponse'
example:
status: success
data:
version: 2.13.1
revision: cb7cbad5f9a2823a622aaa668833ca04f50a0ea7
branch: master
buildUser: julius@desktop
buildDate: 20191102-16:19:59
goVersion: go1.13.1
/status/config:
get:
tags:
- Status
summary: Returns configuration file
description: |
The following endpoint returns currently loaded configuration file
The config is returned as dumped YAML file.
Due to limitation of the YAML library, YAML comments are not included.
operationId: readServerConfig
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/PrometheusConfigReadResponse'
example:
status: success
data:
yaml: <content of the loaded config file in YAML>
/status/flags:
get:
tags:
- Status
summary: Returns flag values
description: |
The following endpoint returns flag values that Prometheus was configured with.
operationId: readServerFlags
responses:
200:
description: ""
content:
application/json:
example:
status: success
data:
alertmanager.notification-queue-capacity: "10000"
alertmanager.timeout: 10s
log.level: info
query.lookback-delta: 5m
query.max-concurrency: "20"
/status/runtimeinfo:
get:
tags:
- Status
summary: Returns runtime info
description: |
The following endpoint returns various runtime information properties about the Prometheus server
The returned values are of different types, depending on the nature
of the runtime property
---
**NOTE:** The exact returned runtime properties may change without notice between Prometheus versions.
---
New in v2.14
operationId: readServerRuntimeInfo
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/RuntimeInfoResponse'
example:
status: success
data:
startTime: 2019-11-02T17:23:59.301361365+01:00
CWD: /
reloadConfigSuccess: true
lastConfigTime: 2019-11-02T17:23:59+01:00
timeSeriesCount: 873
corruptionCount: 0
goroutineCount: 48
GOMAXPROCS: 4
GOGC: ""
GODEBUG: ""
storageRetention: 15d
/status/tsdb:
get:
tags:
- Status
summary: Returns statistics about TSBD
description: |
The following endpoint returns various cardinality statistics about the Prometheus TSDB
Response Data
---
**headStats:** This provides the following data about the head block of the TSDB:
>**numSeries:** The number of series.
**chunkCount:** The number of chunks.
**minTime:** The current minimum timestamp in milliseconds.
**maxTime:** The current maximum timestamp in milliseconds.
**seriesCountByMetricName:** This will provide a list of metrics names and their series count.
**labelValueCountByLabelName:** This will provide a list of the label names and their value count.
**memoryInBytesByLabelName:** This will provide a list of the label names and memory used in bytes. Memory usage is calculated by adding the length of all values for a given label name.
**seriesCountByLabelPair:** This will provide a list of label value pairs and their series count.
operationId: readServerTSDBStatus
responses:
200:
description: |
Success
content:
application/json:
schema:
$ref: '#/components/schemas/TsdbStatusReadResponse'
example:
status: success
data:
headStats:
numSeries: 508
chunkCount: 937
minTime: 1591516800000
maxTime: 1598896800143
seriesCountByMetricName:
- name: net_conntrack_dialer_conn_failed_total
value: 20
- name: prometheus_http_request_duration_seconds_bucket
value: 20
labelValueCountByLabelName:
- name: __name__
value: 211
- name: event
value: 3
memoryInBytesByLabelName:
- name: __name__
value: 8266
- name: instance
value: 28
seriesCountByLabelValuePair:
- name: job=prometheus
value: 425
- name: instance=localhost:9090
value: 425
/status/walreplay:
get:
tags:
- Status
summary: Returns info about WAL replay.
description: "The following endpoint returns information about the WAL replay\n\
\nResponse Data\n---\n\n**read:** The number of segments replayed so far.\
\ \n**total:** The total number segments needed to be replayed. \n**progress:**\
\ The progress of the replay (0 - 100%). \n**state:** The state of the replay.\
\ \n**Possible states:** \n - **waiting:** Waiting for the replay to start.\
\ \n - **in progress:** The replay is in progress. \n - **done:** The replay\
\ has finished.\n \n---\n**NOTE:** This endpoint is available before the\
\ server has been marked ready and is updated in real time to facilitate monitoring\
\ the progress of the WAL replay.\n\n---\n\nNew in v2.28\n"
operationId: readServerWALReplayStatus
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/WalReplayStatusReadResponse'
example:
status: success
data:
min: 2
max: 5
current: 40
state: in progress
/targets:
get:
tags:
- Default
summary: Returns current target discovery.
description: |
Both the active and dropped targets are part of the response by default. ```labels``` represents the label set after relabelling has occurred. ```discoveredLabels``` represent the unmodified labels retrieved during service discovery before relabelling has occurred.
operationId: readTargets
parameters:
- name: state
in: query
description: |
The ```state``` query parameter allows the caller to filter by active or dropped targets, (e.g., ```state=active```, ```state=dropped```, ```state=any```).
schema:
type: string
enum:
- active
- dropped
- any
responses:
200:
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/TargetDiscoveryReadResponse'
example:
status: success
data:
activeTargets:
- discoveredLabels:
__address__: 127.0.0.1:9090
__metrics_path__: /metrics
__scheme__: http
job: prometheus
labels:
instance: 127.0.0.1:9090
job: prometheus
scrapePool: prometheus
scrapeUrl: http://127.0.0.1:9090/metrics
globalUrl: http://example-prometheus:9090/metrics
lastError: ""
lastScrape: 2017-01-17T15:07:44.723715405+01:00
lastScrapeDuration: 0.050688943
health: up
droppedTargets:
- discoveredLabels:
__address__: 127.0.0.1:9100
__metrics_path__: /metrics
__scheme__: http
job: node
201:
description: |
Success
content:
application/json:
schema:
$ref: '#/components/schemas/TargetDiscoveryReadResponse'
example:
status: success
data:
activeTargets:
- discoveredLabels:
__address__: 127.0.0.1:9090
__metrics_path__: /metrics
__scheme__: http
job: prometheus
labels:
instance: 127.0.0.1:9090
job: prometheus
scrapePool: prometheus
scrapeUrl: http://127.0.0.1:9090/metrics
globalUrl: http://example-prometheus:9090/metrics
lastError: ""
lastScrape: 2017-01-17T15:07:44.723715405+01:00
lastScrapeDuration: 50688943
health: up
droppedTargets: []
/targets/metadata:
get:
tags:
- Default
summary: Returns target metadata
description: |-
The following endpoint returns metadata about metrics currently scraped from targets. This is experimental and might change in the future.
The ```data``` section of the query result consists of a list of objects that contain metric metadata and the target label set.
operationId: readTargetMetadata
x-stability: experimental
parameters:
- name: match_target
in: query
description: |
Label selectors that match targets by their label sets. All targets are selected if left empty.
schema:
type: string
format: label_selectors
- name: metric
in: query
description: |
A metric name to retrieve metadata for. All metric metadata is retrieved if left empty.
schema:
type: string
- name: limit
in: query
description: |
Maximum number of targets to match.
schema:
type: integer
format: int32
responses:
200:
description: |
Success
The following example returns all metadata entries for the ```go_goroutines``` metric from the first two targets with label ```job="prometheus"```.
content:
application/json:
schema: