Skip to content

Commit bbf0b04

Browse files
authored
feat(tracing): improve migration (#449)
1 parent 94803f2 commit bbf0b04

File tree

5 files changed

+139
-3
lines changed

5 files changed

+139
-3
lines changed

src/go/cmd/update-collection-v3/migrations/tracing-config/migrate.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,34 @@ func migrate(inputValues *ValuesInput) (ValuesOutput, error) {
4141
outputValues := ValuesOutput{
4242
Rest: inputValues.Rest,
4343
}
44+
45+
// otelcol-instrumentation migrations
4446
// migrate otelcol source processor to otelcol-instrumentation
4547
outputValues.OtelcolInstrumentation.Config.Processors.Source = inputValues.Otelcol.Config.Processors.Source
46-
// migrate otelcol cascading_filter processor to tracesSampler
48+
49+
// tracesgateway (old otelgateway) migrations
50+
// migrate deployment
51+
outputValues.TracesGateway.Deployment = inputValues.Otelgateway.Deployment
52+
// migrate loadbalancing exporter compression
53+
outputValues.TracesGateway.Config.Exporters.LoadBalancing.Protocol.Otlp.Compression = inputValues.Otelgateway.Config.Exporters.LoadBalancing.Protocol.Otlp.Compression
54+
// migration loadbalancing exporter num of consumers
55+
outputValues.TracesGateway.Config.Exporters.LoadBalancing.Protocol.Otlp.SendingQueue.NumConsumers = inputValues.Otelgateway.Config.Exporters.LoadBalancing.Protocol.Otlp.SendingQueue.NumConsumers
56+
// migration loadbalancing exporter queue size
57+
outputValues.TracesGateway.Config.Exporters.LoadBalancing.Protocol.Otlp.SendingQueue.QueueSize = inputValues.Otelgateway.Config.Exporters.LoadBalancing.Protocol.Otlp.SendingQueue.QueueSize
58+
// migrate batch processor
59+
outputValues.TracesGateway.Config.Processors.Batch = inputValues.Otelgateway.Config.Processors.Batch
60+
// migrate memory limiter processor
61+
outputValues.TracesGateway.Config.Processors.MemoryLimiter = inputValues.Otelgateway.Config.Processors.MemoryLimiter
62+
63+
// tracessampler (old oltecol) migrations
64+
// migrate deployment
65+
outputValues.TracesSampler.Deployment = inputValues.Otelcol.Deployment
66+
// migrate cascading_filter processor
4767
outputValues.TracesSampler.Config.Processors.CascadingFilter = inputValues.Otelcol.Config.Processors.CascadingFilter
68+
// migrate batch processor
69+
outputValues.TracesSampler.Config.Processors.Batch = inputValues.Otelcol.Config.Processors.Batch
70+
// migrate memory limiter processor
71+
outputValues.TracesSampler.Config.Processors.MemoryLimiter = inputValues.Otelcol.Config.Processors.MemoryLimiter
4872

4973
return outputValues, nil
5074
}

src/go/cmd/update-collection-v3/migrations/tracing-config/values_input.go

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,47 @@ package tracingconfig
22

33
type ValuesInput struct {
44
Otelcol Otelcol `yaml:"otelcol,omitempty"`
5+
Otelgateway Otelgateway `yaml:"otelgateway,omitempty"`
56
Otelagent map[string]interface{} `yaml:"otelagent,omitempty"`
6-
Otelgateway map[string]interface{} `yaml:"otelgateway,omitempty"`
77
Rest map[string]interface{} `yaml:",inline"`
88
}
99

1010
type Otelcol struct {
11-
Config struct {
11+
Deployment map[string]interface{} `yaml:"deployment,omitempty"`
12+
Config struct {
1213
Processors struct {
14+
Batch map[string]interface{} `yaml:"batch,omitempty"`
1315
CascadingFilter map[string]interface{} `yaml:"cascading_filter,omitempty"`
16+
MemoryLimiter map[string]interface{} `yaml:"memory_lmiter,omitempty"`
1417
Source map[string]interface{} `yaml:"source,omitempty"`
1518
Rest map[string]interface{} `yaml:",inline"`
1619
} `yaml:"processors,omitempty"`
1720
Rest map[string]interface{} `yaml:",inline"`
1821
} `yaml:"config,omitempty"`
1922
Rest map[string]interface{} `yaml:",inline"`
2023
}
24+
25+
type Otelgateway struct {
26+
Deployment map[string]interface{} `yaml:"deployment,omitempty"`
27+
Config struct {
28+
Exporters struct {
29+
LoadBalancing struct {
30+
Protocol struct {
31+
Otlp struct {
32+
Compression string `yaml:"compression,omitempty"`
33+
SendingQueue struct {
34+
NumConsumers int `yaml:"num_consumers,omitempty"`
35+
QueueSize int `yaml:"queue_size,omitempty"`
36+
} `yaml:"sending_queue,omitempty"`
37+
} `yaml:"otlp,omitempty"`
38+
} `yaml:"protocol,omitempty"`
39+
} `yaml:"loadbalancing,omitempty"`
40+
Rest map[string]interface{} `yaml:",inline"`
41+
} `yaml:"exporters,omitempty"`
42+
Processors struct {
43+
Batch map[string]interface{} `yaml:"batch,omitempty"`
44+
MemoryLimiter map[string]interface{} `yaml:"memory_lmiter,omitempty"`
45+
} `yaml:"processors,omitempty"`
46+
} `yaml:"config,omitempty"`
47+
Rest map[string]interface{} `yaml:",inline"`
48+
}

src/go/cmd/update-collection-v3/migrations/tracing-config/values_output.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package tracingconfig
22

33
type ValuesOutput struct {
44
OtelcolInstrumentation OtelcolInstrumentation `yaml:"otelcolInstrumentation,omitempty"`
5+
TracesGateway TracesGateway `yaml:"tracesGateway,omitempty"`
56
TracesSampler TracesSampler `yaml:"tracesSampler,omitempty"`
67
Otelcol map[string]interface{} `yaml:"-"`
78
Otelagent map[string]interface{} `yaml:"-"`
@@ -18,11 +19,38 @@ type OtelcolInstrumentation struct {
1819
} `yaml:"config,omitempty"`
1920
}
2021

22+
type TracesGateway struct {
23+
Config struct {
24+
Exporters struct {
25+
LoadBalancing struct {
26+
Protocol struct {
27+
Otlp struct {
28+
Compression string `yaml:"compression,omitempty"`
29+
SendingQueue struct {
30+
NumConsumers int `yaml:"num_consumers,omitempty"`
31+
QueueSize int `yaml:"queue_size,omitempty"`
32+
} `yaml:"sending_queue,omitempty"`
33+
} `yaml:"otlp,omitempty"`
34+
} `yaml:"protocol,omitempty"`
35+
} `yaml:"loadbalancing,omitempty"`
36+
Rest map[string]interface{} `yaml:",inline"`
37+
} `yaml:"exporters,omitempty"`
38+
Processors struct {
39+
Batch map[string]interface{} `yaml:"batch,omitempty"`
40+
MemoryLimiter map[string]interface{} `yaml:"memory_lmiter,omitempty"`
41+
} `yaml:"processors,omitempty"`
42+
} `yaml:"config,omitempty"`
43+
Deployment map[string]interface{} `yaml:"deployment,omitempty"`
44+
}
45+
2146
type TracesSampler struct {
2247
Config struct {
2348
Processors struct {
49+
Batch map[string]interface{} `yaml:"batch,omitempty"`
2450
CascadingFilter map[string]interface{} `yaml:"cascading_filter,omitempty"`
51+
MemoryLimiter map[string]interface{} `yaml:"memory_lmiter,omitempty"`
2552
Rest map[string]interface{} `yaml:",inline"`
2653
} `yaml:"processors,omitempty"`
2754
} `yaml:"config,omitempty"`
55+
Deployment map[string]interface{} `yaml:"deployment,omitempty"`
2856
}

src/go/cmd/update-collection-v3/testdata/tracing.input.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,35 @@ otelagent:
1010
otlphttp/traces:
1111
endpoint: http://exporters.otlptraces.endpoint.replace:4318
1212
otelgateway:
13+
deployment:
14+
replicas: 7
15+
resources:
16+
limits:
17+
memory: 3Gi
18+
cpu: 2
19+
requests:
20+
memory: 2Gi
21+
cpu: 1
1322
enabled: true
1423
config:
1524
exporters:
1625
loadbalancing:
26+
protocol:
27+
otlp:
28+
compression: gzip
29+
sending_queue:
30+
num_consumers: 100
31+
queue_size: 13000
1732
otelcol:
33+
deployment:
34+
replicas: 12
35+
resources:
36+
limits:
37+
memory: 4Gi
38+
cpu: 2000m
39+
requests:
40+
memory: 2Gi
41+
cpu: 100m
1842
config:
1943
exporters:
2044
sumologic:
@@ -23,6 +47,8 @@ otelcol:
2347
processors:
2448
other:
2549
enabled: true
50+
batch:
51+
send_batch_size: 1024
2652
cascading_filter:
2753
num_spans: 200000
2854
source:

src/go/cmd/update-collection-v3/testdata/tracing.output.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,38 @@ otelcolInstrumentation:
2020
source_category_replace_dash: processors.source.category_replace_dash.replace
2121
source_host: "%{k8s.pod.hostname}"
2222
source_name: processors.source.name.replace
23+
tracesGateway:
24+
config:
25+
exporters:
26+
loadbalancing:
27+
protocol:
28+
otlp:
29+
compression: gzip
30+
sending_queue:
31+
num_consumers: 100
32+
queue_size: 13000
33+
deployment:
34+
replicas: 7
35+
resources:
36+
limits:
37+
cpu: 2
38+
memory: 3Gi
39+
requests:
40+
cpu: 1
41+
memory: 2Gi
2342
tracesSampler:
2443
config:
2544
processors:
45+
batch:
46+
send_batch_size: 1024
2647
cascading_filter:
2748
num_spans: 200000
49+
deployment:
50+
replicas: 12
51+
resources:
52+
limits:
53+
cpu: 2000m
54+
memory: 4Gi
55+
requests:
56+
cpu: 100m
57+
memory: 2Gi

0 commit comments

Comments
 (0)