@@ -12,18 +12,37 @@ local defaults = {
12
12
splitInterval: '24h' ,
13
13
maxRetries: 5 ,
14
14
logQueriesLongerThan: '0' ,
15
- fifoCache: {
16
- max_size: '0' , // Don't limit maximum item size.
17
- max_size_items: 2048 ,
18
- validity: '6h' ,
15
+ fifoCache+:: {
16
+ config+: {
17
+ max_size: '0' , // Don't limit maximum item size.
18
+ max_size_items: 2048 ,
19
+ validity: '6h' ,
20
+ }
19
21
},
22
+ queryRangeCache: {},
23
+ labelsCache: {},
20
24
logLevel: 'info' ,
21
25
resources: {},
22
26
serviceMonitor: false ,
23
27
ports: {
24
28
http: 9090 ,
25
29
},
26
30
31
+ memcachedDefaults+:: {
32
+ config+: {
33
+ // List of memcached addresses, that will get resolved with the DNS service discovery provider.
34
+ // For DNS service discovery reference https://thanos.io/service-discovery.md/#dns-service-discovery
35
+ addresses+: error 'must provide memcached addresses' ,
36
+ timeout: '500ms' ,
37
+ max_idle_connections: 100 ,
38
+ max_async_concurrency: 20 ,
39
+ max_async_buffer_size: 10000 ,
40
+ max_get_multi_concurrency: 100 ,
41
+ max_get_multi_batch_size: 0 ,
42
+ dns_provider_update_interval: '10s' ,
43
+ },
44
+ },
45
+
27
46
commonLabels:: {
28
47
'app.kubernetes.io/name' : 'thanos-query-frontend' ,
29
48
'app.kubernetes.io/instance' : defaults.name,
@@ -42,12 +61,25 @@ function(params) {
42
61
local tqf = self ,
43
62
44
63
// Combine the defaults and the passed params to make the component's config.
45
- config:: defaults + params,
64
+ config:: defaults + params + {
65
+ queryRangeCache+:
66
+ if std.objectHas (params, 'queryRangeCache' ) && params.queryRangeCache.type == 'memcached' then
67
+ defaults.memcachedDefaults + params.queryRangeCache
68
+ else if std.objectHas (params, 'queryRangeCache' ) && params.queryRangeCache.type == 'in-memory' then
69
+ defaults.fifoCache + params.queryRangeCache
70
+ else {},
71
+ labelsCache+:
72
+ if std.objectHas (params, 'labelsCache' ) && params.labelsCache.type == 'memcached' then
73
+ defaults.memcachedDefaults + params.labelsCache
74
+ else if std.objectHas (params, 'labelsCache' ) && params.labelsCache.type == 'in-memory' then
75
+ defaults.fifoCache + params.labelsCache
76
+ else {},
77
+ },
46
78
// Safety checks for combined config of defaults and params
47
79
assert std.isNumber (tqf.config.replicas) && tqf.config.replicas >= 0 : 'thanos query frontend replicas has to be number >= 0' ,
48
80
assert std.isObject (tqf.config.resources),
49
81
assert std.isBoolean (tqf.config.serviceMonitor),
50
- assert std.isNumber (tqf.config.maxRetries),
82
+ assert std.isNumber (tqf.config.maxRetries) && tqf.config.maxRetries >= 0 : 'thanos query frontend maxRetries has to be number >= 0' ,
51
83
52
84
service:
53
85
{
@@ -84,14 +116,21 @@ function(params) {
84
116
'--http-address=0.0.0.0:%d' % tqf.config.ports.http,
85
117
'--query-frontend.downstream-url=%s' % tqf.config.downstreamURL,
86
118
'--query-range.split-interval=%s' % tqf.config.splitInterval,
119
+ '--labels.split-interval=%s' % tqf.config.splitInterval,
87
120
'--query-range.max-retries-per-request=%d' % tqf.config.maxRetries,
121
+ '--labels.max-retries-per-request=%d' % tqf.config.maxRetries,
88
122
'--query-frontend.log-queries-longer-than=%s' % tqf.config.logQueriesLongerThan,
89
123
] + (
90
- if std.length (tqf.config.fifoCache) > 0 then [
91
- '--query-range.response-cache-config=' + std.manifestYamlDoc ({
92
- type: 'in-memory' ,
93
- config: tqf.config.fifoCache,
94
- }),
124
+ if std.length (tqf.config.queryRangeCache) > 0 then [
125
+ '--query-range.response-cache-config=' + std.manifestYamlDoc (
126
+ tqf.config.queryRangeCache
127
+ ),
128
+ ] else []
129
+ ) + (
130
+ if std.length (tqf.config.labelsCache) > 0 then [
131
+ '--labels.response-cache-config=' + std.manifestYamlDoc (
132
+ tqf.config.labelsCache
133
+ ),
95
134
] else []
96
135
),
97
136
ports: [
0 commit comments