🧩 Context
Currently, when Supercronic reports errors to Sentry using the -sentry-dsn flag, the job’s stdout and stderr outputs are not included in the Sentry events.
This makes it harder to diagnose job failures due to missing runtime context.
💡 Proposal
Introduce a new optional flag:
When enabled, Supercronic will attach the latest stdout and stderr output from failed jobs to the Sentry event’s extra field.
This provides better visibility into job failures without changing the normal logging behavior.
✅ Example usage
$ ./supercronic -sentry-dsn https://examplePublicKey@o0.ingest.sentry.io/0 -sentry-extra-trace true
🧰 Technical details
- Added
-sentry-extra-trace flag in main.go
- Updated
cron.go:
- Captured
stdout and stderr via a 64 KB ring buffer
- Returned captured data from
runJob
- Conditionally attached it to Sentry extra fields when
-sentry-extra-trace is enabled
- Refactored
exec.Command.Start/Wait error handling into handleExecError()
- Updated
README.md and dependencies (go.mod, go.sum)
🚀 Benefits
- Improved debugging visibility in Sentry
- No performance or logging regressions
- Backward-compatible with existing jobs
📦 Example of enriched Sentry payload
{
"extra": {
"job.exit_code": 1,
"job.duration": "5.32s",
"job.stdout": "Starting backup...\nConnecting to database...",
"job.stderr": "pg_dump: connection failed: timeout"
}
}
🧩 Context
Currently, when Supercronic reports errors to Sentry using the
-sentry-dsnflag, the job’sstdoutandstderroutputs are not included in the Sentry events.This makes it harder to diagnose job failures due to missing runtime context.
💡 Proposal
Introduce a new optional flag:
When enabled, Supercronic will attach the latest
stdoutandstderroutput from failed jobs to the Sentry event’sextrafield.This provides better visibility into job failures without changing the normal logging behavior.
✅ Example usage
$ ./supercronic -sentry-dsn https://examplePublicKey@o0.ingest.sentry.io/0 -sentry-extra-trace true🧰 Technical details
-sentry-extra-traceflag inmain.gocron.go:stdoutandstderrvia a 64 KB ring bufferrunJob-sentry-extra-traceis enabledexec.Command.Start/Waiterror handling intohandleExecError()README.mdand dependencies (go.mod,go.sum)🚀 Benefits
📦 Example of enriched Sentry payload
{ "extra": { "job.exit_code": 1, "job.duration": "5.32s", "job.stdout": "Starting backup...\nConnecting to database...", "job.stderr": "pg_dump: connection failed: timeout" } }