From 39b72eefb95a4520adcda111ce94c14115d94e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Fri, 9 Dec 2022 10:09:11 +0100 Subject: [PATCH] feat: add http clients tracing (#5630) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add http clients tracing Signed-off-by: Charles-Edouard Brétéché * check we are in a span before creating one and and context to metrics recording calls Signed-off-by: Charles-Edouard Brétéché Signed-off-by: Charles-Edouard Brétéché Co-authored-by: shuting --- cmd/internal/client.go | 8 + go.mod | 2 + go.sum | 8 + hack/main.go | 43 +- .../dynamic/resource/resource.generated.go | 309 +++++++----- .../resource.generated.go | 253 +++++----- .../resource.generated.go | 253 +++++----- .../resource.generated.go | 253 +++++----- .../resource.generated.go | 253 +++++----- .../controllerrevisions/resource.generated.go | 253 +++++----- .../appsv1/daemonsets/resource.generated.go | 309 +++++++----- .../appsv1/deployments/resource.generated.go | 393 ++++++++------- .../appsv1/replicasets/resource.generated.go | 393 ++++++++------- .../appsv1/statefulsets/resource.generated.go | 393 ++++++++------- .../controllerrevisions/resource.generated.go | 253 +++++----- .../deployments/resource.generated.go | 309 +++++++----- .../statefulsets/resource.generated.go | 309 +++++++----- .../controllerrevisions/resource.generated.go | 253 +++++----- .../daemonsets/resource.generated.go | 309 +++++++----- .../deployments/resource.generated.go | 309 +++++++----- .../replicasets/resource.generated.go | 309 +++++++----- .../statefulsets/resource.generated.go | 393 ++++++++------- .../tokenreviews/resource.generated.go | 29 +- .../tokenreviews/resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 29 +- .../resource.generated.go | 309 +++++++----- .../resource.generated.go | 309 +++++++----- .../resource.generated.go | 309 +++++++----- .../resource.generated.go | 309 +++++++----- .../batchv1/cronjobs/resource.generated.go | 309 +++++++----- .../kube/batchv1/jobs/resource.generated.go | 309 +++++++----- .../cronjobs/resource.generated.go | 309 +++++++----- .../resource.generated.go | 337 +++++++------ .../resource.generated.go | 337 +++++++------ .../leases/resource.generated.go | 253 +++++----- .../leases/resource.generated.go | 253 +++++----- .../componentstatuses/resource.generated.go | 253 +++++----- .../corev1/configmaps/resource.generated.go | 253 +++++----- .../corev1/endpoints/resource.generated.go | 253 +++++----- .../kube/corev1/events/resource.generated.go | 253 +++++----- .../corev1/limitranges/resource.generated.go | 253 +++++----- .../corev1/namespaces/resource.generated.go | 309 +++++++----- .../kube/corev1/nodes/resource.generated.go | 337 +++++++------ .../resource.generated.go | 309 +++++++----- .../persistentvolumes/resource.generated.go | 309 +++++++----- .../kube/corev1/pods/resource.generated.go | 449 ++++++++++-------- .../corev1/podtemplates/resource.generated.go | 253 +++++----- .../resource.generated.go | 365 ++++++++------ .../resourcequotas/resource.generated.go | 309 +++++++----- .../kube/corev1/secrets/resource.generated.go | 253 +++++----- .../serviceaccounts/resource.generated.go | 281 ++++++----- .../corev1/services/resource.generated.go | 281 ++++++----- .../endpointslices/resource.generated.go | 253 +++++----- .../endpointslices/resource.generated.go | 253 +++++----- .../eventsv1/events/resource.generated.go | 253 +++++----- .../events/resource.generated.go | 253 +++++----- .../daemonsets/resource.generated.go | 309 +++++++----- .../deployments/resource.generated.go | 421 +++++++++------- .../ingresses/resource.generated.go | 309 +++++++----- .../networkpolicies/resource.generated.go | 309 +++++++----- .../podsecuritypolicies/resource.generated.go | 253 +++++----- .../replicasets/resource.generated.go | 393 ++++++++------- .../flowschemas/resource.generated.go | 309 +++++++----- .../resource.generated.go | 309 +++++++----- .../flowschemas/resource.generated.go | 309 +++++++----- .../resource.generated.go | 309 +++++++----- .../flowschemas/resource.generated.go | 309 +++++++----- .../resource.generated.go | 309 +++++++----- .../storageversions/resource.generated.go | 309 +++++++----- .../ingressclasses/resource.generated.go | 253 +++++----- .../ingresses/resource.generated.go | 309 +++++++----- .../networkpolicies/resource.generated.go | 309 +++++++----- .../clustercidrs/resource.generated.go | 253 +++++----- .../ingressclasses/resource.generated.go | 253 +++++----- .../ingresses/resource.generated.go | 309 +++++++----- .../runtimeclasses/resource.generated.go | 253 +++++----- .../runtimeclasses/resource.generated.go | 253 +++++----- .../runtimeclasses/resource.generated.go | 253 +++++----- .../policyv1/evictions/resource.generated.go | 29 +- .../resource.generated.go | 309 +++++++----- .../evictions/resource.generated.go | 29 +- .../resource.generated.go | 309 +++++++----- .../podsecuritypolicies/resource.generated.go | 253 +++++----- .../clusterrolebindings/resource.generated.go | 253 +++++----- .../rbacv1/clusterroles/resource.generated.go | 253 +++++----- .../rbacv1/rolebindings/resource.generated.go | 253 +++++----- .../kube/rbacv1/roles/resource.generated.go | 253 +++++----- .../clusterrolebindings/resource.generated.go | 253 +++++----- .../clusterroles/resource.generated.go | 253 +++++----- .../rolebindings/resource.generated.go | 253 +++++----- .../rbacv1alpha1/roles/resource.generated.go | 253 +++++----- .../clusterrolebindings/resource.generated.go | 253 +++++----- .../clusterroles/resource.generated.go | 253 +++++----- .../rolebindings/resource.generated.go | 253 +++++----- .../rbacv1beta1/roles/resource.generated.go | 253 +++++----- .../priorityclasses/resource.generated.go | 253 +++++----- .../priorityclasses/resource.generated.go | 253 +++++----- .../priorityclasses/resource.generated.go | 253 +++++----- .../csidrivers/resource.generated.go | 253 +++++----- .../storagev1/csinodes/resource.generated.go | 253 +++++----- .../resource.generated.go | 253 +++++----- .../storageclasses/resource.generated.go | 253 +++++----- .../volumeattachments/resource.generated.go | 309 +++++++----- .../resource.generated.go | 253 +++++----- .../volumeattachments/resource.generated.go | 309 +++++++----- .../csidrivers/resource.generated.go | 253 +++++----- .../csinodes/resource.generated.go | 253 +++++----- .../resource.generated.go | 253 +++++----- .../storageclasses/resource.generated.go | 253 +++++----- .../volumeattachments/resource.generated.go | 309 +++++++----- .../clusterpolicies/resource.generated.go | 253 +++++----- .../generaterequests/resource.generated.go | 253 +++++----- .../kyvernov1/policies/resource.generated.go | 253 +++++----- .../admissionreports/resource.generated.go | 225 +++++---- .../resource.generated.go | 225 +++++---- .../resource.generated.go | 225 +++++---- .../resource.generated.go | 225 +++++---- .../updaterequests/resource.generated.go | 253 +++++----- .../cleanuppolicies/resource.generated.go | 253 +++++----- .../resource.generated.go | 253 +++++----- .../resource.generated.go | 225 +++++---- .../policyreports/resource.generated.go | 225 +++++---- .../metadata/resource/resource.generated.go | 169 ++++--- pkg/cosign/cosign.go | 2 +- pkg/metrics/client.go | 3 +- pkg/registryclient/client.go | 87 +++- pkg/registryclient/client_test.go | 10 +- pkg/tracing/http.go | 24 + pkg/tracing/tracing.go | 5 + 136 files changed, 18734 insertions(+), 13896 deletions(-) create mode 100644 pkg/tracing/http.go diff --git a/cmd/internal/client.go b/cmd/internal/client.go index d3bb9998a7..4a62e23b80 100644 --- a/cmd/internal/client.go +++ b/cmd/internal/client.go @@ -2,6 +2,7 @@ package internal import ( "context" + "net/http" "time" "github.com/go-logr/logr" @@ -12,6 +13,8 @@ import ( kyverno "github.com/kyverno/kyverno/pkg/clients/kyverno" meta "github.com/kyverno/kyverno/pkg/clients/metadata" "github.com/kyverno/kyverno/pkg/config" + "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/client-go/metadata" @@ -21,6 +24,11 @@ import ( func CreateClientConfig(logger logr.Logger) *rest.Config { clientConfig, err := config.CreateClientConfig(kubeconfig, clientRateLimitQPS, clientRateLimitBurst) checkError(logger, err, "failed to create rest client configuration") + clientConfig.Wrap( + func(base http.RoundTripper) http.RoundTripper { + return tracing.Transport(base, otelhttp.WithFilter(tracing.RequestFilterIsInSpan)) + }, + ) return clientConfig } diff --git a/go.mod b/go.mod index 9ad26c5051..724868ecef 100644 --- a/go.mod +++ b/go.mod @@ -41,6 +41,7 @@ require ( github.com/spf13/cobra v1.6.1 github.com/stretchr/testify v1.8.1 github.com/zach-klippenstein/goregen v0.0.0-20160303162051-795b5e3961ea + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 go.opentelemetry.io/otel v1.11.2 go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.34.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 @@ -153,6 +154,7 @@ require ( github.com/emicklei/go-restful/v3 v3.10.1 // indirect github.com/emicklei/proto v1.11.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect + github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-chi/chi v4.1.2+incompatible // indirect github.com/go-errors/errors v1.4.2 // indirect diff --git a/go.sum b/go.sum index a239a8c944..6c21cbc287 100644 --- a/go.sum +++ b/go.sum @@ -435,6 +435,9 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= @@ -1536,6 +1539,9 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0 h1:mac9BKRqwaX6zxHPDe3pvmWpwuuIM0vuXv2juCnQevE= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0/go.mod h1:5eCOqeGphOyz6TsY3ZDNjE33SM/TFAK3RGuCL2naTgY= +go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 h1:htgM8vZIF8oPSCxa341e3IZ4yr/sKxgu8KZYllByiVY= @@ -1550,12 +1556,14 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 h1:ERwKP go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2/go.mod h1:jWZUM2MWhWCJ9J9xVbRx7tzK1mXKpAlze4CeulycwVY= go.opentelemetry.io/otel/exporters/prometheus v0.34.0 h1:L5D+HxdaC/ORB47ribbTBbkXRZs9JzPjq0EoIOMWncM= go.opentelemetry.io/otel/exporters/prometheus v0.34.0/go.mod h1:6gUoJyfhoWqF0tOLaY0ZmKgkQRcvEQx6p5rVlKHp3s4= +go.opentelemetry.io/otel/metric v0.30.0/go.mod h1:/ShZ7+TS4dHzDFmfi1kSXMhMVubNoP0oIaBp70J6UXU= go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= diff --git a/hack/main.go b/hack/main.go index c896d32e61..35ee717bb4 100644 --- a/hack/main.go +++ b/hack/main.go @@ -28,6 +28,7 @@ import ( "github.com/kyverno/kyverno/pkg/tracing" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" {{- range $package := Packages .Target.Type }} {{ Pkg $package }} {{ Quote $package }} @@ -116,7 +117,11 @@ func (c *withMetrics) {{ $operation.Method.Name }}( {{ GoType $return }}, {{- end -}} ) { + {{- if $operation.HasContext }} + defer c.recorder.RecordWithContext(arg0, {{ Quote (SnakeCase $operation.Method.Name) }}) + {{- else }} defer c.recorder.Record({{ Quote (SnakeCase $operation.Method.Name) }}) + {{- end }} return c.inner.{{ $operation.Method.Name }}( {{- range $i, $arg := Args $operation.Method -}} {{- if $arg.IsVariadic -}} @@ -160,16 +165,18 @@ func (c *withTracing) {{ $operation.Method.Name }}( {{- end -}} ) {{- else }} - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, {{ Quote $operation.Method.Name }}), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String({{ Quote $operation.Method.Name }}), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, {{ Quote $operation.Method.Name }}), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String({{ Quote $operation.Method.Name }}), + ) + defer span.End() + } {{ range $i, $ret := Returns $operation.Method }}ret{{ $i }}{{ if not $ret.IsLast -}},{{- end }} {{ end }} := c.inner.{{ $operation.Method.Name }}( {{- range $i, $arg := Args $operation.Method -}} {{- if $arg.IsVariadic -}} @@ -179,13 +186,15 @@ func (c *withTracing) {{ $operation.Method.Name }}( {{- end -}} {{- end -}} ) - {{- if $operation.HasError }} - {{- range $i, $ret := Returns $operation.Method }} - {{- if $ret.IsError }} - tracing.SetSpanStatus(span, ret{{ $i }}) - {{- end }} - {{- end }} - {{- end }} + if span != nil { + {{- if $operation.HasError }} + {{- range $i, $ret := Returns $operation.Method }} + {{- if $ret.IsError }} + tracing.SetSpanStatus(span, ret{{ $i }}) + {{- end }} + {{- end }} + {{- end }} + } return {{ range $i, $ret := Returns $operation.Method -}} ret{{ $i }}{{ if not $ret.IsLast -}},{{- end }} {{- end }} diff --git a/pkg/clients/dynamic/resource/resource.generated.go b/pkg/clients/dynamic/resource/resource.generated.go index 16507e0b85..e4b310ff53 100644 --- a/pkg/clients/dynamic/resource/resource.generated.go +++ b/pkg/clients/dynamic/resource/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_apis_meta_v1_unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -161,47 +162,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 string, arg2 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions, arg4 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2, arg3, arg4...) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 string, arg2 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2, arg3) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2, arg3...) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg3 ...string) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2, arg3...) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2, arg3...) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.UnstructuredList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2, arg3...) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -212,167 +213,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 string, arg2 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions, arg4 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2, arg3, arg4...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 string, arg2 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2, arg3...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg3 ...string) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2, arg3...) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2, arg3...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.UnstructuredList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2, arg3...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1_unstructured.Unstructured, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/admissionregistrationv1/mutatingwebhookconfigurations/resource.generated.go b/pkg/clients/kube/admissionregistrationv1/mutatingwebhookconfigurations/resource.generated.go index 0d44d0b233..4ea706ec0b 100644 --- a/pkg/clients/kube/admissionregistrationv1/mutatingwebhookconfigurations/resource.generated.go +++ b/pkg/clients/kube/admissionregistrationv1/mutatingwebhookconfigurations/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_admissionregistration_v1 "k8s.io/api/admissionregistration/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.MutatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfigurationList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.MutatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfigurationList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/admissionregistrationv1/validatingwebhookconfigurations/resource.generated.go b/pkg/clients/kube/admissionregistrationv1/validatingwebhookconfigurations/resource.generated.go index 591c92a81e..ff9a7a7574 100644 --- a/pkg/clients/kube/admissionregistrationv1/validatingwebhookconfigurations/resource.generated.go +++ b/pkg/clients/kube/admissionregistrationv1/validatingwebhookconfigurations/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_admissionregistration_v1 "k8s.io/api/admissionregistration/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfigurationList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1.ValidatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfigurationList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/admissionregistrationv1beta1/mutatingwebhookconfigurations/resource.generated.go b/pkg/clients/kube/admissionregistrationv1beta1/mutatingwebhookconfigurations/resource.generated.go index 832edbe2e6..9e08460183 100644 --- a/pkg/clients/kube/admissionregistrationv1beta1/mutatingwebhookconfigurations/resource.generated.go +++ b/pkg/clients/kube/admissionregistrationv1beta1/mutatingwebhookconfigurations/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_admissionregistration_v1beta1 "k8s.io/api/admissionregistration/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1beta1.MutatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfigurationList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1beta1.MutatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfigurationList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1beta1.MutatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/admissionregistrationv1beta1/validatingwebhookconfigurations/resource.generated.go b/pkg/clients/kube/admissionregistrationv1beta1/validatingwebhookconfigurations/resource.generated.go index 7c0f631751..3f44f91fee 100644 --- a/pkg/clients/kube/admissionregistrationv1beta1/validatingwebhookconfigurations/resource.generated.go +++ b/pkg/clients/kube/admissionregistrationv1beta1/validatingwebhookconfigurations/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_admissionregistration_v1beta1 "k8s.io/api/admissionregistration/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1beta1.ValidatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfigurationList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_admissionregistration_v1beta1.ValidatingWebhookConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfigurationList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_admissionregistration_v1beta1.ValidatingWebhookConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1/controllerrevisions/resource.generated.go b/pkg/clients/kube/appsv1/controllerrevisions/resource.generated.go index c9c48fabf1..6d0c6a4b20 100644 --- a/pkg/clients/kube/appsv1/controllerrevisions/resource.generated.go +++ b/pkg/clients/kube/appsv1/controllerrevisions/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1 "k8s.io/api/apps/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.ControllerRevisionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.ControllerRevisionList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.ControllerRevision, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.ControllerRevisionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.ControllerRevisionList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1/daemonsets/resource.generated.go b/pkg/clients/kube/appsv1/daemonsets/resource.generated.go index 2fb2470d95..c43a61206c 100644 --- a/pkg/clients/kube/appsv1/daemonsets/resource.generated.go +++ b/pkg/clients/kube/appsv1/daemonsets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1 "k8s.io/api/apps/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.DaemonSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.DaemonSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.DaemonSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1/deployments/resource.generated.go b/pkg/clients/kube/appsv1/deployments/resource.generated.go index e562e34473..3dc5d36c98 100644 --- a/pkg/clients/kube/appsv1/deployments/resource.generated.go +++ b/pkg/clients/kube/appsv1/deployments/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1 "k8s.io/api/apps/v1" k8s_io_api_autoscaling_v1 "k8s.io/api/autoscaling/v1" @@ -197,59 +198,59 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.Deployment, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_autoscaling_v1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("apply_scale") + defer c.recorder.RecordWithContext(arg0, "apply_scale") return c.inner.ApplyScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.Deployment, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.Deployment, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.Deployment, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("get_scale") + defer c.recorder.RecordWithContext(arg0, "get_scale") return c.inner.GetScale(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.DeploymentList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.Deployment, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.Deployment, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("update_scale") + defer c.recorder.RecordWithContext(arg0, "update_scale") return c.inner.UpdateScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.Deployment, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -260,212 +261,268 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_autoscaling_v1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("GetScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("GetScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.GetScale(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.DeploymentList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1/replicasets/resource.generated.go b/pkg/clients/kube/appsv1/replicasets/resource.generated.go index c7982df33b..98253ec2f7 100644 --- a/pkg/clients/kube/appsv1/replicasets/resource.generated.go +++ b/pkg/clients/kube/appsv1/replicasets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1 "k8s.io/api/apps/v1" k8s_io_api_autoscaling_v1 "k8s.io/api/autoscaling/v1" @@ -197,59 +198,59 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_autoscaling_v1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("apply_scale") + defer c.recorder.RecordWithContext(arg0, "apply_scale") return c.inner.ApplyScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("get_scale") + defer c.recorder.RecordWithContext(arg0, "get_scale") return c.inner.GetScale(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.ReplicaSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.ReplicaSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("update_scale") + defer c.recorder.RecordWithContext(arg0, "update_scale") return c.inner.UpdateScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -260,212 +261,268 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_autoscaling_v1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("GetScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("GetScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.GetScale(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.ReplicaSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1/statefulsets/resource.generated.go b/pkg/clients/kube/appsv1/statefulsets/resource.generated.go index 26084a2517..8682fd8fff 100644 --- a/pkg/clients/kube/appsv1/statefulsets/resource.generated.go +++ b/pkg/clients/kube/appsv1/statefulsets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1 "k8s.io/api/apps/v1" k8s_io_api_autoscaling_v1 "k8s.io/api/autoscaling/v1" @@ -197,59 +198,59 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_autoscaling_v1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("apply_scale") + defer c.recorder.RecordWithContext(arg0, "apply_scale") return c.inner.ApplyScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("get_scale") + defer c.recorder.RecordWithContext(arg0, "get_scale") return c.inner.GetScale(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.StatefulSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.StatefulSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("update_scale") + defer c.recorder.RecordWithContext(arg0, "update_scale") return c.inner.UpdateScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -260,212 +261,268 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_autoscaling_v1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("GetScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("GetScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.GetScale(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1.StatefulSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta1/controllerrevisions/resource.generated.go b/pkg/clients/kube/appsv1beta1/controllerrevisions/resource.generated.go index e2736720e8..b81d232bfe 100644 --- a/pkg/clients/kube/appsv1beta1/controllerrevisions/resource.generated.go +++ b/pkg/clients/kube/appsv1beta1/controllerrevisions/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta1 "k8s.io/api/apps/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.ControllerRevisionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta1.ControllerRevisionList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.ControllerRevisionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta1.ControllerRevisionList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta1/deployments/resource.generated.go b/pkg/clients/kube/appsv1beta1/deployments/resource.generated.go index 7b69fa3a74..a577d0ec8b 100644 --- a/pkg/clients/kube/appsv1beta1/deployments/resource.generated.go +++ b/pkg/clients/kube/appsv1beta1/deployments/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta1 "k8s.io/api/apps/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta1.DeploymentList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta1.Deployment, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta1.DeploymentList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta1/statefulsets/resource.generated.go b/pkg/clients/kube/appsv1beta1/statefulsets/resource.generated.go index 2731ec95a2..abd7a2dc17 100644 --- a/pkg/clients/kube/appsv1beta1/statefulsets/resource.generated.go +++ b/pkg/clients/kube/appsv1beta1/statefulsets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta1 "k8s.io/api/apps/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta1.StatefulSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta1.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta1.StatefulSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta1.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta1.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta2/controllerrevisions/resource.generated.go b/pkg/clients/kube/appsv1beta2/controllerrevisions/resource.generated.go index 9af71791f6..d5ecb0edc1 100644 --- a/pkg/clients/kube/appsv1beta2/controllerrevisions/resource.generated.go +++ b/pkg/clients/kube/appsv1beta2/controllerrevisions/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta2 "k8s.io/api/apps/v1beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ControllerRevisionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.ControllerRevisionList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ControllerRevisionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.ControllerRevisionList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ControllerRevision, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.ControllerRevision, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta2/daemonsets/resource.generated.go b/pkg/clients/kube/appsv1beta2/daemonsets/resource.generated.go index 82bc6d064b..3b5789bc54 100644 --- a/pkg/clients/kube/appsv1beta2/daemonsets/resource.generated.go +++ b/pkg/clients/kube/appsv1beta2/daemonsets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta2 "k8s.io/api/apps/v1beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.DaemonSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.DaemonSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta2/deployments/resource.generated.go b/pkg/clients/kube/appsv1beta2/deployments/resource.generated.go index 8c9bdd61fa..e6f1834734 100644 --- a/pkg/clients/kube/appsv1beta2/deployments/resource.generated.go +++ b/pkg/clients/kube/appsv1beta2/deployments/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta2 "k8s.io/api/apps/v1beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.DeploymentList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.Deployment, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.DeploymentList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta2/replicasets/resource.generated.go b/pkg/clients/kube/appsv1beta2/replicasets/resource.generated.go index cc803b253a..bf016b24eb 100644 --- a/pkg/clients/kube/appsv1beta2/replicasets/resource.generated.go +++ b/pkg/clients/kube/appsv1beta2/replicasets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta2 "k8s.io/api/apps/v1beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.ReplicaSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.ReplicaSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/appsv1beta2/statefulsets/resource.generated.go b/pkg/clients/kube/appsv1beta2/statefulsets/resource.generated.go index 4247ac4d89..c3fcf4435c 100644 --- a/pkg/clients/kube/appsv1beta2/statefulsets/resource.generated.go +++ b/pkg/clients/kube/appsv1beta2/statefulsets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apps_v1beta2 "k8s.io/api/apps/v1beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -195,59 +196,59 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.Scale, error) { - defer c.recorder.Record("apply_scale") + defer c.recorder.RecordWithContext(arg0, "apply_scale") return c.inner.ApplyScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.Scale, error) { - defer c.recorder.Record("get_scale") + defer c.recorder.RecordWithContext(arg0, "get_scale") return c.inner.GetScale(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.StatefulSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_apps_v1beta2.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.Scale, error) { - defer c.recorder.Record("update_scale") + defer c.recorder.RecordWithContext(arg0, "update_scale") return c.inner.UpdateScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -258,212 +259,268 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_apps_v1beta2.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apps_v1beta2.StatefulSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apps_v1beta2.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("GetScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("GetScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.GetScale(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apps_v1beta2.StatefulSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_apps_v1beta2.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apps_v1beta2.StatefulSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apps_v1beta2.StatefulSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authenticationv1/tokenreviews/resource.generated.go b/pkg/clients/kube/authenticationv1/tokenreviews/resource.generated.go index 61ec30ee98..a3aebabde5 100644 --- a/pkg/clients/kube/authenticationv1/tokenreviews/resource.generated.go +++ b/pkg/clients/kube/authenticationv1/tokenreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authentication_v1 "k8s.io/api/authentication/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authentication_v1.TokenReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authentication_v1.TokenReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authentication_v1.TokenReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authentication_v1.TokenReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authenticationv1beta1/tokenreviews/resource.generated.go b/pkg/clients/kube/authenticationv1beta1/tokenreviews/resource.generated.go index 10602a342e..b7e7fb02fe 100644 --- a/pkg/clients/kube/authenticationv1beta1/tokenreviews/resource.generated.go +++ b/pkg/clients/kube/authenticationv1beta1/tokenreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authentication_v1beta1 "k8s.io/api/authentication/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authentication_v1beta1.TokenReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authentication_v1beta1.TokenReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authentication_v1beta1.TokenReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authentication_v1beta1.TokenReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1/localsubjectaccessreviews/resource.generated.go b/pkg/clients/kube/authorizationv1/localsubjectaccessreviews/resource.generated.go index facc579317..7aa7ea8dcb 100644 --- a/pkg/clients/kube/authorizationv1/localsubjectaccessreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1/localsubjectaccessreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1 "k8s.io/api/authorization/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.LocalSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.LocalSubjectAccessReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.LocalSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.LocalSubjectAccessReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1/selfsubjectaccessreviews/resource.generated.go b/pkg/clients/kube/authorizationv1/selfsubjectaccessreviews/resource.generated.go index 992a5a104b..aa8381af52 100644 --- a/pkg/clients/kube/authorizationv1/selfsubjectaccessreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1/selfsubjectaccessreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1 "k8s.io/api/authorization/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.SelfSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.SelfSubjectAccessReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.SelfSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.SelfSubjectAccessReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1/selfsubjectrulesreviews/resource.generated.go b/pkg/clients/kube/authorizationv1/selfsubjectrulesreviews/resource.generated.go index 1482628355..0bb5aa6cd1 100644 --- a/pkg/clients/kube/authorizationv1/selfsubjectrulesreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1/selfsubjectrulesreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1 "k8s.io/api/authorization/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.SelfSubjectRulesReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.SelfSubjectRulesReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.SelfSubjectRulesReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.SelfSubjectRulesReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1/subjectaccessreviews/resource.generated.go b/pkg/clients/kube/authorizationv1/subjectaccessreviews/resource.generated.go index 474110b9d4..db720e56f5 100644 --- a/pkg/clients/kube/authorizationv1/subjectaccessreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1/subjectaccessreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1 "k8s.io/api/authorization/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.SubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.SubjectAccessReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1.SubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1.SubjectAccessReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1beta1/localsubjectaccessreviews/resource.generated.go b/pkg/clients/kube/authorizationv1beta1/localsubjectaccessreviews/resource.generated.go index 4cf0e7f88c..559fc76087 100644 --- a/pkg/clients/kube/authorizationv1beta1/localsubjectaccessreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1beta1/localsubjectaccessreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1beta1 "k8s.io/api/authorization/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.LocalSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.LocalSubjectAccessReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.LocalSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.LocalSubjectAccessReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1beta1/selfsubjectaccessreviews/resource.generated.go b/pkg/clients/kube/authorizationv1beta1/selfsubjectaccessreviews/resource.generated.go index f8c6d39b2a..a1c4149e57 100644 --- a/pkg/clients/kube/authorizationv1beta1/selfsubjectaccessreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1beta1/selfsubjectaccessreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1beta1 "k8s.io/api/authorization/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.SelfSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.SelfSubjectAccessReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.SelfSubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.SelfSubjectAccessReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1beta1/selfsubjectrulesreviews/resource.generated.go b/pkg/clients/kube/authorizationv1beta1/selfsubjectrulesreviews/resource.generated.go index a8ea443676..9124d753c8 100644 --- a/pkg/clients/kube/authorizationv1beta1/selfsubjectrulesreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1beta1/selfsubjectrulesreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1beta1 "k8s.io/api/authorization/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.SelfSubjectRulesReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.SelfSubjectRulesReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.SelfSubjectRulesReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.SelfSubjectRulesReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/authorizationv1beta1/subjectaccessreviews/resource.generated.go b/pkg/clients/kube/authorizationv1beta1/subjectaccessreviews/resource.generated.go index fd24a8670a..cf5b990744 100644 --- a/pkg/clients/kube/authorizationv1beta1/subjectaccessreviews/resource.generated.go +++ b/pkg/clients/kube/authorizationv1beta1/subjectaccessreviews/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authorization_v1beta1 "k8s.io/api/authorization/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -49,7 +50,7 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.SubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.SubjectAccessReview, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } @@ -60,17 +61,21 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_authorization_v1beta1.SubjectAccessReview, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authorization_v1beta1.SubjectAccessReview, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/autoscalingv1/horizontalpodautoscalers/resource.generated.go b/pkg/clients/kube/autoscalingv1/horizontalpodautoscalers/resource.generated.go index 245a2edbc3..19e8fef706 100644 --- a/pkg/clients/kube/autoscalingv1/horizontalpodautoscalers/resource.generated.go +++ b/pkg/clients/kube/autoscalingv1/horizontalpodautoscalers/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_autoscaling_v1 "k8s.io/api/autoscaling/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscalerList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscalerList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/autoscalingv2/horizontalpodautoscalers/resource.generated.go b/pkg/clients/kube/autoscalingv2/horizontalpodautoscalers/resource.generated.go index c875049b0c..bf767c6e2b 100644 --- a/pkg/clients/kube/autoscalingv2/horizontalpodautoscalers/resource.generated.go +++ b/pkg/clients/kube/autoscalingv2/horizontalpodautoscalers/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_autoscaling_v2 "k8s.io/api/autoscaling/v2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscalerList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscalerList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/autoscalingv2beta1/horizontalpodautoscalers/resource.generated.go b/pkg/clients/kube/autoscalingv2beta1/horizontalpodautoscalers/resource.generated.go index 294957d163..0f1092ce4e 100644 --- a/pkg/clients/kube/autoscalingv2beta1/horizontalpodautoscalers/resource.generated.go +++ b/pkg/clients/kube/autoscalingv2beta1/horizontalpodautoscalers/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_autoscaling_v2beta1 "k8s.io/api/autoscaling/v2beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscalerList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta1.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscalerList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta1.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/autoscalingv2beta2/horizontalpodautoscalers/resource.generated.go b/pkg/clients/kube/autoscalingv2beta2/horizontalpodautoscalers/resource.generated.go index 02179a7e39..cb97ce4c7b 100644 --- a/pkg/clients/kube/autoscalingv2beta2/horizontalpodautoscalers/resource.generated.go +++ b/pkg/clients/kube/autoscalingv2beta2/horizontalpodautoscalers/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_autoscaling_v2beta2 "k8s.io/api/autoscaling/v2beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscalerList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_autoscaling_v2beta2.HorizontalPodAutoscalerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscalerList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v2beta2.HorizontalPodAutoscaler, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/batchv1/cronjobs/resource.generated.go b/pkg/clients/kube/batchv1/cronjobs/resource.generated.go index 3a33096c08..4a957c21c7 100644 --- a/pkg/clients/kube/batchv1/cronjobs/resource.generated.go +++ b/pkg/clients/kube/batchv1/cronjobs/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_batch_v1 "k8s.io/api/batch/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.CronJob, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.CronJob, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_batch_v1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_batch_v1.CronJob, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_batch_v1.CronJob, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_batch_v1.CronJobList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_batch_v1.CronJob, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_batch_v1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.CronJob, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_batch_v1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.CronJob, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_batch_v1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_batch_v1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_batch_v1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_batch_v1.CronJobList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_batch_v1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_batch_v1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_batch_v1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/batchv1/jobs/resource.generated.go b/pkg/clients/kube/batchv1/jobs/resource.generated.go index 8886852f78..6873f6cf9f 100644 --- a/pkg/clients/kube/batchv1/jobs/resource.generated.go +++ b/pkg/clients/kube/batchv1/jobs/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_batch_v1 "k8s.io/api/batch/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.JobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.Job, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.JobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.Job, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_batch_v1.Job, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_batch_v1.Job, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_batch_v1.Job, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_batch_v1.JobList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_batch_v1.Job, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_batch_v1.Job, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.Job, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_batch_v1.Job, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.Job, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.JobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.Job, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1.JobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1.Job, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_batch_v1.Job, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_batch_v1.Job, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_batch_v1.Job, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_batch_v1.JobList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_batch_v1.Job, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_batch_v1.Job, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.Job, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_batch_v1.Job, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1.Job, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/batchv1beta1/cronjobs/resource.generated.go b/pkg/clients/kube/batchv1beta1/cronjobs/resource.generated.go index 898c1b1ff2..7404f7b22b 100644 --- a/pkg/clients/kube/batchv1beta1/cronjobs/resource.generated.go +++ b/pkg/clients/kube/batchv1beta1/cronjobs/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_batch_v1beta1 "k8s.io/api/batch/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1beta1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1beta1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_batch_v1beta1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_batch_v1beta1.CronJobList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_batch_v1beta1.CronJob, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_batch_v1beta1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_batch_v1beta1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1beta1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_batch_v1beta1.CronJobApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_batch_v1beta1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_batch_v1beta1.CronJobList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_batch_v1beta1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_batch_v1beta1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_batch_v1beta1.CronJob, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_batch_v1beta1.CronJob, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/certificatesv1/certificatesigningrequests/resource.generated.go b/pkg/clients/kube/certificatesv1/certificatesigningrequests/resource.generated.go index a2f2c57a79..b01b47d3cb 100644 --- a/pkg/clients/kube/certificatesv1/certificatesigningrequests/resource.generated.go +++ b/pkg/clients/kube/certificatesv1/certificatesigningrequests/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_certificates_v1 "k8s.io/api/certificates/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -173,51 +174,51 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequestList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateApproval(arg0 context.Context, arg1 string, arg2 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("update_approval") + defer c.recorder.RecordWithContext(arg0, "update_approval") return c.inner.UpdateApproval(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -228,182 +229,230 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequestList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateApproval(arg0 context.Context, arg1 string, arg2 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateApproval"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateApproval"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateApproval"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateApproval"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateApproval(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_certificates_v1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/certificatesv1beta1/certificatesigningrequests/resource.generated.go b/pkg/clients/kube/certificatesv1beta1/certificatesigningrequests/resource.generated.go index 4e389d9fa3..b7edf6f8cf 100644 --- a/pkg/clients/kube/certificatesv1beta1/certificatesigningrequests/resource.generated.go +++ b/pkg/clients/kube/certificatesv1beta1/certificatesigningrequests/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_certificates_v1beta1 "k8s.io/api/certificates/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -173,51 +174,51 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1beta1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1beta1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequestList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateApproval(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("update_approval") + defer c.recorder.RecordWithContext(arg0, "update_approval") return c.inner.UpdateApproval(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -228,182 +229,230 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1beta1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_certificates_v1beta1.CertificateSigningRequestApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequestList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateApproval(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateApproval"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateApproval"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateApproval"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateApproval"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateApproval(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_certificates_v1beta1.CertificateSigningRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_certificates_v1beta1.CertificateSigningRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/coordinationv1/leases/resource.generated.go b/pkg/clients/kube/coordinationv1/leases/resource.generated.go index 8377683b15..82c396844d 100644 --- a/pkg/clients/kube/coordinationv1/leases/resource.generated.go +++ b/pkg/clients/kube/coordinationv1/leases/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_coordination_v1 "k8s.io/api/coordination/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_coordination_v1.LeaseApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_coordination_v1.Lease, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_coordination_v1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_coordination_v1.Lease, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_coordination_v1.Lease, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_coordination_v1.LeaseList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_coordination_v1.Lease, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_coordination_v1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_coordination_v1.Lease, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_coordination_v1.LeaseApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_coordination_v1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_coordination_v1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_coordination_v1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_coordination_v1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_coordination_v1.LeaseList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_coordination_v1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_coordination_v1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_coordination_v1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/coordinationv1beta1/leases/resource.generated.go b/pkg/clients/kube/coordinationv1beta1/leases/resource.generated.go index 6f80c11d6b..66f83f1947 100644 --- a/pkg/clients/kube/coordinationv1beta1/leases/resource.generated.go +++ b/pkg/clients/kube/coordinationv1beta1/leases/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_coordination_v1beta1 "k8s.io/api/coordination/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_coordination_v1beta1.LeaseApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_coordination_v1beta1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_coordination_v1beta1.LeaseList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_coordination_v1beta1.Lease, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_coordination_v1beta1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_coordination_v1beta1.LeaseApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_coordination_v1beta1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_coordination_v1beta1.LeaseList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_coordination_v1beta1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_coordination_v1beta1.Lease, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_coordination_v1beta1.Lease, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/componentstatuses/resource.generated.go b/pkg/clients/kube/corev1/componentstatuses/resource.generated.go index 6d6d7b2fa2..e5a529fdd3 100644 --- a/pkg/clients/kube/corev1/componentstatuses/resource.generated.go +++ b/pkg/clients/kube/corev1/componentstatuses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ComponentStatusApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ComponentStatus, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ComponentStatusList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ComponentStatus, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ComponentStatus, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ComponentStatusApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ComponentStatus, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ComponentStatusList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ComponentStatus, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ComponentStatus, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ComponentStatus, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/configmaps/resource.generated.go b/pkg/clients/kube/corev1/configmaps/resource.generated.go index 8007011967..2c72623e43 100644 --- a/pkg/clients/kube/corev1/configmaps/resource.generated.go +++ b/pkg/clients/kube/corev1/configmaps/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ConfigMapApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ConfigMap, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ConfigMapList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ConfigMap, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ConfigMap, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ConfigMapApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ConfigMap, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ConfigMapList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ConfigMap, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ConfigMap, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ConfigMap, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/endpoints/resource.generated.go b/pkg/clients/kube/corev1/endpoints/resource.generated.go index a62e6222c4..67d468c52f 100644 --- a/pkg/clients/kube/corev1/endpoints/resource.generated.go +++ b/pkg/clients/kube/corev1/endpoints/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.EndpointsApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Endpoints, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Endpoints, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Endpoints, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Endpoints, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.EndpointsList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Endpoints, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Endpoints, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Endpoints, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.EndpointsApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Endpoints, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Endpoints, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Endpoints, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Endpoints, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.EndpointsList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Endpoints, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Endpoints, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Endpoints, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/events/resource.generated.go b/pkg/clients/kube/corev1/events/resource.generated.go index f532cb9683..f33ab02e6a 100644 --- a/pkg/clients/kube/corev1/events/resource.generated.go +++ b/pkg/clients/kube/corev1/events/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -193,11 +194,11 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.EventApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Event, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Event, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) CreateWithEventNamespace(arg0 *k8s_io_api_core_v1.Event) (*k8s_io_api_core_v1.Event, error) { @@ -205,15 +206,15 @@ func (c *withMetrics) CreateWithEventNamespace(arg0 *k8s_io_api_core_v1.Event) ( return c.inner.CreateWithEventNamespace(arg0) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Event, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetFieldSelector(arg0 *string, arg1 *string, arg2 *string, arg3 *string) k8s_io_apimachinery_pkg_fields.Selector { @@ -221,11 +222,11 @@ func (c *withMetrics) GetFieldSelector(arg0 *string, arg1 *string, arg2 *string, return c.inner.GetFieldSelector(arg0, arg1, arg2, arg3) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.EventList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Event, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) PatchWithEventNamespace(arg0 *k8s_io_api_core_v1.Event, arg1 []uint8) (*k8s_io_api_core_v1.Event, error) { @@ -237,7 +238,7 @@ func (c *withMetrics) Search(arg0 *k8s_io_apimachinery_pkg_runtime.Scheme, arg1 return c.inner.Search(arg0, arg1) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Event, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateWithEventNamespace(arg0 *k8s_io_api_core_v1.Event) (*k8s_io_api_core_v1.Event, error) { @@ -245,7 +246,7 @@ func (c *withMetrics) UpdateWithEventNamespace(arg0 *k8s_io_api_core_v1.Event) ( return c.inner.UpdateWithEventNamespace(arg0) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -256,114 +257,142 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.EventApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) CreateWithEventNamespace(arg0 *k8s_io_api_core_v1.Event) (*k8s_io_api_core_v1.Event, error) { return c.inner.CreateWithEventNamespace(arg0) } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetFieldSelector(arg0 *string, arg1 *string, arg2 *string, arg3 *string) k8s_io_apimachinery_pkg_fields.Selector { return c.inner.GetFieldSelector(arg0, arg1, arg2, arg3) } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.EventList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) PatchWithEventNamespace(arg0 *k8s_io_api_core_v1.Event, arg1 []uint8) (*k8s_io_api_core_v1.Event, error) { @@ -373,35 +402,43 @@ func (c *withTracing) Search(arg0 *k8s_io_apimachinery_pkg_runtime.Scheme, arg1 return c.inner.Search(arg0, arg1) } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateWithEventNamespace(arg0 *k8s_io_api_core_v1.Event) (*k8s_io_api_core_v1.Event, error) { return c.inner.UpdateWithEventNamespace(arg0) } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/limitranges/resource.generated.go b/pkg/clients/kube/corev1/limitranges/resource.generated.go index b6bd5d3929..586cf0a34b 100644 --- a/pkg/clients/kube/corev1/limitranges/resource.generated.go +++ b/pkg/clients/kube/corev1/limitranges/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.LimitRangeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.LimitRange, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.LimitRange, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.LimitRange, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.LimitRange, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.LimitRangeList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.LimitRange, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.LimitRange, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.LimitRange, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.LimitRangeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.LimitRange, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.LimitRange, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.LimitRange, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.LimitRange, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.LimitRangeList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.LimitRange, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.LimitRange, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.LimitRange, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/namespaces/resource.generated.go b/pkg/clients/kube/corev1/namespaces/resource.generated.go index d88576a148..ecaf5eb034 100644 --- a/pkg/clients/kube/corev1/namespaces/resource.generated.go +++ b/pkg/clients/kube/corev1/namespaces/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NamespaceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NamespaceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) Finalize(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("finalize") + defer c.recorder.RecordWithContext(arg0, "finalize") return c.inner.Finalize(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.NamespaceList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Namespace, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NamespaceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NamespaceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Finalize(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Finalize"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Finalize"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Finalize"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Finalize"), + ) + defer span.End() + } ret0, ret1 := c.inner.Finalize(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.NamespaceList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Namespace, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Namespace, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/nodes/resource.generated.go b/pkg/clients/kube/corev1/nodes/resource.generated.go index ba136c6363..827b6820ba 100644 --- a/pkg/clients/kube/corev1/nodes/resource.generated.go +++ b/pkg/clients/kube/corev1/nodes/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -173,51 +174,51 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Node, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.NodeList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) PatchStatus(arg0 context.Context, arg1 string, arg2 []uint8) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("patch_status") + defer c.recorder.RecordWithContext(arg0, "patch_status") return c.inner.PatchStatus(arg0, arg1, arg2) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Node, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Node, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Node, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -228,182 +229,230 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.NodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Node, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.NodeList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) PatchStatus(arg0 context.Context, arg1 string, arg2 []uint8) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "PatchStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("PatchStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "PatchStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("PatchStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.PatchStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Node, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Node, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Node, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/persistentvolumeclaims/resource.generated.go b/pkg/clients/kube/corev1/persistentvolumeclaims/resource.generated.go index c1597dc40a..073fc6ab33 100644 --- a/pkg/clients/kube/corev1/persistentvolumeclaims/resource.generated.go +++ b/pkg/clients/kube/corev1/persistentvolumeclaims/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeClaimApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeClaimApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolumeClaim, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PersistentVolumeClaimList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolumeClaim, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolumeClaim, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeClaimApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeClaimApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolumeClaim, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PersistentVolumeClaimList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolumeClaim, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolumeClaim, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolumeClaim, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/persistentvolumes/resource.generated.go b/pkg/clients/kube/corev1/persistentvolumes/resource.generated.go index 027453f5a7..2a24f93d68 100644 --- a/pkg/clients/kube/corev1/persistentvolumes/resource.generated.go +++ b/pkg/clients/kube/corev1/persistentvolumes/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolume, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PersistentVolumeList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.PersistentVolume, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolume, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolume, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PersistentVolumeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolume, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PersistentVolumeList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.PersistentVolume, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolume, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.PersistentVolume, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PersistentVolume, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/pods/resource.generated.go b/pkg/clients/kube/corev1/pods/resource.generated.go index 72b8ceb340..0dbba7d3cb 100644 --- a/pkg/clients/kube/corev1/pods/resource.generated.go +++ b/pkg/clients/kube/corev1/pods/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_api_policy_v1 "k8s.io/api/policy/v1" @@ -234,43 +235,43 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PodApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PodApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Bind(arg0 context.Context, arg1 *k8s_io_api_core_v1.Binding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) error { - defer c.recorder.Record("bind") + defer c.recorder.RecordWithContext(arg0, "bind") return c.inner.Bind(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Pod, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Evict(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.Eviction) error { - defer c.recorder.Record("evict") + defer c.recorder.RecordWithContext(arg0, "evict") return c.inner.Evict(arg0, arg1) } func (c *withMetrics) EvictV1(arg0 context.Context, arg1 *k8s_io_api_policy_v1.Eviction) error { - defer c.recorder.Record("evict_v1") + defer c.recorder.RecordWithContext(arg0, "evict_v1") return c.inner.EvictV1(arg0, arg1) } func (c *withMetrics) EvictV1beta1(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.Eviction) error { - defer c.recorder.Record("evict_v1beta1") + defer c.recorder.RecordWithContext(arg0, "evict_v1beta1") return c.inner.EvictV1beta1(arg0, arg1) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetLogs(arg0 string, arg1 *k8s_io_api_core_v1.PodLogOptions) *k8s_io_client_go_rest.Request { @@ -278,11 +279,11 @@ func (c *withMetrics) GetLogs(arg0 string, arg1 *k8s_io_api_core_v1.PodLogOption return c.inner.GetLogs(arg0, arg1) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PodList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) ProxyGet(arg0 string, arg1 string, arg2 string, arg3 string, arg4 map[string]string) k8s_io_client_go_rest.ResponseWrapper { @@ -290,19 +291,19 @@ func (c *withMetrics) ProxyGet(arg0 string, arg1 string, arg2 string, arg3 strin return c.inner.ProxyGet(arg0, arg1, arg2, arg3, arg4) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Pod, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateEphemeralContainers(arg0 context.Context, arg1 string, arg2 *k8s_io_api_core_v1.Pod, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("update_ephemeral_containers") + defer c.recorder.RecordWithContext(arg0, "update_ephemeral_containers") return c.inner.UpdateEphemeralContainers(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Pod, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Pod, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -313,248 +314,312 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PodApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PodApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Bind(arg0 context.Context, arg1 *k8s_io_api_core_v1.Binding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Bind"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Bind"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Bind"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Bind"), + ) + defer span.End() + } ret0 := c.inner.Bind(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Pod, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Evict(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.Eviction) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Evict"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Evict"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Evict"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Evict"), + ) + defer span.End() + } ret0 := c.inner.Evict(arg0, arg1) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) EvictV1(arg0 context.Context, arg1 *k8s_io_api_policy_v1.Eviction) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "EvictV1"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("EvictV1"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "EvictV1"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("EvictV1"), + ) + defer span.End() + } ret0 := c.inner.EvictV1(arg0, arg1) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) EvictV1beta1(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.Eviction) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "EvictV1beta1"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("EvictV1beta1"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "EvictV1beta1"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("EvictV1beta1"), + ) + defer span.End() + } ret0 := c.inner.EvictV1beta1(arg0, arg1) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetLogs(arg0 string, arg1 *k8s_io_api_core_v1.PodLogOptions) *k8s_io_client_go_rest.Request { return c.inner.GetLogs(arg0, arg1) } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PodList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ProxyGet(arg0 string, arg1 string, arg2 string, arg3 string, arg4 map[string]string) k8s_io_client_go_rest.ResponseWrapper { return c.inner.ProxyGet(arg0, arg1, arg2, arg3, arg4) } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Pod, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateEphemeralContainers(arg0 context.Context, arg1 string, arg2 *k8s_io_api_core_v1.Pod, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateEphemeralContainers"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateEphemeralContainers"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateEphemeralContainers"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateEphemeralContainers"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateEphemeralContainers(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Pod, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Pod, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/podtemplates/resource.generated.go b/pkg/clients/kube/corev1/podtemplates/resource.generated.go index f3ee990746..004b22678b 100644 --- a/pkg/clients/kube/corev1/podtemplates/resource.generated.go +++ b/pkg/clients/kube/corev1/podtemplates/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PodTemplateApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.PodTemplate, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PodTemplateList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.PodTemplate, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.PodTemplate, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.PodTemplateApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.PodTemplate, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.PodTemplateList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.PodTemplate, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.PodTemplate, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.PodTemplate, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/replicationcontrollers/resource.generated.go b/pkg/clients/kube/corev1/replicationcontrollers/resource.generated.go index b1c6be651e..969110e3b4 100644 --- a/pkg/clients/kube/corev1/replicationcontrollers/resource.generated.go +++ b/pkg/clients/kube/corev1/replicationcontrollers/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_autoscaling_v1 "k8s.io/api/autoscaling/v1" k8s_io_api_core_v1 "k8s.io/api/core/v1" @@ -185,55 +186,55 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ReplicationControllerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ReplicationControllerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ReplicationController, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("get_scale") + defer c.recorder.RecordWithContext(arg0, "get_scale") return c.inner.GetScale(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ReplicationControllerList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ReplicationController, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ReplicationController, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - defer c.recorder.Record("update_scale") + defer c.recorder.RecordWithContext(arg0, "update_scale") return c.inner.UpdateScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.ReplicationController, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -244,197 +245,249 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ReplicationControllerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ReplicationControllerApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ReplicationController, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("GetScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("GetScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.GetScale(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ReplicationControllerList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ReplicationController, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ReplicationController, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_autoscaling_v1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_autoscaling_v1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.ReplicationController, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ReplicationController, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/resourcequotas/resource.generated.go b/pkg/clients/kube/corev1/resourcequotas/resource.generated.go index fa1269405e..1677a9985b 100644 --- a/pkg/clients/kube/corev1/resourcequotas/resource.generated.go +++ b/pkg/clients/kube/corev1/resourcequotas/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ResourceQuotaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ResourceQuotaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ResourceQuota, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ResourceQuotaList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ResourceQuota, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ResourceQuota, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.ResourceQuota, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ResourceQuotaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ResourceQuotaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ResourceQuota, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ResourceQuotaList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ResourceQuota, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ResourceQuota, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.ResourceQuota, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ResourceQuota, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/secrets/resource.generated.go b/pkg/clients/kube/corev1/secrets/resource.generated.go index 458db73516..eb3b18b72f 100644 --- a/pkg/clients/kube/corev1/secrets/resource.generated.go +++ b/pkg/clients/kube/corev1/secrets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.SecretApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Secret, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Secret, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Secret, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Secret, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.SecretList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Secret, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Secret, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Secret, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.SecretApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Secret, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Secret, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Secret, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Secret, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.SecretList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Secret, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Secret, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Secret, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/serviceaccounts/resource.generated.go b/pkg/clients/kube/corev1/serviceaccounts/resource.generated.go index 538c5e05f9..abc94aea2b 100644 --- a/pkg/clients/kube/corev1/serviceaccounts/resource.generated.go +++ b/pkg/clients/kube/corev1/serviceaccounts/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_authentication_v1 "k8s.io/api/authentication/v1" k8s_io_api_core_v1 "k8s.io/api/core/v1" @@ -152,43 +153,43 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ServiceAccountApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ServiceAccount, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) CreateToken(arg0 context.Context, arg1 string, arg2 *k8s_io_api_authentication_v1.TokenRequest, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authentication_v1.TokenRequest, error) { - defer c.recorder.Record("create_token") + defer c.recorder.RecordWithContext(arg0, "create_token") return c.inner.CreateToken(arg0, arg1, arg2, arg3) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ServiceAccountList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ServiceAccount, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ServiceAccount, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -199,152 +200,192 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ServiceAccountApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.ServiceAccount, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) CreateToken(arg0 context.Context, arg1 string, arg2 *k8s_io_api_authentication_v1.TokenRequest, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_authentication_v1.TokenRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "CreateToken"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("CreateToken"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "CreateToken"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("CreateToken"), + ) + defer span.End() + } ret0, ret1 := c.inner.CreateToken(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ServiceAccountList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.ServiceAccount, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.ServiceAccount, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.ServiceAccount, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/corev1/services/resource.generated.go b/pkg/clients/kube/corev1/services/resource.generated.go index 4f02e01b86..5676517691 100644 --- a/pkg/clients/kube/corev1/services/resource.generated.go +++ b/pkg/clients/kube/corev1/services/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_core_v1 "k8s.io/api/core/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -159,31 +160,31 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ServiceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Service, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ServiceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Service, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Service, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Service, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Service, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ServiceList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Service, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) ProxyGet(arg0 string, arg1 string, arg2 string, arg3 string, arg4 map[string]string) k8s_io_client_go_rest.ResponseWrapper { @@ -191,15 +192,15 @@ func (c *withMetrics) ProxyGet(arg0 string, arg1 string, arg2 string, arg3 strin return c.inner.ProxyGet(arg0, arg1, arg2, arg3, arg4) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Service, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Service, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Service, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Service, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -210,155 +211,195 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ServiceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Service, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_core_v1.ServiceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_core_v1.Service, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_core_v1.Service, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_core_v1.Service, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_core_v1.Service, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_core_v1.ServiceList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_core_v1.Service, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ProxyGet(arg0 string, arg1 string, arg2 string, arg3 string, arg4 map[string]string) k8s_io_client_go_rest.ResponseWrapper { return c.inner.ProxyGet(arg0, arg1, arg2, arg3, arg4) } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_core_v1.Service, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Service, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_core_v1.Service, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_core_v1.Service, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/discoveryv1/endpointslices/resource.generated.go b/pkg/clients/kube/discoveryv1/endpointslices/resource.generated.go index 8a053e4cc5..414d2911f0 100644 --- a/pkg/clients/kube/discoveryv1/endpointslices/resource.generated.go +++ b/pkg/clients/kube/discoveryv1/endpointslices/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_discovery_v1 "k8s.io/api/discovery/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_discovery_v1.EndpointSliceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_discovery_v1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_discovery_v1.EndpointSliceList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_discovery_v1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_discovery_v1.EndpointSliceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_discovery_v1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_discovery_v1.EndpointSliceList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_discovery_v1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_discovery_v1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/discoveryv1beta1/endpointslices/resource.generated.go b/pkg/clients/kube/discoveryv1beta1/endpointslices/resource.generated.go index f2aae692a2..b677c59e21 100644 --- a/pkg/clients/kube/discoveryv1beta1/endpointslices/resource.generated.go +++ b/pkg/clients/kube/discoveryv1beta1/endpointslices/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_discovery_v1beta1 "k8s.io/api/discovery/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_discovery_v1beta1.EndpointSliceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_discovery_v1beta1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_discovery_v1beta1.EndpointSliceList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_discovery_v1beta1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_discovery_v1beta1.EndpointSliceApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_discovery_v1beta1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_discovery_v1beta1.EndpointSliceList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_discovery_v1beta1.EndpointSlice, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_discovery_v1beta1.EndpointSlice, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/eventsv1/events/resource.generated.go b/pkg/clients/kube/eventsv1/events/resource.generated.go index b8a718a662..297089b4c1 100644 --- a/pkg/clients/kube/eventsv1/events/resource.generated.go +++ b/pkg/clients/kube/eventsv1/events/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_events_v1 "k8s.io/api/events/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_events_v1.EventApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_events_v1.Event, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_events_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_events_v1.Event, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_events_v1.Event, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_events_v1.EventList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_events_v1.Event, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_events_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_events_v1.Event, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_events_v1.EventApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_events_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_events_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_events_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_events_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_events_v1.EventList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_events_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_events_v1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_events_v1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/eventsv1beta1/events/resource.generated.go b/pkg/clients/kube/eventsv1beta1/events/resource.generated.go index 9a810664ab..4587fdfb05 100644 --- a/pkg/clients/kube/eventsv1beta1/events/resource.generated.go +++ b/pkg/clients/kube/eventsv1beta1/events/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_events_v1beta1 "k8s.io/api/events/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -173,11 +174,11 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_events_v1beta1.EventApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_events_v1beta1.Event, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_events_v1beta1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_events_v1beta1.Event, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) CreateWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.Event) (*k8s_io_api_events_v1beta1.Event, error) { @@ -185,23 +186,23 @@ func (c *withMetrics) CreateWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.E return c.inner.CreateWithEventNamespace(arg0) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_events_v1beta1.Event, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_events_v1beta1.EventList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_events_v1beta1.Event, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) PatchWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.Event, arg1 []uint8) (*k8s_io_api_events_v1beta1.Event, error) { @@ -209,7 +210,7 @@ func (c *withMetrics) PatchWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.Ev return c.inner.PatchWithEventNamespace(arg0, arg1) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_events_v1beta1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_events_v1beta1.Event, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.Event) (*k8s_io_api_events_v1beta1.Event, error) { @@ -217,7 +218,7 @@ func (c *withMetrics) UpdateWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.E return c.inner.UpdateWithEventNamespace(arg0) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -228,146 +229,182 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_events_v1beta1.EventApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_events_v1beta1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_events_v1beta1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_events_v1beta1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) CreateWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.Event) (*k8s_io_api_events_v1beta1.Event, error) { return c.inner.CreateWithEventNamespace(arg0) } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_events_v1beta1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_events_v1beta1.EventList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_events_v1beta1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) PatchWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.Event, arg1 []uint8) (*k8s_io_api_events_v1beta1.Event, error) { return c.inner.PatchWithEventNamespace(arg0, arg1) } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_events_v1beta1.Event, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_events_v1beta1.Event, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateWithEventNamespace(arg0 *k8s_io_api_events_v1beta1.Event) (*k8s_io_api_events_v1beta1.Event, error) { return c.inner.UpdateWithEventNamespace(arg0) } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/extensionsv1beta1/daemonsets/resource.generated.go b/pkg/clients/kube/extensionsv1beta1/daemonsets/resource.generated.go index 377414e6ef..e0d8c3b7d4 100644 --- a/pkg/clients/kube/extensionsv1beta1/daemonsets/resource.generated.go +++ b/pkg/clients/kube/extensionsv1beta1/daemonsets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_extensions_v1beta1 "k8s.io/api/extensions/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.DaemonSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DaemonSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.DaemonSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DaemonSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.DaemonSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/extensionsv1beta1/deployments/resource.generated.go b/pkg/clients/kube/extensionsv1beta1/deployments/resource.generated.go index 8ddcb2e12a..fc76518656 100644 --- a/pkg/clients/kube/extensionsv1beta1/deployments/resource.generated.go +++ b/pkg/clients/kube/extensionsv1beta1/deployments/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_extensions_v1beta1 "k8s.io/api/extensions/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -206,63 +207,63 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - defer c.recorder.Record("apply_scale") + defer c.recorder.RecordWithContext(arg0, "apply_scale") return c.inner.ApplyScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - defer c.recorder.Record("get_scale") + defer c.recorder.RecordWithContext(arg0, "get_scale") return c.inner.GetScale(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.DeploymentList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Rollback(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DeploymentRollback, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) error { - defer c.recorder.Record("rollback") + defer c.recorder.RecordWithContext(arg0, "rollback") return c.inner.Rollback(arg0, arg1, arg2) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_extensions_v1beta1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - defer c.recorder.Record("update_scale") + defer c.recorder.RecordWithContext(arg0, "update_scale") return c.inner.UpdateScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -273,227 +274,287 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.DeploymentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("GetScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("GetScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.GetScale(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.DeploymentList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Rollback(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.DeploymentRollback, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Rollback"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Rollback"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Rollback"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Rollback"), + ) + defer span.End() + } ret0 := c.inner.Rollback(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_extensions_v1beta1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Deployment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Deployment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/extensionsv1beta1/ingresses/resource.generated.go b/pkg/clients/kube/extensionsv1beta1/ingresses/resource.generated.go index 2e5c478b78..387e0e4d84 100644 --- a/pkg/clients/kube/extensionsv1beta1/ingresses/resource.generated.go +++ b/pkg/clients/kube/extensionsv1beta1/ingresses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_extensions_v1beta1 "k8s.io/api/extensions/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.IngressList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.IngressList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/extensionsv1beta1/networkpolicies/resource.generated.go b/pkg/clients/kube/extensionsv1beta1/networkpolicies/resource.generated.go index d1d23bd3b7..4b1ad0ef03 100644 --- a/pkg/clients/kube/extensionsv1beta1/networkpolicies/resource.generated.go +++ b/pkg/clients/kube/extensionsv1beta1/networkpolicies/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_extensions_v1beta1 "k8s.io/api/extensions/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/extensionsv1beta1/podsecuritypolicies/resource.generated.go b/pkg/clients/kube/extensionsv1beta1/podsecuritypolicies/resource.generated.go index 2ebea00229..69fc0d6dba 100644 --- a/pkg/clients/kube/extensionsv1beta1/podsecuritypolicies/resource.generated.go +++ b/pkg/clients/kube/extensionsv1beta1/podsecuritypolicies/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_extensions_v1beta1 "k8s.io/api/extensions/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.PodSecurityPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.PodSecurityPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/extensionsv1beta1/replicasets/resource.generated.go b/pkg/clients/kube/extensionsv1beta1/replicasets/resource.generated.go index cf5d93a6ae..742e4e30de 100644 --- a/pkg/clients/kube/extensionsv1beta1/replicasets/resource.generated.go +++ b/pkg/clients/kube/extensionsv1beta1/replicasets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_extensions_v1beta1 "k8s.io/api/extensions/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -195,59 +196,59 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - defer c.recorder.Record("apply_scale") + defer c.recorder.RecordWithContext(arg0, "apply_scale") return c.inner.ApplyScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - defer c.recorder.Record("get_scale") + defer c.recorder.RecordWithContext(arg0, "get_scale") return c.inner.GetScale(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_extensions_v1beta1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - defer c.recorder.Record("update_scale") + defer c.recorder.RecordWithContext(arg0, "update_scale") return c.inner.UpdateScale(arg0, arg1, arg2, arg3) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -258,212 +259,268 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyScale(arg0 context.Context, arg1 string, arg2 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ScaleApplyConfiguration, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_extensions_v1beta1.ReplicaSetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) GetScale(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("GetScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "GetScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("GetScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.GetScale(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateScale(arg0 context.Context, arg1 string, arg2 *k8s_io_api_extensions_v1beta1.Scale, arg3 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.Scale, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateScale"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateScale"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateScale"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateScale(arg0, arg1, arg2, arg3) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_extensions_v1beta1.ReplicaSet, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_extensions_v1beta1.ReplicaSet, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/flowcontrolv1alpha1/flowschemas/resource.generated.go b/pkg/clients/kube/flowcontrolv1alpha1/flowschemas/resource.generated.go index 61d9c386ef..607a89b1ee 100644 --- a/pkg/clients/kube/flowcontrolv1alpha1/flowschemas/resource.generated.go +++ b/pkg/clients/kube/flowcontrolv1alpha1/flowschemas/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_flowcontrol_v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchemaList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchemaList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/flowcontrolv1alpha1/prioritylevelconfigurations/resource.generated.go b/pkg/clients/kube/flowcontrolv1alpha1/prioritylevelconfigurations/resource.generated.go index 6069d11358..1c0447f1c4 100644 --- a/pkg/clients/kube/flowcontrolv1alpha1/prioritylevelconfigurations/resource.generated.go +++ b/pkg/clients/kube/flowcontrolv1alpha1/prioritylevelconfigurations/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_flowcontrol_v1alpha1 "k8s.io/api/flowcontrol/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfigurationList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1alpha1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfigurationList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1alpha1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/flowcontrolv1beta1/flowschemas/resource.generated.go b/pkg/clients/kube/flowcontrolv1beta1/flowschemas/resource.generated.go index 508c84f61f..08f81f4885 100644 --- a/pkg/clients/kube/flowcontrolv1beta1/flowschemas/resource.generated.go +++ b/pkg/clients/kube/flowcontrolv1beta1/flowschemas/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_flowcontrol_v1beta1 "k8s.io/api/flowcontrol/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchemaList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchemaList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/flowcontrolv1beta1/prioritylevelconfigurations/resource.generated.go b/pkg/clients/kube/flowcontrolv1beta1/prioritylevelconfigurations/resource.generated.go index 8591e0eee3..8f907aae67 100644 --- a/pkg/clients/kube/flowcontrolv1beta1/prioritylevelconfigurations/resource.generated.go +++ b/pkg/clients/kube/flowcontrolv1beta1/prioritylevelconfigurations/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_flowcontrol_v1beta1 "k8s.io/api/flowcontrol/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfigurationList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta1.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfigurationList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta1.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/flowcontrolv1beta2/flowschemas/resource.generated.go b/pkg/clients/kube/flowcontrolv1beta2/flowschemas/resource.generated.go index 197211bb8b..dc8c495ac2 100644 --- a/pkg/clients/kube/flowcontrolv1beta2/flowschemas/resource.generated.go +++ b/pkg/clients/kube/flowcontrolv1beta2/flowschemas/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_flowcontrol_v1beta2 "k8s.io/api/flowcontrol/v1beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchemaList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.FlowSchemaApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchemaList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.FlowSchema, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.FlowSchema, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/flowcontrolv1beta2/prioritylevelconfigurations/resource.generated.go b/pkg/clients/kube/flowcontrolv1beta2/prioritylevelconfigurations/resource.generated.go index c0b0542a7a..83b1d0f15a 100644 --- a/pkg/clients/kube/flowcontrolv1beta2/prioritylevelconfigurations/resource.generated.go +++ b/pkg/clients/kube/flowcontrolv1beta2/prioritylevelconfigurations/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_flowcontrol_v1beta2 "k8s.io/api/flowcontrol/v1beta2" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfigurationList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_flowcontrol_v1beta2.PriorityLevelConfigurationApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfigurationList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_flowcontrol_v1beta2.PriorityLevelConfiguration, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/internalv1alpha1/storageversions/resource.generated.go b/pkg/clients/kube/internalv1alpha1/storageversions/resource.generated.go index 3cce77f4c6..2d3d933031 100644 --- a/pkg/clients/kube/internalv1alpha1/storageversions/resource.generated.go +++ b/pkg/clients/kube/internalv1alpha1/storageversions/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_apiserverinternal_v1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apiserverinternal_v1alpha1.StorageVersionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apiserverinternal_v1alpha1.StorageVersionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersionList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apiserverinternal_v1alpha1.StorageVersionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_apiserverinternal_v1alpha1.StorageVersionApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersionList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_apiserverinternal_v1alpha1.StorageVersion, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/networkingv1/ingressclasses/resource.generated.go b/pkg/clients/kube/networkingv1/ingressclasses/resource.generated.go index 253b6084f0..d728e82108 100644 --- a/pkg/clients/kube/networkingv1/ingressclasses/resource.generated.go +++ b/pkg/clients/kube/networkingv1/ingressclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_networking_v1 "k8s.io/api/networking/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.IngressClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1.IngressClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1.IngressClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.IngressClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1.IngressClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/networkingv1/ingresses/resource.generated.go b/pkg/clients/kube/networkingv1/ingresses/resource.generated.go index f15acadb3b..216a905e0d 100644 --- a/pkg/clients/kube/networkingv1/ingresses/resource.generated.go +++ b/pkg/clients/kube/networkingv1/ingresses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_networking_v1 "k8s.io/api/networking/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.Ingress, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.Ingress, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1.Ingress, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1.Ingress, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1.IngressList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1.Ingress, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.Ingress, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_networking_v1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.Ingress, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1.IngressList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_networking_v1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/networkingv1/networkpolicies/resource.generated.go b/pkg/clients/kube/networkingv1/networkpolicies/resource.generated.go index 8c6d86981d..edd9b58446 100644 --- a/pkg/clients/kube/networkingv1/networkpolicies/resource.generated.go +++ b/pkg/clients/kube/networkingv1/networkpolicies/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_networking_v1 "k8s.io/api/networking/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1.NetworkPolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_networking_v1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1.NetworkPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1.NetworkPolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_networking_v1.NetworkPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1.NetworkPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/networkingv1alpha1/clustercidrs/resource.generated.go b/pkg/clients/kube/networkingv1alpha1/clustercidrs/resource.generated.go index a7ac95edaa..4f231b99f6 100644 --- a/pkg/clients/kube/networkingv1alpha1/clustercidrs/resource.generated.go +++ b/pkg/clients/kube/networkingv1alpha1/clustercidrs/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_networking_v1alpha1 "k8s.io/api/networking/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1alpha1.ClusterCIDRApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1alpha1.ClusterCIDR, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDRList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1alpha1.ClusterCIDR, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1alpha1.ClusterCIDRApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1alpha1.ClusterCIDR, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDRList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1alpha1.ClusterCIDR, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1alpha1.ClusterCIDR, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/networkingv1beta1/ingressclasses/resource.generated.go b/pkg/clients/kube/networkingv1beta1/ingressclasses/resource.generated.go index aa584ec491..999167f10d 100644 --- a/pkg/clients/kube/networkingv1beta1/ingressclasses/resource.generated.go +++ b/pkg/clients/kube/networkingv1beta1/ingressclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_networking_v1beta1 "k8s.io/api/networking/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1beta1.IngressClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1beta1.IngressClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1beta1.IngressClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1beta1.IngressClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.IngressClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1beta1.IngressClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/networkingv1beta1/ingresses/resource.generated.go b/pkg/clients/kube/networkingv1beta1/ingresses/resource.generated.go index 2f14e98300..0c98b3175c 100644 --- a/pkg/clients/kube/networkingv1beta1/ingresses/resource.generated.go +++ b/pkg/clients/kube/networkingv1beta1/ingresses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_networking_v1beta1 "k8s.io/api/networking/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1beta1.IngressList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1beta1.Ingress, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_networking_v1beta1.IngressApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_networking_v1beta1.IngressList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_networking_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_networking_v1beta1.Ingress, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_networking_v1beta1.Ingress, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/nodev1/runtimeclasses/resource.generated.go b/pkg/clients/kube/nodev1/runtimeclasses/resource.generated.go index bac1526d4e..61632bff63 100644 --- a/pkg/clients/kube/nodev1/runtimeclasses/resource.generated.go +++ b/pkg/clients/kube/nodev1/runtimeclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_node_v1 "k8s.io/api/node/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_node_v1.RuntimeClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_node_v1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_node_v1.RuntimeClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_node_v1.RuntimeClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_node_v1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_node_v1.RuntimeClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_node_v1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_node_v1.RuntimeClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_node_v1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_node_v1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_node_v1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/nodev1alpha1/runtimeclasses/resource.generated.go b/pkg/clients/kube/nodev1alpha1/runtimeclasses/resource.generated.go index 8571c25805..578eac9fe9 100644 --- a/pkg/clients/kube/nodev1alpha1/runtimeclasses/resource.generated.go +++ b/pkg/clients/kube/nodev1alpha1/runtimeclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_node_v1alpha1 "k8s.io/api/node/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_node_v1alpha1.RuntimeClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_node_v1alpha1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_node_v1alpha1.RuntimeClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_node_v1alpha1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_node_v1alpha1.RuntimeClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_node_v1alpha1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_node_v1alpha1.RuntimeClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_node_v1alpha1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_node_v1alpha1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/nodev1beta1/runtimeclasses/resource.generated.go b/pkg/clients/kube/nodev1beta1/runtimeclasses/resource.generated.go index 38e98ede81..f64beaee99 100644 --- a/pkg/clients/kube/nodev1beta1/runtimeclasses/resource.generated.go +++ b/pkg/clients/kube/nodev1beta1/runtimeclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_node_v1beta1 "k8s.io/api/node/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_node_v1beta1.RuntimeClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_node_v1beta1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_node_v1beta1.RuntimeClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_node_v1beta1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_node_v1beta1.RuntimeClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_node_v1beta1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_node_v1beta1.RuntimeClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_node_v1beta1.RuntimeClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_node_v1beta1.RuntimeClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/policyv1/evictions/resource.generated.go b/pkg/clients/kube/policyv1/evictions/resource.generated.go index ceaada8211..3d829c36b8 100644 --- a/pkg/clients/kube/policyv1/evictions/resource.generated.go +++ b/pkg/clients/kube/policyv1/evictions/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_policy_v1 "k8s.io/api/policy/v1" k8s_io_client_go_kubernetes_typed_policy_v1 "k8s.io/client-go/kubernetes/typed/policy/v1" @@ -48,7 +49,7 @@ type withMetrics struct { } func (c *withMetrics) Evict(arg0 context.Context, arg1 *k8s_io_api_policy_v1.Eviction) error { - defer c.recorder.Record("evict") + defer c.recorder.RecordWithContext(arg0, "evict") return c.inner.Evict(arg0, arg1) } @@ -59,17 +60,21 @@ type withTracing struct { } func (c *withTracing) Evict(arg0 context.Context, arg1 *k8s_io_api_policy_v1.Eviction) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Evict"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Evict"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Evict"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Evict"), + ) + defer span.End() + } ret0 := c.inner.Evict(arg0, arg1) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } diff --git a/pkg/clients/kube/policyv1/poddisruptionbudgets/resource.generated.go b/pkg/clients/kube/policyv1/poddisruptionbudgets/resource.generated.go index dd09e54b0c..08f0bb44fa 100644 --- a/pkg/clients/kube/policyv1/poddisruptionbudgets/resource.generated.go +++ b/pkg/clients/kube/policyv1/poddisruptionbudgets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_policy_v1 "k8s.io/api/policy/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_policy_v1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_policy_v1.PodDisruptionBudgetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_policy_v1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_policy_v1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_policy_v1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_policy_v1.PodDisruptionBudgetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_policy_v1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_policy_v1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/policyv1beta1/evictions/resource.generated.go b/pkg/clients/kube/policyv1beta1/evictions/resource.generated.go index 88dd50d94c..375809f6b0 100644 --- a/pkg/clients/kube/policyv1beta1/evictions/resource.generated.go +++ b/pkg/clients/kube/policyv1beta1/evictions/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_policy_v1beta1 "k8s.io/api/policy/v1beta1" k8s_io_client_go_kubernetes_typed_policy_v1beta1 "k8s.io/client-go/kubernetes/typed/policy/v1beta1" @@ -48,7 +49,7 @@ type withMetrics struct { } func (c *withMetrics) Evict(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.Eviction) error { - defer c.recorder.Record("evict") + defer c.recorder.RecordWithContext(arg0, "evict") return c.inner.Evict(arg0, arg1) } @@ -59,17 +60,21 @@ type withTracing struct { } func (c *withTracing) Evict(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.Eviction) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Evict"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Evict"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Evict"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Evict"), + ) + defer span.End() + } ret0 := c.inner.Evict(arg0, arg1) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } diff --git a/pkg/clients/kube/policyv1beta1/poddisruptionbudgets/resource.generated.go b/pkg/clients/kube/policyv1beta1/poddisruptionbudgets/resource.generated.go index 6f69e71e1c..956efc44b8 100644 --- a/pkg/clients/kube/policyv1beta1/poddisruptionbudgets/resource.generated.go +++ b/pkg/clients/kube/policyv1beta1/poddisruptionbudgets/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_policy_v1beta1 "k8s.io/api/policy/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1beta1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1beta1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudgetList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1beta1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1beta1.PodDisruptionBudgetApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudgetList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodDisruptionBudget, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1beta1.PodDisruptionBudget, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/policyv1beta1/podsecuritypolicies/resource.generated.go b/pkg/clients/kube/policyv1beta1/podsecuritypolicies/resource.generated.go index 55d9c6d027..3944e9f303 100644 --- a/pkg/clients/kube/policyv1beta1/podsecuritypolicies/resource.generated.go +++ b/pkg/clients/kube/policyv1beta1/podsecuritypolicies/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_policy_v1beta1 "k8s.io/api/policy/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1beta1.PodSecurityPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_policy_v1beta1.PodSecurityPolicyApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_policy_v1beta1.PodSecurityPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_policy_v1beta1.PodSecurityPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1/clusterrolebindings/resource.generated.go b/pkg/clients/kube/rbacv1/clusterrolebindings/resource.generated.go index 411bc13c21..1e8c82653e 100644 --- a/pkg/clients/kube/rbacv1/clusterrolebindings/resource.generated.go +++ b/pkg/clients/kube/rbacv1/clusterrolebindings/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1 "k8s.io/api/rbac/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.ClusterRoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.ClusterRoleBindingList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.ClusterRoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.ClusterRoleBindingList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1/clusterroles/resource.generated.go b/pkg/clients/kube/rbacv1/clusterroles/resource.generated.go index ed36ecf0da..d656ccea18 100644 --- a/pkg/clients/kube/rbacv1/clusterroles/resource.generated.go +++ b/pkg/clients/kube/rbacv1/clusterroles/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1 "k8s.io/api/rbac/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.ClusterRoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.ClusterRoleList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.ClusterRole, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.ClusterRoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.ClusterRoleList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1/rolebindings/resource.generated.go b/pkg/clients/kube/rbacv1/rolebindings/resource.generated.go index 3c0f77cf41..fbb989f4ce 100644 --- a/pkg/clients/kube/rbacv1/rolebindings/resource.generated.go +++ b/pkg/clients/kube/rbacv1/rolebindings/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1 "k8s.io/api/rbac/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.RoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.RoleBindingList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.RoleBinding, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.RoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.RoleBindingList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1/roles/resource.generated.go b/pkg/clients/kube/rbacv1/roles/resource.generated.go index 2ef67747ee..628ff15ccd 100644 --- a/pkg/clients/kube/rbacv1/roles/resource.generated.go +++ b/pkg/clients/kube/rbacv1/roles/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1 "k8s.io/api/rbac/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.RoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.Role, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.Role, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.Role, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.RoleList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.Role, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.Role, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1.RoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1.RoleList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1alpha1/clusterrolebindings/resource.generated.go b/pkg/clients/kube/rbacv1alpha1/clusterrolebindings/resource.generated.go index c74fea9cc3..fb85fd0793 100644 --- a/pkg/clients/kube/rbacv1alpha1/clusterrolebindings/resource.generated.go +++ b/pkg/clients/kube/rbacv1alpha1/clusterrolebindings/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1alpha1 "k8s.io/api/rbac/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.ClusterRoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBindingList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.ClusterRoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBindingList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1alpha1/clusterroles/resource.generated.go b/pkg/clients/kube/rbacv1alpha1/clusterroles/resource.generated.go index 57a1c82cbe..f808043455 100644 --- a/pkg/clients/kube/rbacv1alpha1/clusterroles/resource.generated.go +++ b/pkg/clients/kube/rbacv1alpha1/clusterroles/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1alpha1 "k8s.io/api/rbac/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.ClusterRoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.ClusterRoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRoleList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1alpha1/rolebindings/resource.generated.go b/pkg/clients/kube/rbacv1alpha1/rolebindings/resource.generated.go index c73df65efa..4cc51d5d6b 100644 --- a/pkg/clients/kube/rbacv1alpha1/rolebindings/resource.generated.go +++ b/pkg/clients/kube/rbacv1alpha1/rolebindings/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1alpha1 "k8s.io/api/rbac/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.RoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.RoleBindingList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.RoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.RoleBindingList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1alpha1/roles/resource.generated.go b/pkg/clients/kube/rbacv1alpha1/roles/resource.generated.go index 5c5d421811..01c8701777 100644 --- a/pkg/clients/kube/rbacv1alpha1/roles/resource.generated.go +++ b/pkg/clients/kube/rbacv1alpha1/roles/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1alpha1 "k8s.io/api/rbac/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.RoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.RoleList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.Role, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1alpha1.RoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1alpha1.RoleList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1alpha1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1alpha1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1alpha1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1beta1/clusterrolebindings/resource.generated.go b/pkg/clients/kube/rbacv1beta1/clusterrolebindings/resource.generated.go index 2693c5a53f..d06ddbe405 100644 --- a/pkg/clients/kube/rbacv1beta1/clusterrolebindings/resource.generated.go +++ b/pkg/clients/kube/rbacv1beta1/clusterrolebindings/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1beta1 "k8s.io/api/rbac/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.ClusterRoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBindingList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.ClusterRoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBindingList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1beta1/clusterroles/resource.generated.go b/pkg/clients/kube/rbacv1beta1/clusterroles/resource.generated.go index 5f8f25a405..7370a58317 100644 --- a/pkg/clients/kube/rbacv1beta1/clusterroles/resource.generated.go +++ b/pkg/clients/kube/rbacv1beta1/clusterroles/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1beta1 "k8s.io/api/rbac/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.ClusterRoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.ClusterRoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.ClusterRoleList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.ClusterRole, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.ClusterRole, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1beta1/rolebindings/resource.generated.go b/pkg/clients/kube/rbacv1beta1/rolebindings/resource.generated.go index 154e9282c7..93da49f37b 100644 --- a/pkg/clients/kube/rbacv1beta1/rolebindings/resource.generated.go +++ b/pkg/clients/kube/rbacv1beta1/rolebindings/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1beta1 "k8s.io/api/rbac/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.RoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.RoleBindingList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.RoleBindingApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.RoleBindingList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.RoleBinding, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.RoleBinding, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/rbacv1beta1/roles/resource.generated.go b/pkg/clients/kube/rbacv1beta1/roles/resource.generated.go index 9b4bb8044f..1e046639a8 100644 --- a/pkg/clients/kube/rbacv1beta1/roles/resource.generated.go +++ b/pkg/clients/kube/rbacv1beta1/roles/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_rbac_v1beta1 "k8s.io/api/rbac/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.RoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.RoleList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.Role, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_rbac_v1beta1.RoleApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_rbac_v1beta1.RoleList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_rbac_v1beta1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_rbac_v1beta1.Role, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_rbac_v1beta1.Role, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/schedulingv1/priorityclasses/resource.generated.go b/pkg/clients/kube/schedulingv1/priorityclasses/resource.generated.go index e9d39fe827..e61994e075 100644 --- a/pkg/clients/kube/schedulingv1/priorityclasses/resource.generated.go +++ b/pkg/clients/kube/schedulingv1/priorityclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_scheduling_v1 "k8s.io/api/scheduling/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_scheduling_v1.PriorityClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_scheduling_v1.PriorityClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_scheduling_v1.PriorityClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_scheduling_v1.PriorityClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_scheduling_v1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/schedulingv1alpha1/priorityclasses/resource.generated.go b/pkg/clients/kube/schedulingv1alpha1/priorityclasses/resource.generated.go index 83b9e2aa4c..8f772f7489 100644 --- a/pkg/clients/kube/schedulingv1alpha1/priorityclasses/resource.generated.go +++ b/pkg/clients/kube/schedulingv1alpha1/priorityclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_scheduling_v1alpha1 "k8s.io/api/scheduling/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_scheduling_v1alpha1.PriorityClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1alpha1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1alpha1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_scheduling_v1alpha1.PriorityClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1alpha1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1alpha1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_scheduling_v1alpha1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/schedulingv1beta1/priorityclasses/resource.generated.go b/pkg/clients/kube/schedulingv1beta1/priorityclasses/resource.generated.go index 4df8579e7f..5ad3b05051 100644 --- a/pkg/clients/kube/schedulingv1beta1/priorityclasses/resource.generated.go +++ b/pkg/clients/kube/schedulingv1beta1/priorityclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_scheduling_v1beta1 "k8s.io/api/scheduling/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_scheduling_v1beta1.PriorityClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1beta1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1beta1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_scheduling_v1beta1.PriorityClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1beta1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_scheduling_v1beta1.PriorityClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_scheduling_v1beta1.PriorityClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1/csidrivers/resource.generated.go b/pkg/clients/kube/storagev1/csidrivers/resource.generated.go index 925aae7801..dc59d066e9 100644 --- a/pkg/clients/kube/storagev1/csidrivers/resource.generated.go +++ b/pkg/clients/kube/storagev1/csidrivers/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1 "k8s.io/api/storage/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.CSIDriverApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.CSIDriverList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.CSIDriver, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.CSIDriverApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.CSIDriverList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1/csinodes/resource.generated.go b/pkg/clients/kube/storagev1/csinodes/resource.generated.go index ffde2093da..605a1c1101 100644 --- a/pkg/clients/kube/storagev1/csinodes/resource.generated.go +++ b/pkg/clients/kube/storagev1/csinodes/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1 "k8s.io/api/storage/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.CSINodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.CSINode, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.CSINode, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.CSINode, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.CSINodeList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.CSINode, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.CSINode, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.CSINodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.CSINodeList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1/csistoragecapacities/resource.generated.go b/pkg/clients/kube/storagev1/csistoragecapacities/resource.generated.go index 5725588434..8f5bea36e4 100644 --- a/pkg/clients/kube/storagev1/csistoragecapacities/resource.generated.go +++ b/pkg/clients/kube/storagev1/csistoragecapacities/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1 "k8s.io/api/storage/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.CSIStorageCapacityApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.CSIStorageCapacityList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.CSIStorageCapacityApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.CSIStorageCapacityList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1/storageclasses/resource.generated.go b/pkg/clients/kube/storagev1/storageclasses/resource.generated.go index 17d765ac7a..bfb45623c3 100644 --- a/pkg/clients/kube/storagev1/storageclasses/resource.generated.go +++ b/pkg/clients/kube/storagev1/storageclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1 "k8s.io/api/storage/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.StorageClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.StorageClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.StorageClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.StorageClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.StorageClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1/volumeattachments/resource.generated.go b/pkg/clients/kube/storagev1/volumeattachments/resource.generated.go index 3133c1a39b..8ff7945e30 100644 --- a/pkg/clients/kube/storagev1/volumeattachments/resource.generated.go +++ b/pkg/clients/kube/storagev1/volumeattachments/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1 "k8s.io/api/storage/v1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.VolumeAttachmentList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storage_v1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1.VolumeAttachmentList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storage_v1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1alpha1/csistoragecapacities/resource.generated.go b/pkg/clients/kube/storagev1alpha1/csistoragecapacities/resource.generated.go index 5adae71582..75a6731519 100644 --- a/pkg/clients/kube/storagev1alpha1/csistoragecapacities/resource.generated.go +++ b/pkg/clients/kube/storagev1alpha1/csistoragecapacities/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1alpha1 "k8s.io/api/storage/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1alpha1.CSIStorageCapacityApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacityList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1alpha1.CSIStorageCapacityApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacityList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1alpha1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1alpha1/volumeattachments/resource.generated.go b/pkg/clients/kube/storagev1alpha1/volumeattachments/resource.generated.go index 71bf7b7b46..da42521f02 100644 --- a/pkg/clients/kube/storagev1alpha1/volumeattachments/resource.generated.go +++ b/pkg/clients/kube/storagev1alpha1/volumeattachments/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1alpha1 "k8s.io/api/storage/v1alpha1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1alpha1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1alpha1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachmentList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1alpha1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1alpha1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachmentList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storage_v1alpha1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1alpha1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1beta1/csidrivers/resource.generated.go b/pkg/clients/kube/storagev1beta1/csidrivers/resource.generated.go index fcd376285a..e6108e9ce9 100644 --- a/pkg/clients/kube/storagev1beta1/csidrivers/resource.generated.go +++ b/pkg/clients/kube/storagev1beta1/csidrivers/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1beta1 "k8s.io/api/storage/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.CSIDriverApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.CSIDriverList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.CSIDriverApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.CSIDriverList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIDriver, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.CSIDriver, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1beta1/csinodes/resource.generated.go b/pkg/clients/kube/storagev1beta1/csinodes/resource.generated.go index 8c4f4b4f98..4521e55b85 100644 --- a/pkg/clients/kube/storagev1beta1/csinodes/resource.generated.go +++ b/pkg/clients/kube/storagev1beta1/csinodes/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1beta1 "k8s.io/api/storage/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.CSINodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.CSINodeList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.CSINode, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.CSINodeApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.CSINodeList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSINode, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.CSINode, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1beta1/csistoragecapacities/resource.generated.go b/pkg/clients/kube/storagev1beta1/csistoragecapacities/resource.generated.go index ba109627cc..98b720c2ab 100644 --- a/pkg/clients/kube/storagev1beta1/csistoragecapacities/resource.generated.go +++ b/pkg/clients/kube/storagev1beta1/csistoragecapacities/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1beta1 "k8s.io/api/storage/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.CSIStorageCapacityApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacityList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.CSIStorageCapacityApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacityList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.CSIStorageCapacity, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.CSIStorageCapacity, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1beta1/storageclasses/resource.generated.go b/pkg/clients/kube/storagev1beta1/storageclasses/resource.generated.go index e30fe35d1d..c3e7bd7de9 100644 --- a/pkg/clients/kube/storagev1beta1/storageclasses/resource.generated.go +++ b/pkg/clients/kube/storagev1beta1/storageclasses/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1beta1 "k8s.io/api/storage/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -140,39 +141,39 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.StorageClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.StorageClassList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -183,137 +184,173 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.StorageClassApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.StorageClassList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.StorageClass, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.StorageClass, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kube/storagev1beta1/volumeattachments/resource.generated.go b/pkg/clients/kube/storagev1beta1/volumeattachments/resource.generated.go index a6d9621931..ba4a8d3688 100644 --- a/pkg/clients/kube/storagev1beta1/volumeattachments/resource.generated.go +++ b/pkg/clients/kube/storagev1beta1/volumeattachments/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_api_storage_v1beta1 "k8s.io/api/storage/v1beta1" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -162,47 +163,47 @@ type withMetrics struct { } func (c *withMetrics) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - defer c.recorder.Record("apply") + defer c.recorder.RecordWithContext(arg0, "apply") return c.inner.Apply(arg0, arg1, arg2) } func (c *withMetrics) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - defer c.recorder.Record("apply_status") + defer c.recorder.RecordWithContext(arg0, "apply_status") return c.inner.ApplyStatus(arg0, arg1, arg2) } func (c *withMetrics) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachmentList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -213,167 +214,211 @@ type withTracing struct { } func (c *withTracing) Apply(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Apply"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Apply"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Apply"), + ) + defer span.End() + } ret0, ret1 := c.inner.Apply(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) ApplyStatus(arg0 context.Context, arg1 *k8s_io_client_go_applyconfigurations_storage_v1beta1.VolumeAttachmentApplyConfiguration, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ApplyOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("ApplyStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "ApplyStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("ApplyStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.ApplyStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Create(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachmentList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *k8s_io_api_storage_v1beta1.VolumeAttachment, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*k8s_io_api_storage_v1beta1.VolumeAttachment, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1/clusterpolicies/resource.generated.go b/pkg/clients/kyverno/kyvernov1/clusterpolicies/resource.generated.go index 71b0a7b094..23a4174179 100644 --- a/pkg/clients/kyverno/kyvernov1/clusterpolicies/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1/clusterpolicies/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -139,39 +140,39 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -182,137 +183,173 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.ClusterPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1/generaterequests/resource.generated.go b/pkg/clients/kyverno/kyvernov1/generaterequests/resource.generated.go index d67e00e9a0..0d957c0cbc 100644 --- a/pkg/clients/kyverno/kyvernov1/generaterequests/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1/generaterequests/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -139,39 +140,39 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequestList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -182,137 +183,173 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequestList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.GenerateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1/policies/resource.generated.go b/pkg/clients/kyverno/kyvernov1/policies/resource.generated.go index 32351ec864..c938ff6561 100644 --- a/pkg/clients/kyverno/kyvernov1/policies/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1/policies/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -139,39 +140,39 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.PolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -182,137 +183,173 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.PolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1.Policy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1.Policy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1alpha2/admissionreports/resource.generated.go b/pkg/clients/kyverno/kyvernov1alpha2/admissionreports/resource.generated.go index e56ae47ba1..67602c5dd3 100644 --- a/pkg/clients/kyverno/kyvernov1alpha2/admissionreports/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1alpha2/admissionreports/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -128,35 +129,35 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReportList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -167,122 +168,154 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReportList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.AdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1alpha2/backgroundscanreports/resource.generated.go b/pkg/clients/kyverno/kyvernov1alpha2/backgroundscanreports/resource.generated.go index e27a475b6c..09d92517e3 100644 --- a/pkg/clients/kyverno/kyvernov1alpha2/backgroundscanreports/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1alpha2/backgroundscanreports/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -128,35 +129,35 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReportList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -167,122 +168,154 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReportList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.BackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1alpha2/clusteradmissionreports/resource.generated.go b/pkg/clients/kyverno/kyvernov1alpha2/clusteradmissionreports/resource.generated.go index 4d8121ede8..f823a3187d 100644 --- a/pkg/clients/kyverno/kyvernov1alpha2/clusteradmissionreports/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1alpha2/clusteradmissionreports/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -128,35 +129,35 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReportList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -167,122 +168,154 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReportList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterAdmissionReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1alpha2/clusterbackgroundscanreports/resource.generated.go b/pkg/clients/kyverno/kyvernov1alpha2/clusterbackgroundscanreports/resource.generated.go index a82c0f6ea5..966acf166d 100644 --- a/pkg/clients/kyverno/kyvernov1alpha2/clusterbackgroundscanreports/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1alpha2/clusterbackgroundscanreports/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1alpha2" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -128,35 +129,35 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReportList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -167,122 +168,154 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReportList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1alpha2.ClusterBackgroundScanReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov1beta1/updaterequests/resource.generated.go b/pkg/clients/kyverno/kyvernov1beta1/updaterequests/resource.generated.go index 7b53f557c0..1ebb2bb10f 100644 --- a/pkg/clients/kyverno/kyvernov1beta1/updaterequests/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov1beta1/updaterequests/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v1beta1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v1beta1" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -139,39 +140,39 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequestList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -182,137 +183,173 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequestList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v1beta1.UpdateRequest, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov2alpha1/cleanuppolicies/resource.generated.go b/pkg/clients/kyverno/kyvernov2alpha1/cleanuppolicies/resource.generated.go index 884e67ceef..7ebbf5610d 100644 --- a/pkg/clients/kyverno/kyvernov2alpha1/cleanuppolicies/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov2alpha1/cleanuppolicies/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -139,39 +140,39 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -182,137 +183,173 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.CleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/kyvernov2alpha1/clustercleanuppolicies/resource.generated.go b/pkg/clients/kyverno/kyvernov2alpha1/clustercleanuppolicies/resource.generated.go index 7489b2609a..c0b6253e96 100644 --- a/pkg/clients/kyverno/kyvernov2alpha1/clustercleanuppolicies/resource.generated.go +++ b/pkg/clients/kyverno/kyvernov2alpha1/clustercleanuppolicies/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_kyverno_v2alpha1 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/kyverno/v2alpha1" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -139,39 +140,39 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicyList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - defer c.recorder.Record("update_status") + defer c.recorder.RecordWithContext(arg0, "update_status") return c.inner.UpdateStatus(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -182,137 +183,173 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicyList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) UpdateStatus(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_kyverno_v2alpha1.ClusterCleanupPolicy, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("UpdateStatus"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "UpdateStatus"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("UpdateStatus"), + ) + defer span.End() + } ret0, ret1 := c.inner.UpdateStatus(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/wgpolicyk8sv1alpha2/clusterpolicyreports/resource.generated.go b/pkg/clients/kyverno/wgpolicyk8sv1alpha2/clusterpolicyreports/resource.generated.go index f6dbd91046..69f1c26203 100644 --- a/pkg/clients/kyverno/wgpolicyk8sv1alpha2/clusterpolicyreports/resource.generated.go +++ b/pkg/clients/kyverno/wgpolicyk8sv1alpha2/clusterpolicyreports/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -128,35 +129,35 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReportList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -167,122 +168,154 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReportList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.ClusterPolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/kyverno/wgpolicyk8sv1alpha2/policyreports/resource.generated.go b/pkg/clients/kyverno/wgpolicyk8sv1alpha2/policyreports/resource.generated.go index 2cef7590c0..8fe65f9e33 100644 --- a/pkg/clients/kyverno/wgpolicyk8sv1alpha2/policyreports/resource.generated.go +++ b/pkg/clients/kyverno/wgpolicyk8sv1alpha2/policyreports/resource.generated.go @@ -10,6 +10,7 @@ import ( github_com_kyverno_kyverno_pkg_client_clientset_versioned_typed_policyreport_v1alpha2 "github.com/kyverno/kyverno/pkg/client/clientset/versioned/typed/policyreport/v1alpha2" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -128,35 +129,35 @@ type withMetrics struct { } func (c *withMetrics) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - defer c.recorder.Record("create") + defer c.recorder.RecordWithContext(arg0, "create") return c.inner.Create(arg0, arg1, arg2) } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReportList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - defer c.recorder.Record("update") + defer c.recorder.RecordWithContext(arg0, "update") return c.inner.Update(arg0, arg1, arg2) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -167,122 +168,154 @@ type withTracing struct { } func (c *withTracing) Create(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.CreateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Create"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Create"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Create"), + ) + defer span.End() + } ret0, ret1 := c.inner.Create(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReportList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Update(arg0 context.Context, arg1 *github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.UpdateOptions) (*github_com_kyverno_kyverno_api_policyreport_v1alpha2.PolicyReport, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Update"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Update"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Update"), + ) + defer span.End() + } ret0, ret1 := c.inner.Update(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/clients/metadata/resource/resource.generated.go b/pkg/clients/metadata/resource/resource.generated.go index ffd8c3a69d..c416d30c8b 100644 --- a/pkg/clients/metadata/resource/resource.generated.go +++ b/pkg/clients/metadata/resource/resource.generated.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" "github.com/kyverno/kyverno/pkg/metrics" "github.com/kyverno/kyverno/pkg/tracing" + "go.opentelemetry.io/otel/trace" "go.uber.org/multierr" k8s_io_apimachinery_pkg_apis_meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" k8s_io_apimachinery_pkg_types "k8s.io/apimachinery/pkg/types" @@ -105,27 +106,27 @@ type withMetrics struct { } func (c *withMetrics) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg3 ...string) error { - defer c.recorder.Record("delete") + defer c.recorder.RecordWithContext(arg0, "delete") return c.inner.Delete(arg0, arg1, arg2, arg3...) } func (c *withMetrics) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - defer c.recorder.Record("delete_collection") + defer c.recorder.RecordWithContext(arg0, "delete_collection") return c.inner.DeleteCollection(arg0, arg1, arg2) } func (c *withMetrics) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata, error) { - defer c.recorder.Record("get") + defer c.recorder.RecordWithContext(arg0, "get") return c.inner.Get(arg0, arg1, arg2, arg3...) } func (c *withMetrics) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadataList, error) { - defer c.recorder.Record("list") + defer c.recorder.RecordWithContext(arg0, "list") return c.inner.List(arg0, arg1) } func (c *withMetrics) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata, error) { - defer c.recorder.Record("patch") + defer c.recorder.RecordWithContext(arg0, "patch") return c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) } func (c *withMetrics) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - defer c.recorder.Record("watch") + defer c.recorder.RecordWithContext(arg0, "watch") return c.inner.Watch(arg0, arg1) } @@ -136,92 +137,116 @@ type withTracing struct { } func (c *withTracing) Delete(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg3 ...string) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Delete"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Delete"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Delete"), + ) + defer span.End() + } ret0 := c.inner.Delete(arg0, arg1, arg2, arg3...) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) DeleteCollection(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.DeleteOptions, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) error { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("DeleteCollection"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "DeleteCollection"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("DeleteCollection"), + ) + defer span.End() + } ret0 := c.inner.DeleteCollection(arg0, arg1, arg2) - tracing.SetSpanStatus(span, ret0) + if span != nil { + tracing.SetSpanStatus(span, ret0) + } return ret0 } func (c *withTracing) Get(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_apis_meta_v1.GetOptions, arg3 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Get"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Get"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Get"), + ) + defer span.End() + } ret0, ret1 := c.inner.Get(arg0, arg1, arg2, arg3...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) List(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (*k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadataList, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("List"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "List"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("List"), + ) + defer span.End() + } ret0, ret1 := c.inner.List(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Patch(arg0 context.Context, arg1 string, arg2 k8s_io_apimachinery_pkg_types.PatchType, arg3 []uint8, arg4 k8s_io_apimachinery_pkg_apis_meta_v1.PatchOptions, arg5 ...string) (*k8s_io_apimachinery_pkg_apis_meta_v1.PartialObjectMetadata, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Patch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Patch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Patch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Patch(arg0, arg1, arg2, arg3, arg4, arg5...) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } func (c *withTracing) Watch(arg0 context.Context, arg1 k8s_io_apimachinery_pkg_apis_meta_v1.ListOptions) (k8s_io_apimachinery_pkg_watch.Interface, error) { - ctx, span := tracing.StartSpan( - arg0, - "", - fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), - tracing.KubeClientGroupKey.String(c.client), - tracing.KubeClientKindKey.String(c.kind), - tracing.KubeClientOperationKey.String("Watch"), - ) - defer span.End() - arg0 = ctx + var span trace.Span + if tracing.IsInSpan(arg0) { + arg0, span = tracing.StartSpan( + arg0, + "", + fmt.Sprintf("KUBE %s/%s/%s", c.client, c.kind, "Watch"), + tracing.KubeClientGroupKey.String(c.client), + tracing.KubeClientKindKey.String(c.kind), + tracing.KubeClientOperationKey.String("Watch"), + ) + defer span.End() + } ret0, ret1 := c.inner.Watch(arg0, arg1) - tracing.SetSpanStatus(span, ret1) + if span != nil { + tracing.SetSpanStatus(span, ret1) + } return ret0, ret1 } diff --git a/pkg/cosign/cosign.go b/pkg/cosign/cosign.go index 540ec7f657..cde692ba86 100644 --- a/pkg/cosign/cosign.go +++ b/pkg/cosign/cosign.go @@ -123,7 +123,7 @@ func buildCosignOptions(rclient registryclient.Client, opts Options) (*cosign.Ch if err != nil { return nil, errors.Wrap(err, "constructing client options") } - remoteOpts = append(remoteOpts, rclient.BuildRemoteOption()) + remoteOpts = append(remoteOpts, rclient.BuildRemoteOption(context.TODO())) cosignOpts := &cosign.CheckOpts{ Annotations: map[string]interface{}{}, RegistryClientOpts: remoteOpts, diff --git a/pkg/metrics/client.go b/pkg/metrics/client.go index 531e4fc43e..e4434ffb6c 100644 --- a/pkg/metrics/client.go +++ b/pkg/metrics/client.go @@ -3,7 +3,8 @@ package metrics import "context" type Recorder interface { - Record(clientQueryOperation ClientQueryOperation) + Record(ClientQueryOperation) + RecordWithContext(context.Context, ClientQueryOperation) } type clientQueryRecorder struct { diff --git a/pkg/registryclient/client.go b/pkg/registryclient/client.go index 41464d89a8..a7ebdfb83a 100644 --- a/pkg/registryclient/client.go +++ b/pkg/registryclient/client.go @@ -5,7 +5,9 @@ import ( "crypto/tls" "fmt" "io" + "net" "net/http" + "time" ecr "github.com/awslabs/amazon-ecr-credential-helper/ecr-login" "github.com/chrismellard/docker-credential-acr-env/pkg/credhelper" @@ -14,16 +16,35 @@ import ( "github.com/google/go-containerregistry/pkg/name" "github.com/google/go-containerregistry/pkg/v1/google" gcrremote "github.com/google/go-containerregistry/pkg/v1/remote" + "github.com/kyverno/kyverno/pkg/tracing" "github.com/sigstore/cosign/pkg/oci/remote" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" corev1listers "k8s.io/client-go/listers/core/v1" ) -var baseKeychain = authn.NewMultiKeychain( - authn.DefaultKeychain, - google.Keychain, - authn.NewKeychainFromHelper(ecr.NewECRHelper(ecr.WithLogger(io.Discard))), - authn.NewKeychainFromHelper(credhelper.NewACRCredentialsHelper()), - github.Keychain, +var ( + baseKeychain = authn.NewMultiKeychain( + authn.DefaultKeychain, + google.Keychain, + authn.NewKeychainFromHelper(ecr.NewECRHelper(ecr.WithLogger(io.Discard))), + authn.NewKeychainFromHelper(credhelper.NewACRCredentialsHelper()), + github.Keychain, + ) + defaultTransport = &http.Transport{ + Proxy: http.ProxyFromEnvironment, + DialContext: (&net.Dialer{ + // By default we wrap the transport in retries, so reduce the + // default dial timeout to 5s to avoid 5x 30s of connection + // timeouts when doing the "ping" on certain http registries. + Timeout: 5 * time.Second, + KeepAlive: 30 * time.Second, + }).DialContext, + ForceAttemptHTTP2: true, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } ) // Client provides registry related objects. @@ -39,29 +60,44 @@ type Client interface { FetchImageDescriptor(context.Context, string) (*gcrremote.Descriptor, error) // BuildRemoteOption builds remote.Option based on client. - BuildRemoteOption() remote.Option + BuildRemoteOption(context.Context) remote.Option } type client struct { keychain authn.Keychain - transport *http.Transport + transport http.RoundTripper pullSecretRefresher func(context.Context, *client) error } +type config struct { + keychain authn.Keychain + transport *http.Transport + pullSecretRefresher func(context.Context, *client) error + tracing bool +} + // Option is an option to initialize registry client. -type Option = func(*client) error +type Option = func(*config) error // New creates a new Client with options func New(options ...Option) (Client, error) { - c := &client{ + cfg := &config{ keychain: baseKeychain, - transport: gcrremote.DefaultTransport.(*http.Transport), + transport: defaultTransport, } for _, opt := range options { - if err := opt(c); err != nil { + if err := opt(cfg); err != nil { return nil, err } } + c := &client{ + keychain: cfg.keychain, + transport: cfg.transport, + pullSecretRefresher: cfg.pullSecretRefresher, + } + if cfg.tracing { + c.transport = tracing.Transport(cfg.transport, otelhttp.WithFilter(tracing.RequestFilterIsInSpan)) + } return c, nil } @@ -76,7 +112,7 @@ func NewOrDie(options ...Option) Client { // WithKeychainPullSecrets provides initialize registry client option that allows to use pull secrets. func WithKeychainPullSecrets(ctx context.Context, lister corev1listers.SecretNamespaceLister, imagePullSecrets ...string) Option { - return func(c *client) error { + return func(c *config) error { c.pullSecretRefresher = func(ctx context.Context, c *client) error { freshKeychain, err := generateKeychainForPullSecrets(ctx, lister, imagePullSecrets...) if err != nil { @@ -94,7 +130,7 @@ func WithKeychainPullSecrets(ctx context.Context, lister corev1listers.SecretNam // WithKeychainPullSecrets provides initialize registry client option that allows to use insecure registries. func WithAllowInsecureRegistry() Option { - return func(c *client) error { + return func(c *config) error { c.transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //nolint:gosec return nil } @@ -102,27 +138,27 @@ func WithAllowInsecureRegistry() Option { // WithLocalKeychain provides initialize keychain with the default local keychain. func WithLocalKeychain() Option { - return func(c *client) error { + return func(c *config) error { c.pullSecretRefresher = nil c.keychain = authn.DefaultKeychain return nil } } -// refreshKeychainPullSecrets loads fresh data from pull secrets and updates Keychain. -// If pull secrets are empty - returns. -func (c *client) refreshKeychainPullSecrets(ctx context.Context) error { - if c.pullSecretRefresher == nil { +// WithTracing enables tracing in the http client. +func WithTracing() Option { + return func(c *config) error { + c.tracing = true return nil } - return c.pullSecretRefresher(ctx, c) } // BuildRemoteOption builds remote.Option based on client. -func (c *client) BuildRemoteOption() remote.Option { +func (c *client) BuildRemoteOption(ctx context.Context) remote.Option { return remote.WithRemoteOptions( gcrremote.WithAuthFromKeychain(c.keychain), gcrremote.WithTransport(c.transport), + gcrremote.WithContext(ctx), ) } @@ -143,6 +179,15 @@ func (c *client) FetchImageDescriptor(ctx context.Context, imageRef string) (*gc return desc, nil } +// refreshKeychainPullSecrets loads fresh data from pull secrets and updates Keychain. +// If pull secrets are empty - returns. +func (c *client) refreshKeychainPullSecrets(ctx context.Context) error { + if c.pullSecretRefresher == nil { + return nil + } + return c.pullSecretRefresher(ctx, c) +} + func (c *client) getKeychain() authn.Keychain { return c.keychain } diff --git a/pkg/registryclient/client_test.go b/pkg/registryclient/client_test.go index 2b816277a3..3d5befbf74 100644 --- a/pkg/registryclient/client_test.go +++ b/pkg/registryclient/client_test.go @@ -5,7 +5,6 @@ import ( "net/http" "testing" - "github.com/google/go-containerregistry/pkg/v1/remote" "gotest.tools/assert" ) @@ -13,12 +12,9 @@ import ( var _ Client = &client{} func TestInitClientWithEmptyOptions(t *testing.T) { - expClient := &client{ - transport: remote.DefaultTransport.(*http.Transport), - } c, err := New() assert.NilError(t, err) - assert.Assert(t, expClient.transport == c.getTransport()) + assert.Assert(t, defaultTransport == c.getTransport()) assert.Assert(t, c.getKeychain() != nil) } @@ -27,10 +23,8 @@ func TestInitClientWithInsecureRegistryOption(t *testing.T) { transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}, } c, err := New(WithAllowInsecureRegistry()) - - expInsecureSkipVerify := expClient.transport.TLSClientConfig.InsecureSkipVerify + expInsecureSkipVerify := expClient.transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify gotInsecureSkipVerify := c.getTransport().(*http.Transport).TLSClientConfig.InsecureSkipVerify - assert.NilError(t, err) assert.Assert(t, expInsecureSkipVerify == gotInsecureSkipVerify) assert.Assert(t, c.getKeychain() != nil) diff --git a/pkg/tracing/http.go b/pkg/tracing/http.go new file mode 100644 index 0000000000..d318197771 --- /dev/null +++ b/pkg/tracing/http.go @@ -0,0 +1,24 @@ +package tracing + +import ( + "fmt" + "net/http" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" +) + +var defaultSpanFormatter = otelhttp.WithSpanNameFormatter( + func(_ string, request *http.Request) string { + return fmt.Sprintf("HTTP %s %s", request.Method, request.URL.Path) + }, +) + +func RequestFilterIsInSpan(request *http.Request) bool { + return IsInSpan(request.Context()) +} + +func Transport(base http.RoundTripper, opts ...otelhttp.Option) *otelhttp.Transport { + o := []otelhttp.Option{defaultSpanFormatter} + o = append(o, opts...) + return otelhttp.NewTransport(base, o...) +} diff --git a/pkg/tracing/tracing.go b/pkg/tracing/tracing.go index 1d4d2f9919..7cfaa82b60 100644 --- a/pkg/tracing/tracing.go +++ b/pkg/tracing/tracing.go @@ -189,3 +189,8 @@ func SetHttpStatus(ctx context.Context, err error, code int) { span.SetStatus(codes.Ok, http.StatusText(code)) } } + +func IsInSpan(ctx context.Context) bool { + span := trace.SpanFromContext(ctx) + return span.IsRecording() +}