-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cache: add tracing to prune #5627
base: master
Are you sure you want to change the base?
Conversation
603be55
to
9f8eaf2
Compare
Adds tracing to the cache manager prune operation. The attribute will show both explicit prunes from a user and background prunes initiated after solve requests are processed. Signed-off-by: Jonathan A. Sternberg <[email protected]>
9f8eaf2
to
573d6cb
Compare
// | ||
// This function isn't meant to be called in a tight loop. It is intended to be | ||
// called on initialization and the tracer is supposed to be retained for future use. | ||
func Tracer(tp trace.TracerProvider, options ...trace.TracerOption) trace.Tracer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be called TracerForCurrentFrame
or smth like that
@@ -1009,6 +1026,9 @@ func (cm *cacheManager) createDiffRef(ctx context.Context, parents parentRefs, d | |||
} | |||
|
|||
func (cm *cacheManager) Prune(ctx context.Context, ch chan client.UsageInfo, opts ...client.PruneInfo) error { | |||
ctx, span := cm.tracer.Start(ctx, "(*cacheManager).Prune") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prunes coming from background GC should have a root span based on the GC function, not for individual prune calls for each rule. (Can even trace the reason for starting the GC).
For Prunes coming through grpc they should trace to the tracing context already in ctx
.
So afaics these should use the tracing.StartSpan(ctx)
like the rest of the tracers and control.gc()
should have a way to inject root span to ctx
before it calls into cm.Prune()
.
Adds tracing to the cache manager prune operation. The attribute will show both explicit prunes from a user and background prunes initiated after solve requests are processed.
The prune code has also been refactored a bit to remove a recursive call to prune. It has now been unrolled and the functions have been renamed so
prune
stands for the entire prune process andpruneOnce
is a single cycle. Previously,prune
was a single cycle andpruneOnce
would run the entire prune cycle with a set of options.This also disabled the delve component of the
hack/compose
script. It appears to be broken at the moment.