Skip to content

Commit

Permalink
Merge pull request #1924 from dlom/HIVE-2038-again-3
Browse files Browse the repository at this point in the history
Syncset Testing PR #3
  • Loading branch information
dlom authored Dec 3, 2022
2 parents cc8c40c + c4a3d4f commit 206ec60
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/controller/clustersync/clustersync_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,17 +924,16 @@ 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).WithField("uid", obj.GetUID()).WithField("resource_version", obj.GetResourceVersion()).WithField("applyTime", applyTime).Warn("error applying resource")
logger.WithError(err).Warn("error applying resource")
metricResourcesApplied.WithLabelValues(applyFnMetricLabel, metricResultError).Inc()
metricTimeToApplySyncSetResource.WithLabelValues(applyFnMetricLabel, metricResultError).Observe(applyTime)
} else {
logger.WithField("applyResult", applyResult).WithField("uid", obj.GetUID()).WithField("resource_version", obj.GetResourceVersion()).WithField("applyTime", applyTime).Info("resource applied")
logger.WithField("applyResult", applyResult).Debug("resource applied")
metricResourcesApplied.WithLabelValues(applyFnMetricLabel, metricResultSuccess).Inc()
metricTimeToApplySyncSetResource.WithLabelValues(applyFnMetricLabel, metricResultSuccess).Observe(applyTime)
}
Expand Down

0 comments on commit 206ec60

Please sign in to comment.