1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/cmd/internal/tracing.go
Charles-Edouard Brétéché a6c8c401ff
feat: add signal in internal cmd package (#5444)
* feat: add signal in internal cmd package

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

* logger

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-23 07:28:19 +00:00

27 lines
698 B
Go

package internal
import (
"context"
"net"
"github.com/go-logr/logr"
"github.com/kyverno/kyverno/pkg/tracing"
"k8s.io/client-go/kubernetes"
)
func SetupTracing(logger logr.Logger, name string, kubeClient kubernetes.Interface) context.CancelFunc {
logger = logger.WithName("tracing").WithValues("enabled", tracingEnabled, "address", tracingAddress, "port", tracingPort, "creds", tracingCreds)
if tracingEnabled {
logger.Info("setup tracing...")
shutdown, err := tracing.NewTraceConfig(
logger,
name,
net.JoinHostPort(tracingAddress, tracingPort),
tracingCreds,
kubeClient,
)
checkError(logger, err, "failed to setup tracing")
return shutdown
}
return func() {}
}