Skip to content

Commit

Permalink
wire up static traces converter test for all major scenarios and squa…
Browse files Browse the repository at this point in the history
…sh a bug along the way (#6801)

* wire up static traces converter test for all major scenarios and squash a bug along the way

Signed-off-by: erikbaranowski <[email protected]>

---------

Signed-off-by: erikbaranowski <[email protected]>
  • Loading branch information
erikbaranowski authored Apr 1, 2024
1 parent 88780b8 commit f4ab69d
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,19 @@ func removeReceiver(otelCfg *otelcol.Config, pipelineType otel_component.Type, r
}

delete(otelCfg.Receivers, otel_component.NewID(receiverType))
spr := make([]otel_component.ID, 0, len(otelCfg.Service.Pipelines[otel_component.NewID(pipelineType)].Receivers)-1)
for _, r := range otelCfg.Service.Pipelines[otel_component.NewID(pipelineType)].Receivers {
if r != otel_component.NewID(receiverType) {
spr = append(spr, r)
for ix, p := range otelCfg.Service.Pipelines {
if ix.Type() != pipelineType {
continue
}

spr := make([]otel_component.ID, 0)
for _, r := range p.Receivers {
if r.Type() != receiverType {
spr = append(spr, r)
}
}
otelCfg.Service.Pipelines[ix].Receivers = spr
}
otelCfg.Service.Pipelines[otel_component.NewID(pipelineType)].Receivers = spr
}

// removeProcessor removes a processor from the otel config for a specific pipeline type.
Expand All @@ -91,11 +97,17 @@ func removeProcessor(otelCfg *otelcol.Config, pipelineType otel_component.Type,
}

delete(otelCfg.Processors, otel_component.NewID(processorType))
spr := make([]otel_component.ID, 0, len(otelCfg.Service.Pipelines[otel_component.NewID(pipelineType)].Processors)-1)
for _, r := range otelCfg.Service.Pipelines[otel_component.NewID(pipelineType)].Processors {
if r != otel_component.NewID(processorType) {
spr = append(spr, r)
for ix, p := range otelCfg.Service.Pipelines {
if ix.Type() != pipelineType {
continue
}

spr := make([]otel_component.ID, 0)
for _, r := range p.Processors {
if r.Type() != processorType {
spr = append(spr, r)
}
}
otelCfg.Service.Pipelines[ix].Processors = spr
}
otelCfg.Service.Pipelines[otel_component.NewID(pipelineType)].Processors = spr
}
38 changes: 35 additions & 3 deletions internal/converter/internal/staticconvert/testdata/traces.river
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
otelcol.extension.jaeger_remote_sampling "default_0" {
grpc { }

http { }

source {
remote {
endpoint = "jaeger-collector:14250"
compression = ""
write_buffer_size = "0B"
}
reload_interval = "30s"
}
}

otelcol.receiver.otlp "default" {
grpc {
include_metadata = true
Expand Down Expand Up @@ -54,7 +69,8 @@ discovery.relabel "default_prometheus1" {

otelcol.processor.discovery "default" {
targets = discovery.relabel.default_prometheus1.output
pod_associations = []
operation_type = "insert"
pod_associations = ["ip", "net.host.ip"]

output {
metrics = []
Expand Down Expand Up @@ -84,7 +100,19 @@ otelcol.processor.tail_sampling "default" {
decision_wait = "5s"

output {
traces = [otelcol.exporter.otlp.default_0.input, otelcol.exporter.logging.default.input]
traces = [otelcol.processor.batch.default.input]
}
}

otelcol.processor.batch "default" {
timeout = "5s"
send_batch_size = 2048
send_batch_max_size = 4096

output {
metrics = []
logs = []
traces = [otelcol.exporter.otlp.default_0.input, otelcol.exporter.logging.default.input]
}
}

Expand All @@ -94,7 +122,11 @@ otelcol.exporter.otlp "default_0" {
}

client {
endpoint = "http://localhost:1234/write"
endpoint = "tempo.example.com:14250"

tls {
insecure = true
}
}
}

Expand Down
48 changes: 40 additions & 8 deletions internal/converter/internal/staticconvert/testdata/traces.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
traces:
configs:
- name: trace_config
attributes:
actions:
- key: db.table
action: delete
batch:
timeout: 5s
send_batch_size: 2048
send_batch_max_size: 4096
remote_write:
- endpoint: tempo.example.com:14250
insecure: true
automatic_logging:
backend: "stdout"
receivers:
otlp:
protocols:
grpc:
http:
remote_write:
- endpoint: http://localhost:1234/write
automatic_logging:
backend: "stdout"
scrape_configs:
- job_name: "prometheus1"
azure_sd_configs:
Expand All @@ -27,6 +36,13 @@ traces:
target_label: __param_target1
- source_labels: [__address2__]
target_label: __param_target2
prom_sd_operation_type: "insert"
prom_sd_pod_associations:
- ip
- net.host.ip
# spanmetrics:
# namespace: testing
# metrics_instance: default
tail_sampling:
policies:
[
Expand All @@ -35,7 +51,23 @@ traces:
type: always_sample
},
]
attributes:
actions:
- key: db.table
action: delete
# load_balancing:
# resolver:
# static:
# hostnames:
# - tempo1.example.com
# - tempo2.example.com
# service_graphs:
# enabled: true
jaeger_remote_sampling:
- source:
reload_interval: 30s
remote:
endpoint: jaeger-collector:14250

# This metrics config is needed when we enable spanmetrics for traces
#
# metrics:
# global:
# remote_write:
# - url: http://localhost:9009/api/prom/push

0 comments on commit f4ab69d

Please sign in to comment.