diff --git a/all.jsonnet b/all.jsonnet index 7f34237d..d9e73f54 100644 --- a/all.jsonnet +++ b/all.jsonnet @@ -27,10 +27,25 @@ local commonConfig = { }, }, }, + // This enables jaeger tracing for all components, as commonConfig is shared + tracing+: { + type: 'JAEGER', + config+: { + sampler_type: 'ratelimiting', + sampler_param: 2, + }, + }, }; local b = t.bucket(commonConfig { replicas: 1, + + // Example on how to overwrite the tracing config on a per component basis + // tracing+: { + // config+: { + // service_name: 'awesome-thanos-bucket', + // }, + // }, }); local c = t.compact(commonConfig { diff --git a/examples/all/manifests/thanos-bucket-deployment.yaml b/examples/all/manifests/thanos-bucket-deployment.yaml index 684e9a90..afca65a9 100644 --- a/examples/all/manifests/thanos-bucket-deployment.yaml +++ b/examples/all/manifests/thanos-bucket-deployment.yaml @@ -30,6 +30,12 @@ spec: - web - --log.level=info - --objstore.config=$(OBJSTORE_CONFIG) + - |- + --tracing.config="config": + "sampler_param": 2 + "sampler_type": "ratelimiting" + "service_name": "thanos-bucket" + "type": "JAEGER" env: - name: OBJSTORE_CONFIG valueFrom: diff --git a/examples/all/manifests/thanos-compact-statefulSet.yaml b/examples/all/manifests/thanos-compact-statefulSet.yaml index 361c5273..afd8e85f 100644 --- a/examples/all/manifests/thanos-compact-statefulSet.yaml +++ b/examples/all/manifests/thanos-compact-statefulSet.yaml @@ -39,6 +39,12 @@ spec: - --downsampling.disable - --deduplication.replica-label=prometheus_replica - --deduplication.replica-label=rule_replica + - |- + --tracing.config="config": + "sampler_param": 2 + "sampler_type": "ratelimiting" + "service_name": "thanos-compact" + "type": "JAEGER" env: - name: OBJSTORE_CONFIG valueFrom: diff --git a/examples/all/manifests/thanos-query-deployment.yaml b/examples/all/manifests/thanos-query-deployment.yaml index 32d44704..eb242038 100644 --- a/examples/all/manifests/thanos-query-deployment.yaml +++ b/examples/all/manifests/thanos-query-deployment.yaml @@ -50,6 +50,12 @@ spec: - --store=dnssrv+_grpc._tcp.thanos-store.thanos.svc.cluster.local - --query.timeout=5m - --query.lookback-delta=15m + - |- + --tracing.config="config": + "sampler_param": 2 + "sampler_type": "ratelimiting" + "service_name": "thanos-query" + "type": "JAEGER" image: quay.io/thanos/thanos:v0.16.0 livenessProbe: failureThreshold: 4 diff --git a/examples/all/manifests/thanos-query-frontend-deployment.yaml b/examples/all/manifests/thanos-query-frontend-deployment.yaml index 6038b205..1e08b629 100644 --- a/examples/all/manifests/thanos-query-frontend-deployment.yaml +++ b/examples/all/manifests/thanos-query-frontend-deployment.yaml @@ -72,6 +72,12 @@ spec: "max_idle_connections": 100 "timeout": "500ms" "type": "memcached" + - |- + --tracing.config="config": + "sampler_param": 2 + "sampler_type": "ratelimiting" + "service_name": "thanos-query-frontend" + "type": "JAEGER" image: quay.io/thanos/thanos:v0.16.0 livenessProbe: failureThreshold: 4 diff --git a/examples/all/manifests/thanos-receive-statefulSet.yaml b/examples/all/manifests/thanos-receive-statefulSet.yaml index 2f18c809..6441450f 100644 --- a/examples/all/manifests/thanos-receive-statefulSet.yaml +++ b/examples/all/manifests/thanos-receive-statefulSet.yaml @@ -72,6 +72,12 @@ spec: - --tsdb.retention=15d - --receive.local-endpoint=$(NAME).thanos-receive.$(NAMESPACE).svc.cluster.local:10901 - --receive.hashrings-file=/var/lib/thanos-receive/hashrings.json + - |- + --tracing.config="config": + "sampler_param": 2 + "sampler_type": "ratelimiting" + "service_name": "thanos-receive" + "type": "JAEGER" env: - name: NAME valueFrom: diff --git a/examples/all/manifests/thanos-rule-statefulSet.yaml b/examples/all/manifests/thanos-rule-statefulSet.yaml index 55940889..cc47d944 100644 --- a/examples/all/manifests/thanos-rule-statefulSet.yaml +++ b/examples/all/manifests/thanos-rule-statefulSet.yaml @@ -37,6 +37,12 @@ spec: - --query=dnssrv+_http._tcp.thanos-query.thanos.svc.cluster.local - --alertmanagers.url=alertmanager:9093 - --rule-file=/etc/thanos/rules/test/test + - |- + --tracing.config="config": + "sampler_param": 2 + "sampler_type": "ratelimiting" + "service_name": "thanos-rule" + "type": "JAEGER" env: - name: NAME valueFrom: diff --git a/examples/all/manifests/thanos-store-statefulSet.yaml b/examples/all/manifests/thanos-store-statefulSet.yaml index 525cbcf6..96d13d21 100644 --- a/examples/all/manifests/thanos-store-statefulSet.yaml +++ b/examples/all/manifests/thanos-store-statefulSet.yaml @@ -87,6 +87,12 @@ spec: "metafile_exists_ttl": "2h" "metafile_max_size": "1MiB" "type": "memcached" + - |- + --tracing.config="config": + "sampler_param": 2 + "sampler_type": "ratelimiting" + "service_name": "thanos-store" + "type": "JAEGER" env: - name: OBJSTORE_CONFIG valueFrom: diff --git a/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet b/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet index a6519a40..db159503 100644 --- a/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-bucket.libsonnet @@ -10,6 +10,7 @@ local defaults = { ports: { http: 10902, }, + tracing: {}, commonLabels:: { 'app.kubernetes.io/name': 'thanos-bucket', @@ -69,7 +70,13 @@ function(params) { 'web', '--log.level=' + tb.config.logLevel, '--objstore.config=$(OBJSTORE_CONFIG)', - ], + ] + ( + if std.length(tb.config.tracing) > 0 then [ + '--tracing.config=' + std.manifestYamlDoc( + { config+: { service_name: defaults.name } } + tb.config.tracing + ), + ] else [] + ), env: [ { name: 'OBJSTORE_CONFIG', valueFrom: { secretKeyRef: { key: tb.config.objectStorageConfig.key, diff --git a/jsonnet/kube-thanos/kube-thanos-compact.libsonnet b/jsonnet/kube-thanos/kube-thanos-compact.libsonnet index aade9f0d..afe18b9d 100644 --- a/jsonnet/kube-thanos/kube-thanos-compact.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-compact.libsonnet @@ -18,6 +18,7 @@ local defaults = { ports: { http: 10902, }, + tracing: {}, commonLabels:: { 'app.kubernetes.io/name': 'thanos-compact', @@ -93,6 +94,12 @@ function(params) { '--deduplication.replica-label=' + l for l in tc.config.deduplicationReplicaLabels ] else [] + ) + ( + if std.length(tc.config.tracing) > 0 then [ + '--tracing.config=' + std.manifestYamlDoc( + { config+: { service_name: defaults.name } } + tc.config.tracing + ), + ] else [] ), env: [ { name: 'OBJSTORE_CONFIG', valueFrom: { secretKeyRef: { diff --git a/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet b/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet index 4ad48a20..67ad75e8 100644 --- a/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet @@ -17,7 +17,7 @@ local defaults = { max_size: '0', // Don't limit maximum item size. max_size_items: 2048, validity: '6h', - } + }, }, queryRangeCache: {}, labelsCache: {}, @@ -27,6 +27,7 @@ local defaults = { ports: { http: 9090, }, + tracing: {}, memcachedDefaults+:: { config+: { @@ -72,7 +73,7 @@ function(params) { if std.objectHas(params, 'labelsCache') && params.labelsCache.type == 'memcached' then defaults.memcachedDefaults + params.labelsCache else if std.objectHas(params, 'labelsCache') && params.labelsCache.type == 'in-memory' then - defaults.fifoCache + params.labelsCache + defaults.fifoCache + params.labelsCache else {}, }, // Safety checks for combined config of defaults and params @@ -132,6 +133,12 @@ function(params) { tqf.config.labelsCache ), ] else [] + ) + ( + if std.length(tqf.config.tracing) > 0 then [ + '--tracing.config=' + std.manifestYamlDoc( + { config+: { service_name: defaults.name } } + tqf.config.tracing + ), + ] else [] ), ports: [ { name: name, containerPort: tqf.config.ports[name] } diff --git a/jsonnet/kube-thanos/kube-thanos-query.libsonnet b/jsonnet/kube-thanos/kube-thanos-query.libsonnet index 3ebec306..ac2cf4bb 100644 --- a/jsonnet/kube-thanos/kube-thanos-query.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-query.libsonnet @@ -20,6 +20,7 @@ local defaults = { }, serviceMonitor: false, logLevel: 'info', + tracing: {}, commonLabels:: { 'app.kubernetes.io/name': 'thanos-query', @@ -104,6 +105,12 @@ function(params) { if tq.config.lookbackDelta != '' then [ '--query.lookback-delta=' + tq.config.lookbackDelta, ] else [] + ) + ( + if std.length(tq.config.tracing) > 0 then [ + '--tracing.config=' + std.manifestYamlDoc( + { config+: { service_name: defaults.name } } + tq.config.tracing + ), + ] else [] ), ports: [ { name: port.name, containerPort: port.port } diff --git a/jsonnet/kube-thanos/kube-thanos-receive.libsonnet b/jsonnet/kube-thanos/kube-thanos-receive.libsonnet index 186ecd89..972a9363 100644 --- a/jsonnet/kube-thanos/kube-thanos-receive.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-receive.libsonnet @@ -22,6 +22,7 @@ local defaults = { http: 10902, 'remote-write': 19291, }, + tracing: {}, commonLabels:: { 'app.kubernetes.io/name': 'thanos-receive', @@ -101,6 +102,12 @@ function(params) { if tr.config.hashringConfigMapName != '' then [ '--receive.hashrings-file=/var/lib/thanos-receive/hashrings.json', ] else [] + ) + ( + if std.length(tr.config.tracing) > 0 then [ + '--tracing.config=' + std.manifestYamlDoc( + { config+: { service_name: defaults.name } } + tr.config.tracing + ), + ] else [] ), env: [ { name: 'NAME', valueFrom: { fieldRef: { fieldPath: 'metadata.name' } } }, diff --git a/jsonnet/kube-thanos/kube-thanos-rule.libsonnet b/jsonnet/kube-thanos/kube-thanos-rule.libsonnet index dbc084ab..bf036ce3 100644 --- a/jsonnet/kube-thanos/kube-thanos-rule.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-rule.libsonnet @@ -20,6 +20,7 @@ local defaults = { grpc: 10901, http: 10902, }, + tracing: {}, commonLabels:: { 'app.kubernetes.io/name': 'thanos-rule', @@ -93,10 +94,19 @@ function(params) { (['--query=%s' % querier for querier in tr.config.queriers]) + (['--rule-file=%s' % path for path in tr.config.ruleFiles]) + (['--alertmanagers.url=%s' % url for url in tr.config.alertmanagersURLs]) + - (if std.length(tr.config.rulesConfig) > 0 then [ - '--rule-file=/etc/thanos/rules/' + ruleConfig.name + '/' + ruleConfig.key - for ruleConfig in tr.config.rulesConfig - ] else []), + ( + if std.length(tr.config.rulesConfig) > 0 then [ + '--rule-file=/etc/thanos/rules/' + ruleConfig.name + '/' + ruleConfig.key + for ruleConfig in tr.config.rulesConfig + ] + else [] + ) + ( + if std.length(tr.config.tracing) > 0 then [ + '--tracing.config=' + std.manifestYamlDoc( + { config+: { service_name: defaults.name } } + tr.config.tracing + ), + ] else [] + ), env: [ { name: 'NAME', valueFrom: { fieldRef: { fieldPath: 'metadata.name' } } }, { name: 'OBJSTORE_CONFIG', valueFrom: { secretKeyRef: { diff --git a/jsonnet/kube-thanos/kube-thanos-store.libsonnet b/jsonnet/kube-thanos/kube-thanos-store.libsonnet index 472a2234..ca3f4925 100644 --- a/jsonnet/kube-thanos/kube-thanos-store.libsonnet +++ b/jsonnet/kube-thanos/kube-thanos-store.libsonnet @@ -20,6 +20,7 @@ local defaults = { grpc: 10901, http: 10902, }, + tracing: {}, memcachedDefaults+:: { config+: { @@ -134,6 +135,12 @@ function(params) { if std.length(ts.config.bucketCache) > 0 then [ '--store.caching-bucket.config=' + std.manifestYamlDoc(ts.config.bucketCache), ] else [] + ) + ( + if std.length(ts.config.tracing) > 0 then [ + '--tracing.config=' + std.manifestYamlDoc( + { config+: { service_name: defaults.name } } + ts.config.tracing + ), + ] else [] ), env: [ { name: 'OBJSTORE_CONFIG', valueFrom: { secretKeyRef: {