Skip to content

Commit 9a6dffc

Browse files
authored
Merge pull request #1540 from cortexproject/api-docs
Add a doc for APIs
2 parents c4e7d8e + 3530e03 commit 9a6dffc

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

docs/configs-api.md renamed to docs/apis.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
1-
# Configs API
1+
# Cortex APIs
2+
3+
[this is a work in progress]
4+
5+
## Remote API
6+
7+
Cortex supports Prometheus'
8+
[`remote_read`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_read)
9+
and
10+
[`remote_write`](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write)
11+
APIs. The encoding is Protobuf over http.
12+
13+
Read is on `/api/prom/read` and write is on `/api/prom/push`.
14+
15+
16+
## Configs API
217

318
The configs service provides an API-driven multi-tenant approach to handling various configuration files for prometheus. The service hosts an API where users can read and write Prometheus rule files, Alertmanager configuration files, and Alertmanager templates to a database.
419

520
Each tenant will have it's own set of rule files, Alertmanager config, and templates. A POST operation will effectively replace the existing copy with the configs provided in the request body.
621

7-
## Configs Format
22+
### Configs Format
823

924
At the current time of writing, the API is part-way through a migration from a single Configs service that handled all three sets of data to a split API ([Tracking issue](https://github.com/cortexproject/cortex/issues/619)). All APIs take and return all sets of data.
1025

1126
The following schema is used both when retrieving the current configs from the API and when setting new configs via the API.
1227

13-
### Schema:
28+
#### Schema:
1429

1530
```json
1631
{
@@ -30,7 +45,7 @@ The following schema is used both when retrieving the current configs from the A
3045
}
3146
```
3247

33-
### Formatting
48+
#### Formatting
3449

3550
`id` - should be incremented every time data is updated; Cortex will use the config with the highest number.
3651

@@ -42,9 +57,9 @@ The following schema is used both when retrieving the current configs from the A
4257

4358
`config.template_files` - The contents of a template file should be as described [here](https://prometheus.io/docs/alerting/notification_examples/#defining-reusable-templates), encoded as a single string to fit within the overall JSON payload.
4459

45-
## Endpoints
60+
### Endpoints
4661

47-
### Manage Alertmanager
62+
#### Manage Alertmanager
4863

4964
`GET /api/prom/configs/alertmanager` - Get current Alertmanager config
5065

@@ -73,7 +88,7 @@ Error Response: BadRequest(400)
7388
}
7489
```
7590

76-
### Manage Rules
91+
#### Manage Rules
7792

7893
`GET /api/prom/configs/rules` - Get current rule files
7994

@@ -85,7 +100,7 @@ Error Response: BadRequest(400)
85100
- Normal Response Codes: NoContent(204)
86101
- Error Response Codes: Unauthorized(401), BadRequest(400)
87102

88-
### Manage Templates
103+
#### Manage Templates
89104

90105
`GET /api/prom/configs/templates` - Get current templates
91106

@@ -97,7 +112,7 @@ Error Response: BadRequest(400)
97112
- Normal Response Codes: NoContent(204)
98113
- Error Response Codes: Unauthorized(401), BadRequest(400)
99114

100-
### Deactivate/Restore Configs
115+
#### Deactivate/Restore Configs
101116

102117
`DELETE /api/prom/configs/deactivate` - Disable configs for a tenant
103118

0 commit comments

Comments
 (0)