Skip to content

Commit

Permalink
Add stacktrace to all important methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aadi-shopify committed Oct 10, 2024
1 parent 4ad6411 commit b06816a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/vt/topo/stats_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func (st *StatsConn) ListDir(ctx context.Context, dirPath string, full bool) ([]
res, err := st.conn.ListDir(ctx, dirPath, full)
if err != nil {
topoStatsConnErrors.Add(statsKey, int64(1))
stack := stackTrace()
log.Warningf("ListDir failed for cell %s, dirPath %s: %v\n%s", st.cell, dirPath, err, stack)
return res, err
}
return res, err
Expand All @@ -83,6 +85,8 @@ func (st *StatsConn) Create(ctx context.Context, filePath string, contents []byt
defer topoStatsConnTimings.Record(statsKey, startTime)
res, err := st.conn.Create(ctx, filePath, contents)
if err != nil {
stack := stackTrace()
log.Warningf("Create failed for cell %s, filePath %s: %v\n%s", st.cell, filePath, err, stack)
topoStatsConnErrors.Add(statsKey, int64(1))
return res, err
}
Expand All @@ -100,6 +104,8 @@ func (st *StatsConn) Update(ctx context.Context, filePath string, contents []byt
res, err := st.conn.Update(ctx, filePath, contents, version)
if err != nil {
topoStatsConnErrors.Add(statsKey, int64(1))
stack := stackTrace()
log.Warningf("Update failed for cell %s, filePath %s: %v\n%s", st.cell, filePath, err, stack)
return res, err
}
return res, err
Expand Down Expand Up @@ -146,6 +152,8 @@ func (st *StatsConn) List(ctx context.Context, filePathPrefix string) ([]KVInfo,
defer topoStatsConnTimings.Record(statsKey, startTime)
bytes, err := st.conn.List(ctx, filePathPrefix)
if err != nil {
stack := stackTrace()
log.Warningf("List failed for cell %s, filePathPrefix %s: %v\n%s", st.cell, filePathPrefix, err, stack)
topoStatsConnErrors.Add(statsKey, int64(1))
return bytes, err
}
Expand All @@ -163,6 +171,8 @@ func (st *StatsConn) Delete(ctx context.Context, filePath string, version Versio
err := st.conn.Delete(ctx, filePath, version)
if err != nil {
topoStatsConnErrors.Add(statsKey, int64(1))
stack := stackTrace()
log.Warningf("Delete failed for cell %s, filePath %s: %v\n%s", st.cell, filePath, err, stack)
return err
}
return err
Expand Down

0 comments on commit b06816a

Please sign in to comment.