feat: sink health monitoring — database schema & migrations (Issue #1)#12
Open
joejohnson123[bot] wants to merge 1 commit into
Open
feat: sink health monitoring — database schema & migrations (Issue #1)#12joejohnson123[bot] wants to merge 1 commit into
joejohnson123[bot] wants to merge 1 commit into
Conversation
Implements Issue #1 — foundational tables and Ecto schemas for sink health monitoring. New tables (all in config_schema): - sink_monitors: per-sink monitor config (threshold or anomaly type) - sink_monitor_notification_channels: alert destinations (webhook/slack/discord/pagerduty/incident_io) - sink_monitor_alerts: alert history (triggered/resolved) - sink_monitor_metric_samples: rolling metric data for anomaly detection Schemas include: - Full changeset validation with type-specific field requirements - Threshold monitors require threshold_value + window_seconds - Anomaly monitors require sensitivity level (low/medium/high) - Channel config validation per channel type (url/webhook_url/routing_key/api_key) - Encrypted channel config via Sequin.Encrypted.Map - Query helpers for common access patterns Co-authored-by: Joe Johnson (JJ) <joejohnson123[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements Issue #1 — foundational database tables and Ecto schemas for the sink health monitoring feature.
This is the first PR in the sink health monitoring series. All subsequent work (evaluation worker, notification dispatcher, UI, etc.) builds on these schemas.
New Tables (all in
config_schema)sink_monitorsPer-sink monitor configuration. Supports two types:
Fields:
name,enabled,metric(pending/failed messages),monitor_type,threshold_value,threshold_window_seconds,anomaly_sensitivity(low/medium/high),notify_on_recovery,cooldown_secondsUnique constraint on
(sink_consumer_id, name).sink_monitor_notification_channelsAlert destinations per monitor. Supports: webhook, Slack, Discord, PagerDuty, Incident.io.
Config is encrypted via
Sequin.Encrypted.Map. Each channel type has validation for required config fields (e.g. webhook requiresurl, Slack requireswebhook_url).sink_monitor_alertsAlert history — tracks triggered and resolved incidents with metric values and timestamps.
sink_monitor_metric_samplesRolling metric snapshots for anomaly detection (auto-pruned to 2 hours).
Schemas
All 4 schemas follow existing Sequin patterns:
use Sequin.ConfigSchema+typed_schemaEcto.Enumfor enum fieldswhere_account_id,where_enabled, etc.)Build Note
mix compile --warnings-as-errorsin the sandbox environment (thread/process limits prevent native NIF compilation forezstd,crc32cer,argon2_elixir). Schemas follow all existing conventions exactly — please verify compilation locally.Closes
Closes #1
Summary by cubic
Introduces the database schema and Ecto models for sink health monitoring (Issue #1). Establishes monitors, alerts, metric samples, and notification channels as the foundation for evaluation, notifications, and UI.
New Features
Migration
Written for commit a1bf6c7. Summary will update on new commits.