@@ -18,6 +18,7 @@ package etcd
18
18
19
19
import (
20
20
"fmt"
21
+ "reflect"
21
22
"time"
22
23
23
24
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
@@ -146,9 +147,9 @@ func (e *Etcd) List(ctx api.Context, label labels.Selector, field fields.Selecto
146
147
147
148
// ListPredicate returns a list of all the items matching m.
148
149
func (e * Etcd ) ListPredicate (ctx api.Context , m generic.Matcher ) (runtime.Object , error ) {
149
- trace := util .NewTrace ("List" )
150
- defer trace .LogIfLong (time .Second )
151
150
list := e .NewListFunc ()
151
+ trace := util .NewTrace ("List " + reflect .TypeOf (list ).String ())
152
+ defer trace .LogIfLong (600 * time .Millisecond )
152
153
if name , ok := m .MatchesSingle (); ok {
153
154
trace .Step ("About to read single object" )
154
155
key , err := e .KeyFunc (ctx , name )
@@ -201,7 +202,7 @@ func (e *Etcd) CreateWithName(ctx api.Context, name string, obj runtime.Object)
201
202
202
203
// Create inserts a new item according to the unique key from the object.
203
204
func (e * Etcd ) Create (ctx api.Context , obj runtime.Object ) (runtime.Object , error ) {
204
- trace := util .NewTrace ("Create" )
205
+ trace := util .NewTrace ("Create " + reflect . TypeOf ( obj ). String () )
205
206
defer trace .LogIfLong (time .Second )
206
207
if err := rest .BeforeCreate (e .CreateStrategy , ctx , obj ); err != nil {
207
208
return nil , err
@@ -268,7 +269,7 @@ func (e *Etcd) UpdateWithName(ctx api.Context, name string, obj runtime.Object)
268
269
// or an error. If the registry allows create-on-update, the create flow will be executed.
269
270
// A bool is returned along with the object and any errors, to indicate object creation.
270
271
func (e * Etcd ) Update (ctx api.Context , obj runtime.Object ) (runtime.Object , bool , error ) {
271
- trace := util .NewTrace ("Update" )
272
+ trace := util .NewTrace ("Update " + reflect . TypeOf ( obj ). String () )
272
273
defer trace .LogIfLong (time .Second )
273
274
name , err := e .ObjectNameFunc (obj )
274
275
if err != nil {
@@ -358,9 +359,9 @@ func (e *Etcd) Update(ctx api.Context, obj runtime.Object) (runtime.Object, bool
358
359
359
360
// Get retrieves the item from etcd.
360
361
func (e * Etcd ) Get (ctx api.Context , name string ) (runtime.Object , error ) {
361
- trace := util .NewTrace ("Get" )
362
- defer trace .LogIfLong (time .Second )
363
362
obj := e .NewFunc ()
363
+ trace := util .NewTrace ("Get " + reflect .TypeOf (obj ).String ())
364
+ defer trace .LogIfLong (time .Second )
364
365
key , err := e .KeyFunc (ctx , name )
365
366
if err != nil {
366
367
return nil , err
@@ -380,14 +381,14 @@ func (e *Etcd) Get(ctx api.Context, name string) (runtime.Object, error) {
380
381
381
382
// Delete removes the item from etcd.
382
383
func (e * Etcd ) Delete (ctx api.Context , name string , options * api.DeleteOptions ) (runtime.Object , error ) {
383
- trace := util .NewTrace ("Delete" )
384
- defer trace .LogIfLong (time .Second )
385
384
key , err := e .KeyFunc (ctx , name )
386
385
if err != nil {
387
386
return nil , err
388
387
}
389
388
390
389
obj := e .NewFunc ()
390
+ trace := util .NewTrace ("Delete " + reflect .TypeOf (obj ).String ())
391
+ defer trace .LogIfLong (time .Second )
391
392
trace .Step ("About to read object" )
392
393
if err := e .Helper .ExtractObj (key , obj , false ); err != nil {
393
394
return nil , etcderr .InterpretDeleteError (err , e .EndpointName , name )
0 commit comments