Skip to content

Commit 540046b

Browse files
Do not set --prometheus.query.namespace if field is empty (#1096)
* Do not set --prometheus.query.namespace if field is empty Do not set `--prometheus.query.namespace` if `.spec.template.queryFrontend.jaegerQuery.monitorTab.redMetricsNamespace` is empty. Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com> * switch to bug_fix because the embedded jaeger 1.62 sets the new default traces_span_metrics namespace Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com> --------- Signed-off-by: Andreas Gerstmayr <agerstmayr@redhat.com>
1 parent 7957d75 commit 540046b

File tree

14 files changed

+89
-39
lines changed

14 files changed

+89
-39
lines changed

.chloggen/red_metrics_namespace.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: bug_fix
3+
# The name of the component, or a single word describing the area of concern, (e.g. tempostack, tempomonolithic, github action)
4+
component: tempostack
5+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
6+
note: Use default Jaeger RED metrics namespace if field is unset
7+
# One or more tracking issues related to the change
8+
issues: [1096]
9+
# (Optional) One or more lines of additional information to render under the primary note.
10+
# These lines will be padded with 2 spaces and then inserted directly into the document.
11+
# Use pipe (|) for multiline entries.
12+
subtext: |
13+
Use the default Jaeger RED metrics namespace if `.spec.template.queryFrontend.jaegerQuery.monitorTab.redMetricsNamespace` is not set.
14+
Before Jaeger 1.62 the default namespace was empty, since [Jaeger 1.62](https://github.com/jaegertracing/jaeger/releases/tag/v1.62.0) (shipped in Tempo Operator v0.14.0) the default namespace is "traces_span_metrics".
15+
Before OpenTelemetry Collector v0.109.0 the default namespace of the spanmetrics connector was empty, since [OpenTelemetry Collector v0.109.0](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.109.0) the default namespace is "traces_span_metrics".

apis/tempo/v1alpha1/tempostack_types.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,10 @@ type JaegerQueryMonitor struct {
690690
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Prometheus endpoint"
691691
PrometheusEndpoint string `json:"prometheusEndpoint"`
692692
// REDMetricsNamespace defines the a prefix used retrieve span rate, error, and duration (RED) metrics.
693-
// By default it is set to `traces.span.metrics` following the default namespace of the OpenTelemetry Collector since Version 0.109.0.
694693
// +optional
695694
// +kubebuilder:validation:Optional
696-
// +kubebuilder:default:=traces.span.metrics
697695
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="RED Metric Namespace"
698-
REDMetricsNamespace string `json:"redMetricsNamespace"`
696+
REDMetricsNamespace *string `json:"redMetricsNamespace,omitempty"`
699697
}
700698

701699
// IngressSpec defines Jaeger Query Ingress options.

apis/tempo/v1alpha1/zz_generated.deepcopy.go

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/community/manifests/tempo-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ metadata:
7474
capabilities: Deep Insights
7575
categories: Logging & Tracing,Monitoring
7676
containerImage: ghcr.io/grafana/tempo-operator/tempo-operator:v0.14.1
77-
createdAt: "2024-11-06T14:25:14Z"
77+
createdAt: "2024-12-02T11:40:40Z"
7878
description: Create and manage deployments of Tempo, a high-scale distributed
7979
tracing backend.
8080
operatorframework.io/cluster-monitoring: "true"
@@ -1071,9 +1071,7 @@ spec:
10711071
displayName: Prometheus endpoint
10721072
path: template.queryFrontend.jaegerQuery.monitorTab.prometheusEndpoint
10731073
- description: REDMetricsNamespace defines the a prefix used retrieve span rate,
1074-
error, and duration (RED) metrics. By default it is set to `traces.span.metrics`
1075-
following the default namespace of the OpenTelemetry Collector since Version
1076-
0.109.0.
1074+
error, and duration (RED) metrics.
10771075
displayName: RED Metric Namespace
10781076
path: template.queryFrontend.jaegerQuery.monitorTab.redMetricsNamespace
10791077
- description: Resources defines resources for this component, this will override

bundle/community/manifests/tempo.grafana.com_tempostacks.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,10 +2471,9 @@ spec:
24712471
For instance on OpenShift this is set to https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
24722472
type: string
24732473
redMetricsNamespace:
2474-
default: traces.span.metrics
2475-
description: |-
2476-
REDMetricsNamespace defines the a prefix used retrieve span rate, error, and duration (RED) metrics.
2477-
By default it is set to `traces.span.metrics` following the default namespace of the OpenTelemetry Collector since Version 0.109.0.
2474+
description: REDMetricsNamespace defines the a prefix
2475+
used retrieve span rate, error, and duration (RED)
2476+
metrics.
24782477
type: string
24792478
type: object
24802479
resources:

bundle/openshift/manifests/tempo-operator.clusterserviceversion.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ metadata:
7474
capabilities: Deep Insights
7575
categories: Logging & Tracing,Monitoring
7676
containerImage: ghcr.io/grafana/tempo-operator/tempo-operator:v0.14.1
77-
createdAt: "2024-11-06T14:25:12Z"
77+
createdAt: "2024-12-02T11:40:38Z"
7878
description: Create and manage deployments of Tempo, a high-scale distributed
7979
tracing backend.
8080
operatorframework.io/cluster-monitoring: "true"
@@ -1071,9 +1071,7 @@ spec:
10711071
displayName: Prometheus endpoint
10721072
path: template.queryFrontend.jaegerQuery.monitorTab.prometheusEndpoint
10731073
- description: REDMetricsNamespace defines the a prefix used retrieve span rate,
1074-
error, and duration (RED) metrics. By default it is set to `traces.span.metrics`
1075-
following the default namespace of the OpenTelemetry Collector since Version
1076-
0.109.0.
1074+
error, and duration (RED) metrics.
10771075
displayName: RED Metric Namespace
10781076
path: template.queryFrontend.jaegerQuery.monitorTab.redMetricsNamespace
10791077
- description: Resources defines resources for this component, this will override

bundle/openshift/manifests/tempo.grafana.com_tempostacks.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,10 +2471,9 @@ spec:
24712471
For instance on OpenShift this is set to https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
24722472
type: string
24732473
redMetricsNamespace:
2474-
default: traces.span.metrics
2475-
description: |-
2476-
REDMetricsNamespace defines the a prefix used retrieve span rate, error, and duration (RED) metrics.
2477-
By default it is set to `traces.span.metrics` following the default namespace of the OpenTelemetry Collector since Version 0.109.0.
2474+
description: REDMetricsNamespace defines the a prefix
2475+
used retrieve span rate, error, and duration (RED)
2476+
metrics.
24782477
type: string
24792478
type: object
24802479
resources:

config/crd/bases/tempo.grafana.com_tempostacks.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,10 +2467,9 @@ spec:
24672467
For instance on OpenShift this is set to https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
24682468
type: string
24692469
redMetricsNamespace:
2470-
default: traces.span.metrics
2471-
description: |-
2472-
REDMetricsNamespace defines the a prefix used retrieve span rate, error, and duration (RED) metrics.
2473-
By default it is set to `traces.span.metrics` following the default namespace of the OpenTelemetry Collector since Version 0.109.0.
2470+
description: REDMetricsNamespace defines the a prefix
2471+
used retrieve span rate, error, and duration (RED)
2472+
metrics.
24742473
type: string
24752474
type: object
24762475
resources:

config/manifests/community/bases/tempo-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,9 +1000,7 @@ spec:
10001000
displayName: Prometheus endpoint
10011001
path: template.queryFrontend.jaegerQuery.monitorTab.prometheusEndpoint
10021002
- description: REDMetricsNamespace defines the a prefix used retrieve span rate,
1003-
error, and duration (RED) metrics. By default it is set to `traces.span.metrics`
1004-
following the default namespace of the OpenTelemetry Collector since Version
1005-
0.109.0.
1003+
error, and duration (RED) metrics.
10061004
displayName: RED Metric Namespace
10071005
path: template.queryFrontend.jaegerQuery.monitorTab.redMetricsNamespace
10081006
- description: Resources defines resources for this component, this will override

config/manifests/openshift/bases/tempo-operator.clusterserviceversion.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,9 +1000,7 @@ spec:
10001000
displayName: Prometheus endpoint
10011001
path: template.queryFrontend.jaegerQuery.monitorTab.prometheusEndpoint
10021002
- description: REDMetricsNamespace defines the a prefix used retrieve span rate,
1003-
error, and duration (RED) metrics. By default it is set to `traces.span.metrics`
1004-
following the default namespace of the OpenTelemetry Collector since Version
1005-
0.109.0.
1003+
error, and duration (RED) metrics.
10061004
displayName: RED Metric Namespace
10071005
path: template.queryFrontend.jaegerQuery.monitorTab.redMetricsNamespace
10081006
- description: Resources defines resources for this component, this will override

docs/spec/tempo.grafana.com_tempostacks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ spec: # TempoStackSpec defines the desired st
342342
monitorTab: # MonitorTab defines the monitor tab configuration.
343343
enabled: false # Enabled enables the monitor tab in the Jaeger console. The PrometheusEndpoint must be configured to enable this feature.
344344
prometheusEndpoint: "" # PrometheusEndpoint defines the endpoint to the Prometheus instance that contains the span rate, error, and duration (RED) metrics. For instance on OpenShift this is set to https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
345-
redMetricsNamespace: "traces.span.metrics" # REDMetricsNamespace defines the a prefix used retrieve span rate, error, and duration (RED) metrics. By default it is set to `traces.span.metrics` following the default namespace of the OpenTelemetry Collector since Version 0.109.0.
345+
redMetricsNamespace: "" # REDMetricsNamespace defines the a prefix used retrieve span rate, error, and duration (RED) metrics.
346346
servicesQueryDuration: "" # ServicesQueryDuration defines how long the services will be available in the services list
347347
tempoQuery: # TempoQuery defines options specific to the Tempoo Query component.
348348
resources: # Resources defines resources for this component, this will override the calculated resources derived from total

internal/manifests/queryfrontend/query_frontend.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,11 +398,6 @@ func enableMonitoringTab(tempo v1alpha1.TempoStack, jaegerQueryContainer corev1.
398398
// However, we do not intend to support them.
399399
// --prometheus.query.normalize-calls
400400
// --prometheus.query.normalize-duration
401-
//
402-
// NOTE: Jaeger 1.62 default namespace changed to "traces_span_metrics".
403-
// We fallback to no namespace.
404-
// See https://github.com/jaegertracing/jaeger/pull/6007.
405-
fmt.Sprintf("--prometheus.query.namespace=%s", tempo.Spec.Template.QueryFrontend.JaegerQuery.MonitorTab.REDMetricsNamespace),
406401
},
407402
}
408403
// If the endpoint matches Prometheus on OpenShift, configure TLS and token based auth
@@ -417,6 +412,15 @@ func enableMonitoringTab(tempo v1alpha1.TempoStack, jaegerQueryContainer corev1.
417412
"--prometheus.tls.ca=/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt")
418413
}
419414

415+
if tempo.Spec.Template.QueryFrontend.JaegerQuery.MonitorTab.REDMetricsNamespace != nil {
416+
// NOTE: Jaeger 1.62 default namespace changed to "traces_span_metrics".
417+
// Set .spec.template.queryFrontend.jaegerQuery.monitorTab.redMetricsNamespace explicitly to "" to disable the namespace.
418+
// See https://github.com/jaegertracing/jaeger/pull/6007.
419+
container.Args = append(container.Args,
420+
fmt.Sprintf("--prometheus.query.namespace=%s", *tempo.Spec.Template.QueryFrontend.JaegerQuery.MonitorTab.REDMetricsNamespace),
421+
)
422+
}
423+
420424
err := mergo.Merge(&jaegerQueryContainer, container, mergo.WithAppendSlice)
421425
if err != nil {
422426
return corev1.Container{}, err

internal/manifests/queryfrontend/query_frontend_test.go

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,26 @@ func TestBuildQueryFrontendWithJaegerMonitorTab(t *testing.T) {
614614
},
615615
{
616616
name: "custom prometheus",
617+
tempo: v1alpha1.TempoStack{
618+
Spec: v1alpha1.TempoStackSpec{
619+
Template: v1alpha1.TempoTemplateSpec{
620+
QueryFrontend: v1alpha1.TempoQueryFrontendSpec{
621+
JaegerQuery: v1alpha1.JaegerQuerySpec{
622+
Enabled: true,
623+
MonitorTab: v1alpha1.JaegerQueryMonitor{
624+
Enabled: true,
625+
PrometheusEndpoint: "http://prometheus:9091",
626+
},
627+
},
628+
},
629+
},
630+
},
631+
},
632+
args: []string{"--query.base-path=/", "--span-storage.type=grpc", "--grpc-storage.server=localhost:7777", "--query.bearer-token-propagation=true"},
633+
env: []corev1.EnvVar{{Name: "METRICS_STORAGE_TYPE", Value: "prometheus"}, {Name: "PROMETHEUS_SERVER_URL", Value: "http://prometheus:9091"}},
634+
},
635+
{
636+
name: "custom RED metrics namespace",
617637
tempo: v1alpha1.TempoStack{
618638
Spec: v1alpha1.TempoStackSpec{
619639
Template: v1alpha1.TempoTemplateSpec{
@@ -623,7 +643,7 @@ func TestBuildQueryFrontendWithJaegerMonitorTab(t *testing.T) {
623643
MonitorTab: v1alpha1.JaegerQueryMonitor{
624644
Enabled: true,
625645
PrometheusEndpoint: "http://prometheus:9091",
626-
REDMetricsNamespace: "test",
646+
REDMetricsNamespace: ptr.To("test"),
627647
},
628648
},
629649
},
@@ -633,6 +653,27 @@ func TestBuildQueryFrontendWithJaegerMonitorTab(t *testing.T) {
633653
args: []string{"--query.base-path=/", "--span-storage.type=grpc", "--grpc-storage.server=localhost:7777", "--query.bearer-token-propagation=true", "--prometheus.query.namespace=test"},
634654
env: []corev1.EnvVar{{Name: "METRICS_STORAGE_TYPE", Value: "prometheus"}, {Name: "PROMETHEUS_SERVER_URL", Value: "http://prometheus:9091"}},
635655
},
656+
{
657+
name: "disable default RED metrics namespace",
658+
tempo: v1alpha1.TempoStack{
659+
Spec: v1alpha1.TempoStackSpec{
660+
Template: v1alpha1.TempoTemplateSpec{
661+
QueryFrontend: v1alpha1.TempoQueryFrontendSpec{
662+
JaegerQuery: v1alpha1.JaegerQuerySpec{
663+
Enabled: true,
664+
MonitorTab: v1alpha1.JaegerQueryMonitor{
665+
Enabled: true,
666+
PrometheusEndpoint: "http://prometheus:9091",
667+
REDMetricsNamespace: ptr.To(""),
668+
},
669+
},
670+
},
671+
},
672+
},
673+
},
674+
args: []string{"--query.base-path=/", "--span-storage.type=grpc", "--grpc-storage.server=localhost:7777", "--query.bearer-token-propagation=true", "--prometheus.query.namespace="},
675+
env: []corev1.EnvVar{{Name: "METRICS_STORAGE_TYPE", Value: "prometheus"}, {Name: "PROMETHEUS_SERVER_URL", Value: "http://prometheus:9091"}},
676+
},
636677
{
637678
name: "OpenShift user-workload monitoring",
638679
tempo: v1alpha1.TempoStack{
@@ -658,7 +699,6 @@ func TestBuildQueryFrontendWithJaegerMonitorTab(t *testing.T) {
658699
"--span-storage.type=grpc",
659700
"--grpc-storage.server=localhost:7777",
660701
"--query.bearer-token-propagation=true",
661-
"--prometheus.query.namespace=",
662702
"--prometheus.tls.enabled=true",
663703
"--prometheus.token-file=/var/run/secrets/kubernetes.io/serviceaccount/token",
664704
"--prometheus.token-override-from-context=false",

tests/e2e-openshift/red-metrics/03-install-tempo.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@ spec:
2828
monitorTab:
2929
enabled: true
3030
prometheusEndpoint: https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
31-
redMetricsNamespace: traces_span_metrics
3231
ingress:
3332
type: route

0 commit comments

Comments
 (0)