mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-15 17:51:20 +00:00
835f5551b7
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
27 lines
712 B
Go
27 lines
712 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, "name", name, "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() {}
|
|
}
|