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

[BREAKING CHANGE] Switch protocol for internal traces from Jaeger to OTLP/HTTP #1103

Closed
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
18 changes: 18 additions & 0 deletions .chloggen/internal_tracing_protocol.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking

# The name of the component, or a single word describing the area of concern, (e.g. tempostack, tempomonolithic, github action)
component: operator

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Switch protocol for internal traces from Jaeger to OTLP/HTTP

# One or more tracking issues related to the change
issues: [1103]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: |
Exporting internal traces (traces generated by Tempo and the gateway) via the Jaeger/Thrift protocol and the `.spec.observability.tracing.jaeger_agent_endpoint` setting is deprecated.
Please migrate to the OTLP/HTTP protocol and the new `.spec.observability.tracing.otlp_http_endpoint` setting.
10 changes: 9 additions & 1 deletion api/tempo/v1alpha1/tempostack_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,15 @@ type TracingConfigSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Sampling Fraction"
SamplingFraction string `json:"sampling_fraction,omitempty"`

// JaegerAgentEndpoint defines the jaeger endpoint data gets send to.
// OTLPHTTPEndpoint defines the OTLP/HTTP endpoint data gets send to.
//
// +optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:="localhost:4318"
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="OTLP/HTTP Endpoint"
OTLPHTTPEndpoint string `json:"otlp_http_endpoint,omitempty"`

// DEPRECATED. JaegerAgentEndpoint defines the jaeger endpoint data gets send to.
//
// +optional
// +kubebuilder:validation:Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ metadata:
capabilities: Deep Insights
categories: Logging & Tracing,Monitoring
containerImage: ghcr.io/grafana/tempo-operator/tempo-operator:v0.14.2
createdAt: "2025-01-16T09:58:41Z"
createdAt: "2025-01-24T16:17:12Z"
description: Create and manage deployments of Tempo, a high-scale distributed
tracing backend.
operatorframework.io/cluster-monitoring: "true"
Expand Down Expand Up @@ -757,10 +757,14 @@ spec:
- description: Tracing defines a config for operands.
displayName: Tracing Config
path: observability.tracing
- description: JaegerAgentEndpoint defines the jaeger endpoint data gets send
to.
- description: DEPRECATED. JaegerAgentEndpoint defines the jaeger endpoint data
gets send to.
displayName: Jaeger-Agent-Endpoint
path: observability.tracing.jaeger_agent_endpoint
- description: OTLPHTTPEndpoint defines the OTLP/HTTP endpoint data gets send
to.
displayName: OTLP/HTTP Endpoint
path: observability.tracing.otlp_http_endpoint
- description: SamplingFraction defines the sampling ratio. Valid values are
0 to 1.
displayName: Sampling Fraction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,12 @@ spec:
properties:
jaeger_agent_endpoint:
default: localhost:6831
description: JaegerAgentEndpoint defines the jaeger endpoint
description: DEPRECATED. JaegerAgentEndpoint defines the jaeger
endpoint data gets send to.
type: string
otlp_http_endpoint:
default: localhost:4318
description: OTLPHTTPEndpoint defines the OTLP/HTTP endpoint
data gets send to.
type: string
sampling_fraction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ metadata:
capabilities: Deep Insights
categories: Logging & Tracing,Monitoring
containerImage: ghcr.io/grafana/tempo-operator/tempo-operator:v0.14.2
createdAt: "2025-01-16T09:58:39Z"
createdAt: "2025-01-24T16:17:11Z"
description: Create and manage deployments of Tempo, a high-scale distributed
tracing backend.
operatorframework.io/cluster-monitoring: "true"
Expand Down Expand Up @@ -757,10 +757,14 @@ spec:
- description: Tracing defines a config for operands.
displayName: Tracing Config
path: observability.tracing
- description: JaegerAgentEndpoint defines the jaeger endpoint data gets send
to.
- description: DEPRECATED. JaegerAgentEndpoint defines the jaeger endpoint data
gets send to.
displayName: Jaeger-Agent-Endpoint
path: observability.tracing.jaeger_agent_endpoint
- description: OTLPHTTPEndpoint defines the OTLP/HTTP endpoint data gets send
to.
displayName: OTLP/HTTP Endpoint
path: observability.tracing.otlp_http_endpoint
- description: SamplingFraction defines the sampling ratio. Valid values are
0 to 1.
displayName: Sampling Fraction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,12 @@ spec:
properties:
jaeger_agent_endpoint:
default: localhost:6831
description: JaegerAgentEndpoint defines the jaeger endpoint
description: DEPRECATED. JaegerAgentEndpoint defines the jaeger
endpoint data gets send to.
type: string
otlp_http_endpoint:
default: localhost:4318
description: OTLPHTTPEndpoint defines the OTLP/HTTP endpoint
data gets send to.
type: string
sampling_fraction:
Expand Down
7 changes: 6 additions & 1 deletion config/crd/bases/tempo.grafana.com_tempostacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,12 @@ spec:
properties:
jaeger_agent_endpoint:
default: localhost:6831
description: JaegerAgentEndpoint defines the jaeger endpoint
description: DEPRECATED. JaegerAgentEndpoint defines the jaeger
endpoint data gets send to.
type: string
otlp_http_endpoint:
default: localhost:4318
description: OTLPHTTPEndpoint defines the OTLP/HTTP endpoint
data gets send to.
type: string
sampling_fraction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,14 @@ spec:
- description: Tracing defines a config for operands.
displayName: Tracing Config
path: observability.tracing
- description: JaegerAgentEndpoint defines the jaeger endpoint data gets send
to.
- description: DEPRECATED. JaegerAgentEndpoint defines the jaeger endpoint data
gets send to.
displayName: Jaeger-Agent-Endpoint
path: observability.tracing.jaeger_agent_endpoint
- description: OTLPHTTPEndpoint defines the OTLP/HTTP endpoint data gets send
to.
displayName: OTLP/HTTP Endpoint
path: observability.tracing.otlp_http_endpoint
- description: SamplingFraction defines the sampling ratio. Valid values are
0 to 1.
displayName: Sampling Fraction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,14 @@ spec:
- description: Tracing defines a config for operands.
displayName: Tracing Config
path: observability.tracing
- description: JaegerAgentEndpoint defines the jaeger endpoint data gets send
to.
- description: DEPRECATED. JaegerAgentEndpoint defines the jaeger endpoint data
gets send to.
displayName: Jaeger-Agent-Endpoint
path: observability.tracing.jaeger_agent_endpoint
- description: OTLPHTTPEndpoint defines the OTLP/HTTP endpoint data gets send
to.
displayName: OTLP/HTTP Endpoint
path: observability.tracing.otlp_http_endpoint
- description: SamplingFraction defines the sampling ratio. Valid values are
0 to 1.
displayName: Sampling Fraction
Expand Down
3 changes: 2 additions & 1 deletion docs/spec/tempo.grafana.com_tempostacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ spec: # TempoStackSpec defines the desired st
createPrometheusRules: false # CreatePrometheusRules specifies if Prometheus rules for alerts should be created for Tempo components.
createServiceMonitors: false # CreateServiceMonitors specifies if ServiceMonitors should be created for Tempo components.
tracing: # Tracing defines a config for operands.
jaeger_agent_endpoint: "localhost:6831" # JaegerAgentEndpoint defines the jaeger endpoint data gets send to.
jaeger_agent_endpoint: "localhost:6831" # DEPRECATED. JaegerAgentEndpoint defines the jaeger endpoint data gets send to.
otlp_http_endpoint: "localhost:4318" # OTLPHTTPEndpoint defines the OTLP/HTTP endpoint data gets send to.
sampling_fraction: "" # SamplingFraction defines the sampling ratio. Valid values are 0 to 1.
replicationFactor: 0 # The replication factor is a configuration setting that determines how many ingesters need to acknowledge the data from the distributors before accepting a span.
retention: # Retention period defined by dataset. User can specify how long data should be stored.
Expand Down
7 changes: 3 additions & 4 deletions internal/manifests/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"net"
"net/url"
"path"

"github.com/imdario/mergo"
Expand Down Expand Up @@ -362,15 +362,14 @@ func patchTracing(tempo v1alpha1.TempoStack, pod corev1.PodTemplateSpec) (corev1
return pod, nil
}

host, port, err := net.SplitHostPort(tempo.Spec.Observability.Tracing.JaegerAgentEndpoint)
_, err := url.ParseRequestURI(tempo.Spec.Observability.Tracing.OTLPHTTPEndpoint)
if err != nil {
return corev1.PodTemplateSpec{}, err
}

container := corev1.Container{
Args: []string{
fmt.Sprintf("--internal.tracing.endpoint=%s:%s", host, port),
"--internal.tracing.endpoint-type=agent",
fmt.Sprintf("--internal.tracing.otlp-http-endpoint=%s", tempo.Spec.Observability.Tracing.OTLPHTTPEndpoint),
fmt.Sprintf("--internal.tracing.sampling-fraction=%s", tempo.Spec.Observability.Tracing.SamplingFraction),
},
}
Expand Down
21 changes: 11 additions & 10 deletions internal/manifests/gateway/gateway_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package gateway

import (
"errors"
"fmt"
"net"
"net/url"
"reflect"
"testing"

Expand Down Expand Up @@ -283,8 +284,8 @@ func TestPatchTracing(t *testing.T) {
Spec: v1alpha1.TempoStackSpec{
Observability: v1alpha1.ObservabilitySpec{
Tracing: v1alpha1.TracingConfigSpec{
SamplingFraction: "1.0",
JaegerAgentEndpoint: "agent:1234",
SamplingFraction: "1.0",
OTLPHTTPEndpoint: "http://collector:4318",
},
},
},
Expand Down Expand Up @@ -319,8 +320,7 @@ func TestPatchTracing(t *testing.T) {
Name: containerNameTempoGateway,
Args: []string{
"--abc",
"--internal.tracing.endpoint=agent:1234",
"--internal.tracing.endpoint-type=agent",
"--internal.tracing.otlp-http-endpoint=http://collector:4318",
"--internal.tracing.sampling-fraction=1.0",
},
},
Expand Down Expand Up @@ -374,17 +374,18 @@ func TestPatchTracing(t *testing.T) {
Spec: v1alpha1.TempoStackSpec{
Observability: v1alpha1.ObservabilitySpec{
Tracing: v1alpha1.TracingConfigSpec{
SamplingFraction: "0.5",
JaegerAgentEndpoint: "---invalid----",
SamplingFraction: "0.5",
OTLPHTTPEndpoint: "---invalid----",
},
},
},
},
inputPod: corev1.PodTemplateSpec{},
expectPod: corev1.PodTemplateSpec{},
expectErr: &net.AddrError{
Addr: "---invalid----",
Err: "missing port in address",
expectErr: &url.Error{
Op: "parse",
URL: "---invalid----",
Err: errors.New("invalid URI for request"),
},
},
}
Expand Down
21 changes: 9 additions & 12 deletions internal/manifests/manifestutils/tracing.go
Original file line number Diff line number Diff line change
@@ -1,41 +1,38 @@
package manifestutils

import (
"net"
"net/url"

"github.com/imdario/mergo"
corev1 "k8s.io/api/core/v1"

"github.com/grafana/tempo-operator/api/tempo/v1alpha1"
)

// PatchTracingJaegerEnv adds configures jaeger-sdk via environment variables if
// PatchTracingJaegerEnv adds configures OTEL SDK via environment variables if
// operand observability settings exist.
func PatchTracingJaegerEnv(tempo v1alpha1.TempoStack, pod corev1.PodTemplateSpec) (corev1.PodTemplateSpec, error) {
if tempo.Spec.Observability.Tracing.SamplingFraction == "" {
return pod, nil
}
host, port, err := net.SplitHostPort(tempo.Spec.Observability.Tracing.JaegerAgentEndpoint)

_, err := url.ParseRequestURI(tempo.Spec.Observability.Tracing.OTLPHTTPEndpoint)
if err != nil {
return corev1.PodTemplateSpec{}, err
}

container := corev1.Container{
Env: []corev1.EnvVar{
{
Name: "JAEGER_AGENT_HOST",
Value: host,
},
{
Name: "JAEGER_AGENT_PORT",
Value: port,
Name: "OTEL_EXPORTER_OTLP_ENDPOINT",
Value: tempo.Spec.Observability.Tracing.OTLPHTTPEndpoint,
},
{
Name: "JAEGER_SAMPLER_TYPE",
Value: "const",
Name: "OTEL_TRACES_SAMPLER",
Value: "parentbased_traceidratio",
},
{
Name: "JAEGER_SAMPLER_PARAM",
Name: "OTEL_TRACES_SAMPLER_ARG",
Value: tempo.Spec.Observability.Tracing.SamplingFraction,
},
},
Expand Down
32 changes: 15 additions & 17 deletions internal/manifests/manifestutils/tracing_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package manifestutils

import (
"net"
"errors"
"net/url"
"testing"

"github.com/stretchr/testify/assert"
Expand All @@ -26,8 +27,8 @@ func Test_PatchTracingJaegerEnv(t *testing.T) {
Spec: v1alpha1.TempoStackSpec{
Observability: v1alpha1.ObservabilitySpec{
Tracing: v1alpha1.TracingConfigSpec{
SamplingFraction: "1.0",
JaegerAgentEndpoint: "agent:1234",
SamplingFraction: "1.0",
OTLPHTTPEndpoint: "http://collector:4318",
},
},
},
Expand Down Expand Up @@ -69,19 +70,15 @@ func Test_PatchTracingJaegerEnv(t *testing.T) {
Value: "1234",
},
{
Name: "JAEGER_AGENT_HOST",
Value: "agent",
Name: "OTEL_EXPORTER_OTLP_ENDPOINT",
Value: "http://collector:4318",
},
{
Name: "JAEGER_AGENT_PORT",
Value: "1234",
},
{
Name: "JAEGER_SAMPLER_TYPE",
Value: "const",
Name: "OTEL_TRACES_SAMPLER",
Value: "parentbased_traceidratio",
},
{
Name: "JAEGER_SAMPLER_PARAM",
Name: "OTEL_TRACES_SAMPLER_ARG",
Value: "1.0",
},
},
Expand Down Expand Up @@ -148,17 +145,18 @@ func Test_PatchTracingJaegerEnv(t *testing.T) {
Spec: v1alpha1.TempoStackSpec{
Observability: v1alpha1.ObservabilitySpec{
Tracing: v1alpha1.TracingConfigSpec{
SamplingFraction: "0.5",
JaegerAgentEndpoint: "---invalid----",
SamplingFraction: "0.5",
OTLPHTTPEndpoint: "---invalid----",
},
},
},
},
inputPod: corev1.PodTemplateSpec{},
expectPod: corev1.PodTemplateSpec{},
expectErr: &net.AddrError{
Addr: "---invalid----",
Err: "missing port in address",
expectErr: &url.Error{
Op: "parse",
URL: "---invalid----",
Err: errors.New("invalid URI for request"),
},
},
}
Expand Down
Loading
Loading