diff --git a/bootstrap/kubeadm/main.go b/bootstrap/kubeadm/main.go index 8d7e296747ba..223f045c28d4 100644 --- a/bootstrap/kubeadm/main.go +++ b/bootstrap/kubeadm/main.go @@ -179,7 +179,7 @@ func main() { }() } - tp := traceutil.TraceProvider(tracingEndpoint, tracingSamplingRatePerMillion, "capi-controller-manager") + tp := traceutil.TraceProvider(tracingEndpoint, tracingSamplingRatePerMillion, "capi-kubeadm-bootstrap-controller-manager") restConfig := ctrl.GetConfigOrDie() restConfig.UserAgent = remote.DefaultClusterAPIUserAgent("cluster-api-kubeadm-bootstrap-manager") diff --git a/controlplane/kubeadm/main.go b/controlplane/kubeadm/main.go index eaa4219e6227..96a832fc755a 100644 --- a/controlplane/kubeadm/main.go +++ b/controlplane/kubeadm/main.go @@ -182,7 +182,7 @@ func main() { }() } - tp := traceutil.TraceProvider(tracingEndpoint, tracingSamplingRatePerMillion, "capd-controller-manager") + tp := traceutil.TraceProvider(tracingEndpoint, tracingSamplingRatePerMillion, "capi-kubeadm-control-plane-controller-manager") restConfig := ctrl.GetConfigOrDie() restConfig.UserAgent = remote.DefaultClusterAPIUserAgent("cluster-api-kubeadm-control-plane-manager") diff --git a/internal/controllers/cluster/cluster_controller_phases.go b/internal/controllers/cluster/cluster_controller_phases.go index 440c28e7b622..b85ecd2f6cc0 100644 --- a/internal/controllers/cluster/cluster_controller_phases.go +++ b/internal/controllers/cluster/cluster_controller_phases.go @@ -263,6 +263,8 @@ func (r *Reconciler) reconcileKubeconfig(ctx context.Context, cluster *clusterv1 ctx, span := r.Tracer.Start(ctx, "controllers.ClusterReconciler.reconcileKubeconfig") defer span.End() log := ctrl.LoggerFrom(ctx) + //log = log.WithValues("spanID", span.SpanContext().SpanID().String()) + //ctx = ctrl.LoggerInto(ctx, log) if !cluster.Spec.ControlPlaneEndpoint.IsValid() { return ctrl.Result{}, nil diff --git a/util/trace/trace.go b/util/trace/trace.go index 2aa87e72e521..ac2b529be02c 100644 --- a/util/trace/trace.go +++ b/util/trace/trace.go @@ -50,10 +50,16 @@ func (r *traceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ct log = log.WithValues("traceID", span.SpanContext().TraceID().String()) ctx = ctrl.LoggerInto(ctx, log) + log.Info("Reconciliation started") + res, err := r.Reconciler.Reconcile(ctx, req) if err != nil { - log.Error(err, "Error in reconcile") + log.Error(err, "Reconciliation finished with error") + span.SetAttributes(attribute.String("error", "true")) // FIXME: + } else { + log.Info("Reconciliation finished") } + return res, err }