Skip to content

Commit

Permalink
Add logInfo at every RPC entry to mark code execution at this line
Browse files Browse the repository at this point in the history
Signed-off-by: Yifan Yuan <tuji.yyf@alibaba-inc.com>
  • Loading branch information
BigVan committed Nov 3, 2023
1 parent 23d0300 commit d970659
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions pkg/snapshot/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func NewSnapshotter(bootConfig *BootConfig, opts ...Opt) (snapshots.Snapshotter,

// Stat returns the info for an active or committed snapshot by the key.
func (o *snapshotter) Stat(ctx context.Context, key string) (_ snapshots.Info, retErr error) {
log.G(ctx).Debugf("Stat (key: %s)", key)
log.G(ctx).Infof("Stat (key: %s)", key)
start := time.Now()
defer func() {
if retErr != nil {
Expand All @@ -232,7 +232,7 @@ func (o *snapshotter) Stat(ctx context.Context, key string) (_ snapshots.Info, r
//
// TODO(fuweid): should not touch the interface-like or internal label!
func (o *snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (_ snapshots.Info, retErr error) {
log.G(ctx).Debugf("Update (fieldpaths: %s)", fieldpaths)
log.G(ctx).Infof("Update (fieldpaths: %s)", fieldpaths)
start := time.Now()
defer func() {
if retErr != nil {
Expand Down Expand Up @@ -260,7 +260,7 @@ func (o *snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpath

// Usage returns the resources taken by the snapshot identified by key.
func (o *snapshotter) Usage(ctx context.Context, key string) (_ snapshots.Usage, retErr error) {
log.G(ctx).Debugf("Usage (key: %s)", key)
log.G(ctx).Infof("Usage (key: %s)", key)
start := time.Now()
defer func() {
if retErr != nil {
Expand Down Expand Up @@ -573,7 +573,7 @@ func (o *snapshotter) createMountPoint(ctx context.Context, kind snapshots.Kind,

// Prepare creates an active snapshot identified by key descending from the provided parent.
func (o *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) (_ []mount.Mount, retErr error) {
log.G(ctx).Debugf("Prepare (key: %s, parent: %s)", key, parent)
log.G(ctx).Infof("Prepare (key: %s, parent: %s)", key, parent)
start := time.Now()
defer func() {
if retErr != nil {
Expand All @@ -586,7 +586,7 @@ func (o *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...s

// View returns a readonly view on parent snapshotter.
func (o *snapshotter) View(ctx context.Context, key, parent string, opts ...snapshots.Opt) (_ []mount.Mount, retErr error) {
log.G(ctx).Debugf("View (key: %s, parent: %s)", key, parent)
log.G(ctx).Infof("View (key: %s, parent: %s)", key, parent)
defer log.G(ctx).Debugf("return View (key: %s, parent: %s)", key, parent)
start := time.Now()
defer func() {
Expand All @@ -603,6 +603,8 @@ func (o *snapshotter) View(ctx context.Context, key, parent string, opts ...snap
//
// This can be used to recover mounts after calling View or Prepare.
func (o *snapshotter) Mounts(ctx context.Context, key string) (_ []mount.Mount, retErr error) {
log.G(ctx).Infof("Mounts (key: %s)", key)

start := time.Now()
defer func() {
if retErr != nil {
Expand Down Expand Up @@ -667,7 +669,7 @@ func (o *snapshotter) Mounts(ctx context.Context, key string) (_ []mount.Mount,

// Commit
func (o *snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) (retErr error) {
log.G(ctx).Debugf("Commit (key: %s, name: %s)", key, name)
log.G(ctx).Infof("Commit (key: %s, name: %s)", key, name)
start := time.Now()
defer func() {
if retErr != nil {
Expand Down Expand Up @@ -773,7 +775,7 @@ func (o *snapshotter) commit(ctx context.Context, name, key string, opts ...snap
// Remove abandons the snapshot identified by key. The snapshot will
// immediately become unavailable and unrecoverable.
func (o *snapshotter) Remove(ctx context.Context, key string) (err error) {
log.G(ctx).Debugf("Remove (key: %s)", key)
log.G(ctx).Infof("Remove (key: %s)", key)
start := time.Now()
defer func() {
if err != nil {
Expand Down Expand Up @@ -851,7 +853,7 @@ func (o *snapshotter) Remove(ctx context.Context, key string) (err error) {

// Walk the snapshots.
func (o *snapshotter) Walk(ctx context.Context, fn snapshots.WalkFunc, fs ...string) (err error) {
log.G(ctx).Debugf("Walk (fs: %s)", fs)
log.G(ctx).Infof("Walk (fs: %s)", fs)
start := time.Now()
defer func() {
if err != nil {
Expand Down

0 comments on commit d970659

Please sign in to comment.