Documentation
¶
Overview ¶
Package monitoring scrapes member exporters and serves retained metric series.
Index ¶
- Variables
- func WriteStatePrometheus(w io.Writer, snapshot StateSnapshot) error
- type CertificateExpiry
- type ClusterState
- type Collector
- func (c *Collector) MemberUsage(cluster domain.ClusterRef, member string) MemberUsage
- func (c *Collector) Run(ctx context.Context) error
- func (c *Collector) Series(ctx context.Context, cluster domain.ClusterRef, metrics []string, ...) ([]Series, error)
- func (c *Collector) WritePrometheus(ctx context.Context, w io.Writer, allow func(domain.ClusterRef) bool) error
- type MemberUsage
- type Options
- type Point
- type Series
- type StateMetricDescriptor
- type StateSnapshot
- type Target
Constants ¶
This section is empty.
Variables ¶
var StateMetrics = []StateMetricDescriptor{ {"karakoram_cluster_info", "Cluster identity and current phase; value is one.", "gauge", []string{"namespace", "cluster", "provider", "version", "phase"}}, {"karakoram_cluster_ready", "Whether the cluster is ready.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_cluster_degraded", "Whether the cluster is degraded.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_cluster_condition", "Current condition identity and status; value is one.", "gauge", []string{"namespace", "cluster", "type", "status", "reason"}}, {"karakoram_cluster_members_co_located", "Whether members share an observed placement group; not an anti-affinity guarantee.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_member_agent_outdated", "Whether the member agent differs from the target build.", "gauge", []string{"namespace", "cluster", "member"}}, {"karakoram_backup_last_success_timestamp_seconds", "Unix timestamp of the last successful backup for the schedule.", "gauge", []string{"namespace", "cluster", "schedule"}}, {"karakoram_backup_last_failure_timestamp_seconds", "Unix timestamp of the last failed backup.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_certificate_expiry_timestamp_seconds", "Unix timestamp of certificate expiry.", "gauge", []string{"namespace", "cluster", "certificate"}}, {"karakoram_backup_drill_enabled", "Whether scheduled backup drills are enabled.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_backup_drill_last_failure_timestamp_seconds", "Unix timestamp of the last failed backup drill.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_backup_drill_last_success_timestamp_seconds", "Unix timestamp of the last successful backup drill.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_backup_drill_last_restore_duration_seconds", "Restore duration of the last successful backup drill in seconds.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_deployment_retries_exhausted", "Whether deployment retries are exhausted.", "gauge", []string{"namespace", "cluster"}}, {"karakoram_control_plane_backup_enabled", "Whether scheduled control-plane backups are enabled.", "gauge", nil}, {"karakoram_control_plane_backup_last_success_timestamp_seconds", "Unix timestamp of the last successful control-plane backup.", "gauge", nil}, {"karakoram_control_plane_backup_last_failure_timestamp_seconds", "Unix timestamp of the last failed control-plane backup.", "gauge", nil}, {"karakoram_notification_deliveries_failed_total", "Total notification deliveries that exhausted retries.", "counter", []string{"channel"}}, }
StateMetrics is the canonical control-plane exposition vocabulary. Cluster series are independent of member monitoring and require monitoring:read; installation series require settings:read. Timestamp gauges use Unix seconds, with zero meaning no recorded result. A nonempty backup schedule identifies an enabled schedule; the empty schedule identifies the aggregate/manual result.
Functions ¶
func WriteStatePrometheus ¶ added in v0.4.0
func WriteStatePrometheus(w io.Writer, snapshot StateSnapshot) error
WriteStatePrometheus writes current durable state, independent of agent scraping. Missing terminal results are zero; timestamps are completion times, not creation times or data-recovery points. No observation timestamp is synthesized.
Types ¶
type CertificateExpiry ¶ added in v0.4.0
type CertificateExpiry struct {
Namespace string
Cluster string
Certificate string
Expiry time.Time
}
CertificateExpiry is public certificate identity, never certificate/key material. Empty namespace and cluster designate an installation certificate.
type ClusterState ¶ added in v0.4.0
type ClusterState struct {
Cluster domain.Cluster
Backups []domain.Backup
Drills []domain.BackupDrill
}
ClusterState is the durable inventory used for one authorized cluster scrape.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector owns scrape scheduling and the latest federation samples.
func (*Collector) MemberUsage ¶
func (c *Collector) MemberUsage(cluster domain.ClusterRef, member string) MemberUsage
MemberUsage returns values only from a successful scrape within two scrape intervals. CPU uses the same reset-aware, 0–100% counter rate as Series and requires a preceding fresh sample; failed scrapes discard that baseline.
func (*Collector) Run ¶
Run scrapes discovered members until cancellation, retaining samples transactionally.
func (*Collector) Series ¶
func (c *Collector) Series(ctx context.Context, cluster domain.ClusterRef, metrics []string, start, end time.Time, step time.Duration) ([]Series, error)
Series reads canonical samples, derives reset-aware counter rates, and buckets by step.
func (*Collector) WritePrometheus ¶
func (c *Collector) WritePrometheus(ctx context.Context, w io.Writer, allow func(domain.ClusterRef) bool) error
WritePrometheus federates exposition with authoritative cluster/member labels. Failed discovery/scrapes and samples older than two collection intervals expose only karakoram_member_scrape_success=0, never cached database health values.
type MemberUsage ¶
type MemberUsage struct {
CPUPercent *float64
RAMBytes, DiskBytes *int64
// DiskTotalBytes is the data filesystem capacity reported by the agent.
DiskTotalBytes *int64
}
MemberUsage contains the latest process CPU percentage, resident memory and data-volume disk usage. Nil fields mean that the latest scrape has no value.
type Options ¶
type Options struct {
Store *store.Store
Dialer engine.AgentDialer
Targets func(context.Context) ([]Target, error)
Interval, Retention time.Duration
Logger *slog.Logger
Vocabulary []domain.MetricDescriptor
}
Options supplies storage, agent connections, target discovery and retention settings.
type Series ¶
type Series struct {
Name string `json:"name"`
Member string `json:"member"`
Unit string `json:"unit"`
Labels map[string]string `json:"labels,omitempty"`
Points []Point `json:"points"`
}
Series is a canonical member series consumed by the UI.
type StateMetricDescriptor ¶ added in v0.4.0
StateMetricDescriptor describes a control-plane series, including every label. Type is either gauge or counter.
type StateSnapshot ¶ added in v0.4.0
type StateSnapshot struct {
Clusters []ClusterState
Certificates []CertificateExpiry
Installation bool
ControlPlaneBackupEnabled bool
ControlPlaneBackups []domain.ControlPlaneBackup
NotificationFailures map[string]int64
}
StateSnapshot contains only records authorized by the caller. Installation is explicitly separate: a cluster monitoring grant never reveals installation data.