Observe claimed prepared executions

This commit is contained in:
2026-09-23 17:15:51 +00:00
parent 0e1ad784d1
commit 63bedf2a97
12 changed files with 279 additions and 11 deletions

View File

@@ -202,6 +202,21 @@ func FromContext(ctx context.Context) *Recorder {
return recorder
}
type claimSinkKey struct{}
// WithClaimSink lets the facade learn which invocation actually claimed a
// prepared handle, so it can emit the terminal event after public mapping.
func WithClaimSink(ctx context.Context, sink **Recorder) context.Context {
return context.WithValue(ctx, claimSinkKey{}, sink)
}
// RegisterClaim records an invocation after its prepared handle is claimed.
func RegisterClaim(ctx context.Context, recorder *Recorder) {
if sink, ok := ctx.Value(claimSinkKey{}).(**Recorder); ok && sink != nil {
*sink = recorder
}
}
type usageField struct {
value int
known, complete bool