Improve tracing information by deleting traces from etcd cache and adding information to traces from generic registry.

This commit is contained in:
Filip Grzadkowski
2015-05-28 16:28:07 +02:00
parent 6ffe46a9e0
commit eb14b68a9c
2 changed files with 9 additions and 12 deletions

View File

@@ -228,19 +228,15 @@ type etcdCache interface {
}
func (h *EtcdHelper) getFromCache(index uint64) (runtime.Object, bool) {
trace := util.NewTrace("getFromCache")
defer trace.LogIfLong(200 * time.Microsecond)
startTime := time.Now()
defer func() {
cacheGetLatency.Observe(float64(time.Since(startTime) / time.Microsecond))
}()
obj, found := h.cache.Get(index)
trace.Step("Raw get done")
if found {
// We should not return the object itself to avoid poluting the cache if someone
// modifies returned values.
objCopy, err := api.Scheme.DeepCopy(obj)
trace.Step("Deep copied")
if err != nil {
glog.Errorf("Error during DeepCopy of cached object: %q", err)
return nil, false