feat(export): add slack, pagerduty, and discord webhook sinks#83
feat(export): add slack, pagerduty, and discord webhook sinks#83abhinavuser wants to merge 6 commits into
Conversation
|
🚀 First PR — welcome aboard! A few things to expect:
If you get stuck, reply here or jump to Discussions. We want this PR to land. |
|
dont spam. first get your past pRs merged |
|
fix conflict and rebase with main.. then ill review tag me |
fixes optiqor#29 Signed-off-by: abhinavuser <abhinavkumarv2101@gmail.com>
… package) Signed-off-by: abhinavuser <abhinavkumarv2101@gmail.com>
814d347 to
fa6c43c
Compare
Signed-off-by: abhinavuser <abhinavkumarv2101@gmail.com>
…lloc) Signed-off-by: abhinavuser <abhinavkumarv2101@gmail.com>
Signed-off-by: abhinavuser <abhinavkumarv2101@gmail.com>
|
hey @btwshivam i was waitin for my first pr to get merged thats why the delay but now the rebase is done and the merge conflict in |
Signed-off-by: abhinavuser <abhinavkumarv2101@gmail.com>
btwshivam
left a comment
There was a problem hiding this comment.
solid sink package: raw net/http with per-client timeouts, sinks run after render and failures are logged not fatal, dedupe and pagerduty state are both mutex-guarded, and no webhook urls get logged. two notes, neither blocking.
| } | ||
|
|
||
| deduped := deduper.Filter(filtered) | ||
| for _, sink := range activeSinks { |
There was a problem hiding this comment.
sinks send synchronously and sequentially here. each Send can take ~30s on a dead endpoint (10s client timeout times up to 3 retries plus backoff), so three unreachable sinks hang the command ~90s after the report already printed, and in continuous mode it stalls the next cycle. rendering first and treating failures as non-fatal is right, but dispatch each sink in its own goroutine (a sync.WaitGroup, the per-request timeouts already bound each one) so one slow webhook doesn't block the others or the cli.
| flags.StringSliceVar(&sinkURLs, "sink", nil, "webhook sinks (e.g. slack://..., pagerduty://...)") | ||
| flags.StringVar(&sevFloor, "severity-floor", "warning", "minimum severity to send to sinks (info, warning, critical)") | ||
| flags.DurationVar(&sinkDedupe, "sink-dedupe", 5*time.Minute, "deduplication window to prevent alert flapping") | ||
| flags.BoolVar(&dryRunSink, "dry-run-sinks", false, "print payloads instead of sending (useful for debugging sinks)") |
There was a problem hiding this comment.
--dry-run-sinks help says print payloads instead of sending, but the dry-run branches only log the finding count (dry-run sink ... findings=N), not the actual slack/pagerduty/discord json. debugging a block-kit or events-api-v2 payload is exactly when you'd want to see the body. either render the payload each sink would send, or change the help text to match what it does.
fixes #29
added built-in webhook sinks for
kerno doctorfindings. wired up the--sink,--severity-floor, and--sink-dedupeflags.what's included:
Sinkinterface with exponential backoff retries on 5xx errorskerno_sinks_deduped_totalandkerno_sinks_failed_totalmetricshttptest.Serverall env vars like
KERNO_SLACK_WEBHOOK_URLare expanded automatically if passed as flag values to keep shell history clean.Signed-off-by: abhinavuser abhinavkumarv2101@gmail.com