Skip to content

Commit

Permalink
Merge branch 'main' into log_conversion_converter
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdurham authored Apr 2, 2024
2 parents fa4463f + 787a094 commit 4641926
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ func (loadbalancingExporterConverter) ConvertAndAppend(state *State, id componen
}

func toLoadbalancingExporter(cfg *loadbalancingexporter.Config) *loadbalancing.Arguments {
routingKey := "traceID"
if cfg.RoutingKey != "" {
routingKey = cfg.RoutingKey
}
return &loadbalancing.Arguments{
Protocol: toProtocol(cfg.Protocol),
Resolver: toResolver(cfg.Resolver),
RoutingKey: cfg.RoutingKey,
RoutingKey: routingKey,

DebugMetrics: common.DefaultValue[loadbalancing.Arguments]().DebugMetrics,
}
Expand Down
70 changes: 52 additions & 18 deletions internal/converter/internal/staticconvert/testdata/traces.river
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ otelcol.extension.jaeger_remote_sampling "default_0" {
}
}

otelcol.receiver.otlp "default" {
otelcol.receiver.otlp "_0_default" {
grpc {
include_metadata = true
}
Expand All @@ -25,11 +25,11 @@ otelcol.receiver.otlp "default" {
output {
metrics = []
logs = []
traces = [otelcol.processor.discovery.default.input]
traces = [otelcol.processor.discovery._0_default.input]
}
}

discovery.azure "default_prometheus1" {
discovery.azure "_0_default_prometheus1" {
subscription_id = "subscription1"

oauth {
Expand All @@ -43,17 +43,17 @@ discovery.azure "default_prometheus1" {
}
}

discovery.lightsail "default_prometheus1" {
discovery.lightsail "_0_default_prometheus1" {
region = "us-east-1"
access_key = "YOUR_ACCESS_KEY"
secret_key = "YOUR_SECRET_KEY"
port = 8080
}

discovery.relabel "default_prometheus1" {
discovery.relabel "_0_default_prometheus1" {
targets = concat(
discovery.azure.default_prometheus1.targets,
discovery.lightsail.default_prometheus1.targets,
discovery.azure._0_default_prometheus1.targets,
discovery.lightsail._0_default_prometheus1.targets,
)

rule {
Expand All @@ -67,19 +67,19 @@ discovery.relabel "default_prometheus1" {
}
}

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

output {
metrics = []
logs = []
traces = [otelcol.processor.attributes.default.input]
traces = [otelcol.processor.attributes._0_default.input]
}
}

otelcol.processor.attributes "default" {
otelcol.processor.attributes "_0_default" {
action {
key = "db.table"
action = "delete"
Expand All @@ -88,35 +88,69 @@ otelcol.processor.attributes "default" {
output {
metrics = []
logs = []
traces = [otelcol.processor.tail_sampling.default.input]
traces = [otelcol.exporter.loadbalancing._0_default.input, otelcol.exporter.logging._0_default.input]
}
}

otelcol.processor.tail_sampling "default" {
otelcol.exporter.loadbalancing "_0_default" {
protocol {
otlp {
retry {
max_elapsed_time = "1m0s"
}

client {
compression = "none"
}
}
}

resolver {
static {
hostnames = ["tempo1.example.com", "tempo2.example.com"]
}
}
}

otelcol.exporter.logging "_0_default" { }

otelcol.receiver.otlp "_1_lb" {
grpc {
endpoint = "0.0.0.0:4318"
}

output {
metrics = []
logs = []
traces = [otelcol.processor.tail_sampling._1_default.input]
}
}

otelcol.processor.tail_sampling "_1_default" {
policy {
name = "test-policy-1"
type = "always_sample"
}
decision_wait = "5s"

output {
traces = [otelcol.processor.batch.default.input]
traces = [otelcol.processor.batch._1_default.input]
}
}

otelcol.processor.batch "default" {
otelcol.processor.batch "_1_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]
traces = [otelcol.exporter.otlp._1_0.input, otelcol.exporter.logging._1_default.input]
}
}

otelcol.exporter.otlp "default_0" {
otelcol.exporter.otlp "_1_0" {
retry_on_failure {
max_elapsed_time = "1m0s"
}
Expand All @@ -130,4 +164,4 @@ otelcol.exporter.otlp "default_0" {
}
}

otelcol.exporter.logging "default" { }
otelcol.exporter.logging "_1_default" { }
12 changes: 6 additions & 6 deletions internal/converter/internal/staticconvert/testdata/traces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ traces:
type: always_sample
},
]
# load_balancing:
# resolver:
# static:
# hostnames:
# - tempo1.example.com
# - tempo2.example.com
load_balancing:
resolver:
static:
hostnames:
- tempo1.example.com
- tempo2.example.com
# service_graphs:
# enabled: true
jaeger_remote_sampling:
Expand Down

0 comments on commit 4641926

Please sign in to comment.