Skip to content

Commit 335ba40

Browse files
committed
Add cat.circuit_breaker API
1 parent c8b7c21 commit 335ba40

File tree

7 files changed

+245
-0
lines changed

7 files changed

+245
-0
lines changed

specification/_doc_ids/table.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ calendar-and-fixed-intervals,https://www.elastic.co/docs/reference/aggregations/
5151
cat-alias,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-aliases,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-alias.html,
5252
cat-allocation,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-allocation,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-allocation.html,
5353
cat-anomaly-detectors,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-ml-jobs,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-anomaly-detectors.html,
54+
cat-circuit-breaker,https://www.elastic.co/docs/api/doc/elasticsearch#TODO,,
5455
cat-component-templates,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-component-templates,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-component-templates.html,
5556
cat-count,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-count,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-count.html,
5657
cat-datafeeds,https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-ml-datafeeds,https://www.elastic.co/guide/en/elasticsearch/reference/8.18/cat-datafeeds.html,

specification/cat/_types/CatBase.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,55 @@ export enum CatAllocationColumn {
12601260
'node.role'
12611261
}
12621262

1263+
/** @non_exhaustive */
1264+
export enum CatCircuitBreakerColumn {
1265+
/**
1266+
* Persistent node ID
1267+
* @aliases id
1268+
*/
1269+
node_id,
1270+
/**
1271+
* Node name
1272+
* @aliases nn
1273+
*/
1274+
node_name,
1275+
/**
1276+
* Breaker name
1277+
* @aliases br
1278+
*/
1279+
breaker,
1280+
/**
1281+
* Limit size
1282+
* @aliases l
1283+
*/
1284+
limit,
1285+
/**
1286+
* Limit size in bytes
1287+
* @aliases lb
1288+
*/
1289+
limit_bytes,
1290+
/**
1291+
* Estimated size
1292+
* @aliases e
1293+
*/
1294+
estimated,
1295+
/**
1296+
* Estimated size in bytes
1297+
* @aliases eb
1298+
*/
1299+
estimated_bytes,
1300+
/**
1301+
* Tripped count
1302+
* @aliases t
1303+
*/
1304+
tripped,
1305+
/**
1306+
* Overhead
1307+
* @aliases o
1308+
*/
1309+
overhead
1310+
}
1311+
12631312
/** @non_exhaustive */
12641313
export enum CatComponentColumn {
12651314
/**
@@ -2479,6 +2528,9 @@ export type CatSegmentsColumns = CatSegmentsColumn | CatSegmentsColumn[]
24792528
export type CatSnapshotsColumns = CatSnapshotsColumn | CatSnapshotsColumn[]
24802529
export type CatAliasesColumns = CatAliasesColumn | CatAliasesColumn[]
24812530
export type CatAllocationColumns = CatAllocationColumn | CatAllocationColumn[]
2531+
export type CatCircuitBreakerColumns =
2532+
| CatCircuitBreakerColumn
2533+
| CatCircuitBreakerColumn[]
24822534
export type CatComponentColumns = CatComponentColumn | CatComponentColumn[]
24832535
export type CatCountColumns = CatCountColumn | CatCountColumn[]
24842536
export type CatFieldDataColumns = CatFieldDataColumn | CatFieldDataColumn[]
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Names } from '@_types/common'
21+
import { Duration } from '@_types/Time'
22+
import { CatCircuitBreakerColumns, CatRequestBase } from '@cat/_types/CatBase'
23+
24+
/**
25+
* Get circuit breakers statistics.
26+
*
27+
*
28+
* IMPORTANT: CAT APIs are only intended for human consumption using the command line or Kibana console. They are not intended for use by applications.
29+
* @rest_spec_name cat.circuit_breaker
30+
* @availability stack stability=stable
31+
* @availability serverless stability=stable visibility=private
32+
* @doc_id cat-circuit-breaker
33+
* @cluster_privileges monitor
34+
*/
35+
export interface Request extends CatRequestBase {
36+
urls: [
37+
{
38+
path: '/_cat/circuit_breaker'
39+
methods: ['GET']
40+
},
41+
{
42+
path: '/_cat/circuit_breaker/{circuit_breaker_patterns}'
43+
methods: ['GET']
44+
}
45+
]
46+
path_parts: {
47+
/** A comma-separated list of regular-expressions to filter the circuit breakers in the output */
48+
circuit_breaker_patterns?: string | string[]
49+
}
50+
query_parameters: {
51+
/**
52+
* A comma-separated list of columns names to display. It supports simple wildcards.
53+
*/
54+
h?: CatCircuitBreakerColumns
55+
/**
56+
* List of columns that determine how the table should be sorted.
57+
* Sorting defaults to ascending and can be changed by setting `:asc`
58+
* or `:desc` as a suffix to the column name.
59+
*/
60+
s?: Names
61+
/**
62+
* If `true`, the request computes the list of selected nodes from the
63+
* local cluster state. If `false` the list of selected nodes are computed
64+
* from the cluster state of the master node. In both cases the coordinating
65+
* node will send requests for further information to each selected node.
66+
* @server_default false
67+
*/
68+
local?: boolean
69+
/**
70+
* Period to wait for a connection to the master node.
71+
* @server_default 30s
72+
*/
73+
master_timeout?: Duration
74+
}
75+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { CircuitBreakerRecord } from './types'
21+
22+
export class Response {
23+
/** @codegen_name statistics */
24+
body: Array<CircuitBreakerRecord>
25+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# summary:
2+
description: >
3+
A successful response from `GET /_cat/circuit_breaker?v=true&format=json`.
4+
It shows two circuit breakers are active on one node.
5+
# type: response
6+
# response_code: 200
7+
value: |-
8+
[
9+
{
10+
"breaker": "request",
11+
"estimated": "0b",
12+
"limit": "614.3mb",
13+
"node_id": "ozKxpP9oS3SL0Sp-Mfxc6w",
14+
"tripped": "0"
15+
},
16+
{
17+
"breaker": "fielddata",
18+
"estimated": "0b",
19+
"limit": "409.5mb",
20+
"node_id": "ozKxpP9oS3SL0Sp-Mfxc6w",
21+
"tripped": "0"
22+
}
23+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
method_request: GET /_cat/circuit_breaker?v=true&format=json
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { ByteSize, NodeId } from '@_types/common'
21+
22+
export class CircuitBreakerRecord {
23+
/**
24+
* Persistent node ID
25+
* @aliases id
26+
*/
27+
node_id?: NodeId
28+
/**
29+
* Node name
30+
* @aliases nn
31+
*/
32+
node_name?: string
33+
/**
34+
* Breaker name
35+
* @aliases br
36+
*/
37+
breaker?: string
38+
/**
39+
* Limit size
40+
* @aliases l
41+
*/
42+
limit?: string
43+
/**
44+
* Limit size in bytes
45+
* @aliases lb
46+
*/
47+
limit_bytes?: ByteSize
48+
/**
49+
* Estimated size
50+
* @aliases e
51+
*/
52+
estimated?: string
53+
/**
54+
* Estimated size in bytes
55+
* @aliases eb
56+
*/
57+
estimated_bytes?: ByteSize
58+
/**
59+
* Tripped count
60+
* @aliases t
61+
*/
62+
tripped?: string
63+
/**
64+
* Overhead
65+
* @aliases o
66+
*/
67+
overhead?: string
68+
}

0 commit comments

Comments
 (0)