Skip to content

Commit

Permalink
chore: handle metrics breaking-change
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Csati <bence.csati@axoflow.com>
  • Loading branch information
csatib02 committed Nov 14, 2024
1 parent 591011c commit 28575a5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,9 @@ service:
telemetry:
metrics:
level: detailed
readers:
- pull:
exporter:
prometheus:
host: ""
port: 8888
40 changes: 29 additions & 11 deletions internal/controller/telemetry/otel_conf_gen/otel_conf_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,34 @@ func (cfgInput *OtelColConfigInput) generateNamedPipelines() map[string]*otelv1b
return namedPipelines
}

func (cfgInput *OtelColConfigInput) generateTelemetry() map[string]any {
telemetry := map[string]interface{}{
"metrics": map[string]interface{}{
"level": "detailed",
"readers": []map[string]interface{}{
{
"pull": map[string]interface{}{
"exporter": map[string]interface{}{
"prometheus": map[string]interface{}{
"host": "",
"port": 8888,
},
},
},
},
},
},
}

if cfgInput.Debug {
telemetry["logs"] = map[string]string{
"level": "debug",
}
}

return telemetry
}

func (cfgInput *OtelColConfigInput) AssembleConfig(ctx context.Context) otelv1beta1.Config {
exporters := cfgInput.generateExporters(ctx)

Expand All @@ -255,17 +283,7 @@ func (cfgInput *OtelColConfigInput) AssembleConfig(ctx context.Context) otelv1be

pipelines := cfgInput.generateNamedPipelines()

telemetry := make(map[string]any)

telemetry["metrics"] = map[string]string{
"level": "detailed",
}

if cfgInput.Debug {
telemetry["logs"] = map[string]string{
"level": "debug",
}
}
telemetry := cfgInput.generateTelemetry()

if _, ok := processors["memory_limiter"]; ok {
for name, pipeline := range pipelines {
Expand Down

0 comments on commit 28575a5

Please sign in to comment.