Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/controller/clustersync/clustersync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,16 +924,17 @@ func applyToTargetCluster(
return err
}

logger.WithField("uid", obj.GetUID()).WithField("resource_version", obj.GetResourceVersion()).Info("attempting to apply resource")
applyResult, err := applyFn(bytes)
// Record the amount of time we took to apply this specific resource. When combined with the metric for duration of
// our kube client requests, we can get an idea how much time we're spending cpu bound vs network bound.
applyTime := metav1.Now().Sub(startTime).Seconds()
if err != nil {
logger.WithError(err).Warn("error applying resource")
logger.WithError(err).WithField("uid", obj.GetUID()).WithField("resource_version", obj.GetResourceVersion()).WithField("applyTime", applyTime).Warn("error applying resource")
metricResourcesApplied.WithLabelValues(applyFnMetricLabel, metricResultError).Inc()
metricTimeToApplySyncSetResource.WithLabelValues(applyFnMetricLabel, metricResultError).Observe(applyTime)
} else {
logger.WithField("applyResult", applyResult).Debug("resource applied")
logger.WithField("applyResult", applyResult).WithField("uid", obj.GetUID()).WithField("resource_version", obj.GetResourceVersion()).WithField("applyTime", applyTime).Info("resource applied")
metricResourcesApplied.WithLabelValues(applyFnMetricLabel, metricResultSuccess).Inc()
metricTimeToApplySyncSetResource.WithLabelValues(applyFnMetricLabel, metricResultSuccess).Observe(applyTime)
}
Expand Down