mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
SyncPod record error and set error status to span when return err is not nil
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
This commit is contained in:
parent
a70089ab99
commit
588b72a942
@ -36,6 +36,7 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/opencontainers/selinux/go-selinux"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"k8s.io/client-go/informers"
|
||||
@ -1734,6 +1735,10 @@ func (kl *Kubelet) SyncPod(ctx context.Context, updateType kubetypes.SyncPodType
|
||||
))
|
||||
klog.V(4).InfoS("SyncPod enter", "pod", klog.KObj(pod), "podUID", pod.UID)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
otelSpan.RecordError(err)
|
||||
otelSpan.SetStatus(codes.Error, err.Error())
|
||||
}
|
||||
klog.V(4).InfoS("SyncPod exit", "pod", klog.KObj(pod), "podUID", pod.UID, "isTerminal", isTerminal)
|
||||
otelSpan.End()
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user