feat(trace): new span and context to run in background

. #1000201519

Signed-off-by: slasher <shenjie1@oppo.com>
This commit is contained in:
slasher 2025-06-27 16:33:31 +08:00
parent 5cf9f2aa4c
commit cab906aff9
4 changed files with 6 additions and 0 deletions

View File

@ -169,6 +169,8 @@ func (h *Handler) Get(ctx context.Context, w io.Writer, location proto.Location,
}
}
_, ctx = trace.StartSpanFromContextWithTraceID(ctx, "", span.TraceID())
// data stream flow:
// client <--copy-- pipeline <--swap-- readBlob <--copy-- blobnode
//

View File

@ -109,6 +109,8 @@ func (h *Handler) Put(ctx context.Context,
ready <- struct{}{}
}
_, ctx = trace.StartSpanFromContextWithTraceID(ctx, "", span.TraceID())
encoder := h.encoder[selectedCodeMode]
tactic := selectedCodeMode.Tactic()
for _, blob := range location.Spread() {

View File

@ -88,6 +88,7 @@ func (c *cacher) GetDisk(ctx context.Context, args *proxy.CacheDiskArgs) (*clust
}
c.diskCache.Set(id, disk)
span, _ = trace.StartSpanFromContextWithTraceID(context.Background(), "diskkv", span.TraceID())
go func() {
key := diskvKeyDisk(id)
fullPath := c.DiskvFilename(key)

View File

@ -95,6 +95,7 @@ func (c *cacher) GetVolume(ctx context.Context, args *proxy.CacheVolumeArgs) (*p
}
c.volumeCache.Set(vid, vol)
span, _ = trace.StartSpanFromContextWithTraceID(context.Background(), "diskkv", span.TraceID())
go func() {
key := diskvKeyVolume(vid)
fullPath := c.DiskvFilename(key)