@@ -693,16 +693,23 @@ func (c *Cacher) Watch(ctx context.Context, key string, opts storage.ListOptions
693
693
694
694
// Get implements storage.Interface.
695
695
func (c * Cacher ) Get (ctx context.Context , key string , opts storage.GetOptions , objPtr runtime.Object ) error {
696
+ ctx , span := tracing .Start (ctx , "cacher.Get" ,
697
+ attribute .String ("audit-id" , audit .GetAuditIDTruncated (ctx )),
698
+ attribute .String ("key" , key ),
699
+ attribute .String ("resource-version" , opts .ResourceVersion ))
700
+ defer span .End (500 * time .Millisecond )
696
701
if opts .ResourceVersion == "" {
697
702
// If resourceVersion is not specified, serve it from underlying
698
703
// storage (for backward compatibility).
704
+ span .AddEvent ("About to Get from underlying storage" )
699
705
return c .storage .Get (ctx , key , opts , objPtr )
700
706
}
701
707
702
708
if utilfeature .DefaultFeatureGate .Enabled (features .ResilientWatchCacheInitialization ) {
703
709
if ! c .ready .check () {
704
710
// If Cache is not initialized, delegate Get requests to storage
705
711
// as described in https://kep.k8s.io/4568
712
+ span .AddEvent ("About to Get from underlying storage - cache not initialized" )
706
713
return c .storage .Get (ctx , key , opts , objPtr )
707
714
}
708
715
}
@@ -722,6 +729,7 @@ func (c *Cacher) Get(ctx context.Context, key string, opts storage.GetOptions, o
722
729
if getRV == 0 && ! c .ready .check () {
723
730
// If Cacher is not yet initialized and we don't require any specific
724
731
// minimal resource version, simply forward the request to storage.
732
+ span .AddEvent ("About to Get from underlying storage - cache not initialized and no resourceVersion set" )
725
733
return c .storage .Get (ctx , key , opts , objPtr )
726
734
}
727
735
if err := c .ready .wait (ctx ); err != nil {
@@ -734,6 +742,7 @@ func (c *Cacher) Get(ctx context.Context, key string, opts storage.GetOptions, o
734
742
return err
735
743
}
736
744
745
+ span .AddEvent ("About to fetch object from cache" )
737
746
obj , exists , readResourceVersion , err := c .watchCache .WaitUntilFreshAndGet (ctx , getRV , key )
738
747
if err != nil {
739
748
return err
@@ -856,7 +865,7 @@ func (c *Cacher) GetList(ctx context.Context, key string, opts storage.ListOptio
856
865
}
857
866
}
858
867
859
- ctx , span := tracing .Start (ctx , "cacher list " ,
868
+ ctx , span := tracing .Start (ctx , "cacher.GetList " ,
860
869
attribute .String ("audit-id" , audit .GetAuditIDTruncated (ctx )),
861
870
attribute .Stringer ("type" , c .groupResource ))
862
871
defer span .End (500 * time .Millisecond )
0 commit comments