1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-08 10:04:25 +00:00

configure opentelemetry logger (#5513)

* configure opentelemetry logger

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* Update cmd/internal/metrics.go

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Update cmd/internal/metrics.go

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
yinka 2022-12-01 23:44:30 +01:00 committed by GitHub
parent ef06833613
commit d7c7bbc843
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ import (
"github.com/kyverno/kyverno/pkg/config"
"github.com/kyverno/kyverno/pkg/logging"
"github.com/kyverno/kyverno/pkg/metrics"
otlp "go.opentelemetry.io/otel"
"k8s.io/client-go/kubernetes"
)
@ -36,6 +37,8 @@ func SetupMetrics(ctx context.Context, logger logr.Logger, kubeClient kubernetes
logging.WithName("metrics"),
)
checkError(logger, err, "failed to init metrics")
// Pass logger to opentelemetry so JSON format is used (when configured)
otlp.SetLogger(logger)
var cancel context.CancelFunc
if otel == "grpc" {
cancel = func() {