Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --tracing.config support to all components #169

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions all.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions examples/all/manifests/thanos-bucket-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions examples/all/manifests/thanos-compact-statefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions examples/all/manifests/thanos-query-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions examples/all/manifests/thanos-query-frontend-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions examples/all/manifests/thanos-receive-statefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions examples/all/manifests/thanos-rule-statefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions examples/all/manifests/thanos-store-statefulSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 8 additions & 1 deletion jsonnet/kube-thanos/kube-thanos-bucket.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local defaults = {
ports: {
http: 10902,
},
tracing: {},

commonLabels:: {
'app.kubernetes.io/name': 'thanos-bucket',
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions jsonnet/kube-thanos/kube-thanos-compact.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local defaults = {
ports: {
http: 10902,
},
tracing: {},

commonLabels:: {
'app.kubernetes.io/name': 'thanos-compact',
Expand Down Expand Up @@ -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: {
Expand Down
11 changes: 9 additions & 2 deletions jsonnet/kube-thanos/kube-thanos-query-frontend.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local defaults = {
max_size: '0', // Don't limit maximum item size.
max_size_items: 2048,
validity: '6h',
}
},
},
queryRangeCache: {},
labelsCache: {},
Expand All @@ -27,6 +27,7 @@ local defaults = {
ports: {
http: 9090,
},
tracing: {},

memcachedDefaults+:: {
config+: {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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] }
Expand Down
7 changes: 7 additions & 0 deletions jsonnet/kube-thanos/kube-thanos-query.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local defaults = {
},
serviceMonitor: false,
logLevel: 'info',
tracing: {},

commonLabels:: {
'app.kubernetes.io/name': 'thanos-query',
Expand Down Expand Up @@ -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 }
Expand Down
7 changes: 7 additions & 0 deletions jsonnet/kube-thanos/kube-thanos-receive.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ local defaults = {
http: 10902,
'remote-write': 19291,
},
tracing: {},

commonLabels:: {
'app.kubernetes.io/name': 'thanos-receive',
Expand Down Expand Up @@ -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' } } },
Expand Down
18 changes: 14 additions & 4 deletions jsonnet/kube-thanos/kube-thanos-rule.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local defaults = {
grpc: 10901,
http: 10902,
},
tracing: {},

commonLabels:: {
'app.kubernetes.io/name': 'thanos-rule',
Expand Down Expand Up @@ -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: {
Expand Down
7 changes: 7 additions & 0 deletions jsonnet/kube-thanos/kube-thanos-store.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local defaults = {
grpc: 10901,
http: 10902,
},
tracing: {},

memcachedDefaults+:: {
config+: {
Expand Down Expand Up @@ -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: {
Expand Down