forked from robfig/cron
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or requestobservabilityMetrics and monitoringMetrics and monitoringv2.0Scheduled for v2.0 release (breaking changes)Scheduled for v2.0 release (breaking changes)
Description
Description
Observability hooks don't receive a context, making it difficult for hook implementations to:
- Respect shutdown signals
- Implement timeouts
- Pass tracing context
Location
observability.go:ObservabilityHooksstruct
Current Signatures
OnSchedule func(id EntryID, job Job, scheduledTime time.Time)
OnJobStart func(id EntryID, job Job, scheduledTime time.Time)
OnJobComplete func(id EntryID, job Job, scheduledTime time.Time, duration time.Duration, panicValue any)Proposed Signatures
OnSchedule func(ctx context.Context, id EntryID, job Job, scheduledTime time.Time)
OnJobStart func(ctx context.Context, id EntryID, job Job, scheduledTime time.Time)
OnJobComplete func(ctx context.Context, id EntryID, job Job, scheduledTime time.Time, duration time.Duration, panicValue any)Benefits
- Hooks can respect scheduler shutdown
- Hooks can propagate tracing context
- Hooks can implement proper timeouts
- Consistent with Go context patterns
Severity
🟡 Medium - API improvement for better observability integration
Breaking Change
Found By
Pre-1.0 release code review with Zen/Gemini
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestobservabilityMetrics and monitoringMetrics and monitoringv2.0Scheduled for v2.0 release (breaking changes)Scheduled for v2.0 release (breaking changes)