Skip to content

Commit 2ecfde5

Browse files
committed
fix errors & tests, update readme
1 parent 547a3ec commit 2ecfde5

File tree

5 files changed

+110
-41
lines changed

5 files changed

+110
-41
lines changed

README.md

+35-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Cortex tenants (separate namespaces where metrics are stored to and queried from
1616

1717
This makes it impossible to use a single Prometheus (or an HA pair) to write to multiple tenants.
1818

19-
This proxy solves the problem:
19+
This proxy solves the problem using the following logic:
2020

2121
- Receive Prometheus remote write
2222
- Search each timeseries for a specific label name and extract a tenant ID from its value.
@@ -40,19 +40,19 @@ This proxy solves the problem:
4040
Application expects the config file at `/etc/cortex-tenant.yml` by default.
4141

4242
```yaml
43-
# Where to listen for write requests
43+
# Where to listen for incoming write requests from Prometheus
4444
listen: 0.0.0.0:8080
45-
# Profiling API, disabled if ommited
45+
# Profiling API, remove to disable
4646
listen_pprof: 0.0.0.0:7008
4747
# Where to send the modified requests (Cortex)
4848
target: http://127.0.0.1:9091/receive
4949
# Log level
5050
log_level: warn
5151
# HTTP request timeout
5252
timeout: 10s
53-
# Timeout to wait on shutdown to allow load balancers detect that we're going away
54-
# During this period the /alive endpoint will reply with HTTP 503
55-
# Set to 0s to disable
53+
# Timeout to wait on shutdown to allow load balancers detect that we're going away.
54+
# During this period after the shutdown command the /alive endpoint will reply with HTTP 503.
55+
# Set to 0s to disable.
5656
timeout_shutdown: 10s
5757

5858
tenant:
@@ -63,10 +63,38 @@ tenant:
6363
# To which header to add the tenant ID
6464
header: X-Scope-OrgID
6565
# Which tenant ID to use if the label is missing in any of the timeseries
66-
# If this is not set or empty then the write request will be rejected with HTTP code 400
66+
# If this is not set or empty then the write request with missing tenant label
67+
# will be rejected with HTTP code 400
6768
default: foobar
6869
```
6970
71+
### Prometheus configuration example
72+
73+
```yaml
74+
remote_write:
75+
- name: cortex_tenant
76+
url: http://127.0.0.1:8080/push
77+
78+
scrape_configs:
79+
- job_name: job1
80+
scrape_interval: 60s
81+
static_configs:
82+
- targets:
83+
- target1: 9090
84+
labels:
85+
tenant: foobar
86+
87+
- job_name: job2
88+
scrape_interval: 60s
89+
static_configs:
90+
- targets:
91+
- target2: 9090
92+
labels:
93+
tenant: deadbeef
94+
```
95+
96+
This would result in `job1` metrics ending up in the `foobar` tenant in cortex and `job2` in `deadbeef`.
97+
7098
## Building
7199

72100
`make build` should create you an _amd64_ binary.

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.1
1+
1.3.2

0 commit comments

Comments
 (0)