1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-21 11:48:53 +00:00

support thanos tracing

Signed-off-by: yeya24 <yb532204897@gmail.com>
This commit is contained in:
yeya24 2020-01-31 11:10:33 -05:00
parent 2e2d1ea6d9
commit d637e65ac5
11 changed files with 80 additions and 6 deletions

View file

@ -647,6 +647,7 @@ ThanosSpec defines parameters for a Prometheus server within a Thanos deployment
| resources | Resources defines the resource requirements for the Thanos sidecar. If not provided, no requests/limits will be set | [v1.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#resourcerequirements-v1-core) | false |
| objectStorageConfig | ObjectStorageConfig configures object storage in Thanos. | *[v1.SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#secretkeyselector-v1-core) | false |
| listenLocal | ListenLocal makes the Thanos sidecar listen on loopback, so that it does not bind against the Pod IP. | bool | false |
| tracingConfig | TracingConfig configures tracing in Thanos. This is an experimental feature, it may change in any upcoming release in a breaking way. | *[v1.SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#secretkeyselector-v1-core) | false |
[Back to TOC](#table-of-contents)
@ -700,6 +701,7 @@ ThanosRulerSpec is a specification of the desired behavior of the ThanosRuler. M
| portName | Port name used for the pods and governing service. This defaults to web | string | false |
| evaluationInterval | Interval between consecutive evaluations. | string | false |
| retention | Time duration ThanosRuler shall retain data for. Default is '24h', and must match the regular expression `[0-9]+(ms\|s\|m\|h\|d\|w\|y)` (milliseconds seconds minutes hours days weeks years). | string | false |
| tracingConfig | TracingConfig configures tracing in Thanos. This is an experimental feature, it may change in any upcoming release in a breaking way. | *[v1.SecretKeySelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#secretkeyselector-v1-core) | false |
[Back to TOC](#table-of-contents)

View file

@ -4529,6 +4529,25 @@ spec:
Defaults to the value of `version`. Version is ignored if Tag
is set.
type: string
tracingConfig:
description: TracingConfig configures tracing in Thanos. This is
an experimental feature, it may change in any upcoming release
in a breaking way.
properties:
key:
description: The key of the secret to select from. Must be
a valid secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must be defined
type: boolean
required:
- key
type: object
version:
description: Version describes the version of Thanos to use.
type: string

View file

@ -466,6 +466,25 @@ spec:
type: object
type: object
type: object
tracingConfig:
description: TracingConfig configures tracing in Thanos. This is an
experimental feature, it may change in any upcoming release in a breaking
way.
properties:
key:
description: The key of the secret to select from. Must be a valid
secret key.
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
optional:
description: Specify whether the Secret or its key must be defined
type: boolean
required:
- key
type: object
volumes:
description: Volumes allows configuration of additional volumes on the
output StatefulSet definition. Volumes specified will be appended

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -117,6 +117,8 @@ type ThanosRulerSpec struct {
// Time duration ThanosRuler shall retain data for. Default is '24h',
// and must match the regular expression `[0-9]+(ms|s|m|h|d|w|y)` (milliseconds seconds minutes hours days weeks years).
Retention string `json:"retention,omitempty"`
// TracingConfig configures tracing in Thanos. This is an experimental feature, it may change in any upcoming release in a breaking way.
TracingConfig *v1.SecretKeySelector `json:"tracingConfig,omitempty"`
}
// ThanosRulerStatus is the most recent observed status of the ThanosRuler. Read-only. Not

View file

@ -394,6 +394,8 @@ type ThanosSpec struct {
// ListenLocal makes the Thanos sidecar listen on loopback, so that it
// does not bind against the Pod IP.
ListenLocal bool `json:"listenLocal,omitempty"`
// TracingConfig configures tracing in Thanos. This is an experimental feature, it may change in any upcoming release in a breaking way.
TracingConfig *v1.SecretKeySelector `json:"tracingConfig,omitempty"`
}
// RemoteWriteSpec defines the remote_write configuration for prometheus.

View file

@ -1410,6 +1410,11 @@ func (in *ThanosRulerSpec) DeepCopyInto(out *ThanosRulerSpec) {
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
if in.TracingConfig != nil {
in, out := &in.TracingConfig, &out.TracingConfig
*out = new(corev1.SecretKeySelector)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosRulerSpec.
@ -1471,6 +1476,11 @@ func (in *ThanosSpec) DeepCopyInto(out *ThanosSpec) {
*out = new(corev1.SecretKeySelector)
(*in).DeepCopyInto(*out)
}
if in.TracingConfig != nil {
in, out := &in.TracingConfig, &out.TracingConfig
*out = new(corev1.SecretKeySelector)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ThanosSpec.

View file

@ -831,6 +831,16 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *Config, ruleConfigMapName
disableCompaction = true
}
if p.Spec.Thanos.TracingConfig != nil {
container.Args = append(container.Args, "--tracing.config=$(TRACING_CONFIG)")
container.Env = append(container.Env, v1.EnvVar{
Name: "TRACING_CONFIG",
ValueFrom: &v1.EnvVarSource{
SecretKeyRef: p.Spec.Thanos.TracingConfig,
},
})
}
if p.Spec.LogLevel != "" {
container.Args = append(container.Args, fmt.Sprintf("--log.level=%s", p.Spec.LogLevel))
}

View file

@ -198,6 +198,16 @@ func makeStatefulSetSpec(tr *monitoringv1.ThanosRuler, config Config, ruleConfig
})
}
if tr.Spec.TracingConfig != nil {
trCLIArgs = append(trCLIArgs, "--tracing.config=$(TRACING_CONFIG)")
trEnvVars = append(trEnvVars, v1.EnvVar{
Name: "TRACING_CONFIG",
ValueFrom: &v1.EnvVarSource{
SecretKeyRef: tr.Spec.TracingConfig,
},
})
}
localReloadURL := &url.URL{
Scheme: "http",
Host: config.LocalHost + ":10902",