@@ -16,7 +16,7 @@ Cortex tenants (separate namespaces where metrics are stored to and queried from
16
16
17
17
This makes it impossible to use a single Prometheus (or an HA pair) to write to multiple tenants.
18
18
19
- This proxy solves the problem:
19
+ This proxy solves the problem using the following logic :
20
20
21
21
- Receive Prometheus remote write
22
22
- 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:
40
40
Application expects the config file at ` /etc/cortex-tenant.yml ` by default.
41
41
42
42
``` yaml
43
- # Where to listen for write requests
43
+ # Where to listen for incoming write requests from Prometheus
44
44
listen : 0.0.0.0:8080
45
- # Profiling API, disabled if ommited
45
+ # Profiling API, remove to disable
46
46
listen_pprof : 0.0.0.0:7008
47
47
# Where to send the modified requests (Cortex)
48
48
target : http://127.0.0.1:9091/receive
49
49
# Log level
50
50
log_level : warn
51
51
# HTTP request timeout
52
52
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.
56
56
timeout_shutdown : 10s
57
57
58
58
tenant :
@@ -63,10 +63,38 @@ tenant:
63
63
# To which header to add the tenant ID
64
64
header : X-Scope-OrgID
65
65
# 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
67
68
default : foobar
68
69
` ` `
69
70
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
+
70
98
# # Building
71
99
72
100
` make build` should create you an _amd64_ binary.
0 commit comments