Skip to content

Commit

Permalink
Fix logger in OTEL collector (kedacore#5095)
Browse files Browse the repository at this point in the history
  • Loading branch information
zroubalik authored Oct 18, 2023
1 parent fb12330 commit 3d00a09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ New deprecation(s):
### Other

- **General**: Fix CVE-2023-45142 in Opentelemetry ([#5089](https://github.com/kedacore/keda/issues/5089))
- **General**: Fix logger in Opentelemetry collector ([#5094](https://github.com/kedacore/keda/issues/5094))

## v2.12.0

Expand Down
12 changes: 6 additions & 6 deletions pkg/metricscollector/opentelemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/kedacore/keda/v2/version"
)

var otLog = logf.Log.WithName("prometheus_server")
var otLog = logf.Log.WithName("otel_collector")

const meterName = "keda-open-telemetry-metrics"
const defaultNamespace = "default"
Expand Down Expand Up @@ -91,7 +91,7 @@ func (o *OtelMetrics) RecordScalerMetric(namespace string, scaledObject string,
api.WithFloat64Callback(cback),
)
if err != nil {
fmt.Println("failed to register scaler metrics value")
otLog.Error(err, "failed to register scaler metrics value", "namespace", namespace, "scaledObject", scaledObject, "scaler", scaler, "scalerIndex", scalerIndex, "metric", metric)
}
}

Expand All @@ -107,7 +107,7 @@ func (o *OtelMetrics) RecordScalerLatency(namespace string, scaledObject string,
api.WithFloat64Callback(cback),
)
if err != nil {
fmt.Println("failed to register scaler metrics latency")
otLog.Error(err, "failed to register scaler metrics latency", "namespace", namespace, "scaledObject", scaledObject, "scaler", scaler, "scalerIndex", scalerIndex, "metric", metric)
}
}

Expand All @@ -133,7 +133,7 @@ func (o *OtelMetrics) RecordScalableObjectLatency(namespace string, name string,
api.WithFloat64Callback(cback),
)
if err != nil {
fmt.Println("failed to register internal scale loop latency")
otLog.Error(err, "failed to register internal scale loop latency", "namespace", namespace, resourceType, name)
}
}

Expand All @@ -154,7 +154,7 @@ func (o *OtelMetrics) RecordScalerActive(namespace string, scaledObject string,
api.WithFloat64Callback(cback),
)
if err != nil {
fmt.Println("failed to register internal scale loop latency")
otLog.Error(err, "failed to register scaler activity", "namespace", namespace, "scaledObject", scaledObject, "scaler", scaler, "scalerIndex", scalerIndex, "metric", metric)
}
}

Expand Down Expand Up @@ -197,7 +197,7 @@ func (o *OtelMetrics) RecordBuildInfo() {
api.WithInt64Callback(cback),
)
if err != nil {
fmt.Println("failed to register scaler metrics value")
otLog.Error(err, "failed to register build info")
}
}

Expand Down

0 comments on commit 3d00a09

Please sign in to comment.