-
Notifications
You must be signed in to change notification settings - Fork 65
/
spec.yaml
141 lines (141 loc) · 3.34 KB
/
spec.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
openapi: 3.0.0
info:
description: The Rules Backend API
version: "0.0.2"
title: Rules Backend API
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: rulesv1
description: Calls related to rules
paths:
/api/v1/rules/{tenant}:
parameters:
- in: path
name: tenant
description: name of the tenant
required: true
schema:
type: string
get:
tags:
- rulesv1
summary: lists all rules for a tenant
operationId: listRules
description: |
You can list all rules for a tenant
responses:
'200':
description: all rules for that tenant
content:
application/yaml:
schema:
$ref: '#/components/schemas/Rules'
'404':
description: invalid tenant
put:
tags:
- rulesv1
summary: set/overwrite the rules for the tenant
operationId: setRules
description: Set rules for the tenant
responses:
'201':
description: rule file created
'400':
description: 'invalid rules object'
requestBody:
content:
application/yaml:
schema:
$ref: '#/components/schemas/Rules'
description: Rules to set
/api/v1/rules:
get:
tags:
- rulesv1
summary: lists all rules for all tenants
operationId: listAllRules
description: |
You can list all rules for all tenants
responses:
'200':
description: rules for all tenants
content:
application/yaml:
schema:
$ref: '#/components/schemas/Rules'
components:
schemas:
Rules:
type: object
required:
- groups
properties:
groups:
type: array
items:
$ref: '#/components/schemas/RuleGroup'
RuleGroup:
type: object
required:
- interval
- name
- rules
properties:
interval:
type: string
example: '1m'
name:
type: string
example: 'telemeter.rules'
rules:
type: array
items:
oneOf:
- $ref: '#/components/schemas/RecordingRule'
- $ref: '#/components/schemas/AlertingRule'
RecordingRule:
type: object
required:
- expr
- record
- labels
properties:
expr:
type: string
example: 'count by (name) (cluster{condition="halted"} == 1)'
record:
type: string
example: 'count:cluster_halted'
labels:
type: object
additionalProperties:
type: string
AlertingRule:
type: object
required:
- alert
- expr
- for
- labels
- annotations
properties:
alert:
type: string
example: 'HighRequestLatency'
expr:
type: string
example: 'job:request_latency_seconds:mean5m{job="myjob"} > 0.5'
for:
type: string
example: '10m'
labels:
type: object
additionalProperties:
type: string
annotations:
type: object
additionalProperties:
type: string