Versions in this module Expand all Collapse all v1 v1.0.0 Jun 25, 2026 Changes in this version + const AlertStatusDown + const AlertStatusUp + var ErrMissingServiceID = errors.New("uptime: service id is required") + var ErrMissingStore = errors.New("uptime: store is required") + type AlertConfig struct + CheckInterval time.Duration + Hook AlertHook + NotifyOnFirstDown bool + type AlertDecision struct + Notify bool + PreviousStatus string + type AlertEvent struct + CurrentStatus string + Description string + DetectedAt time.Time + DownFor time.Duration + LastSeenAt time.Time + PreviousStatus string + SampleInterval time.Duration + ServiceID string + ServiceName string + type AlertHook func(context.Context, AlertEvent) error + type AlertState struct + CheckedAt time.Time + LastSeenAt time.Time + NotifyOnFirstDown bool + ServiceID string + Status string + type AlertStateStore interface + ClaimAlertEvent func(ctx context.Context, state AlertState) (AlertDecision, error) + type Background string + const BackgroundGrid + const BackgroundSolid + type CleanupOptions struct + DailyBeforeDay string + SamplesBeforeDay string + type Config struct + Alert AlertConfig + DaysToShow int + IDGenerator IDGenerator + InstanceID int64 + Logger Logger + NodeID int64 + RetentionDays int + SampleInterval time.Duration + ServiceDescription string + ServiceID string + ServiceName string + Snapshot SnapshotConfig + Store Store + Timezone *time.Location + UI UIConfig + func DefaultConfig() Config + type DailyStatus struct + Day string + ExpectedSlots int + Finalized bool + ServiceID string + UpSlots int + UptimeRate float64 + type DayStatus struct + Day string + EstimatedDowntimeSeconds int64 + ExpectedSlots int + Finalized bool + HasData bool + Status string + UpSlots int + UptimeRate float64 + type Heartbeat struct + Day string + InstanceID int64 + SeenAt time.Time + ServiceID string + Slot int64 + type IDGenerator interface + NextID func() int64 + type Instance struct + Hostname string + ID int64 + LastSeenAt time.Time + PID int + ServiceID string + StartedAt time.Time + type Language string + const LanguageChineseSimplified + const LanguageEnglish + type Logger interface + Printf func(format string, args ...any) + type QueryDailyOptions struct + FromDay string + ToDay string + type QueryTodaySamplesOptions struct + Day string + type RollupOptions struct + BeforeDay string + ExpectedSlotsForDay func(day string) int + ExpectedSlotsForServiceDay func(serviceID, day string) int + type Service struct + CreatedAt time.Time + Description string + ID string + LastSeenAt time.Time + Name string + SampleInterval time.Duration + type ServiceStatus struct + CurrentStatus string + Daily []DayStatus + Description string + ID string + LastSeenAt time.Time + Name string + SampleIntervalSeconds int64 + type Snapshot = StatusResponse + type SnapshotConfig struct + CacheTTL time.Duration + DisableCache bool + DisableStaleIfError bool + type StatusResponse struct + Days int + GeneratedAt time.Time + SampleIntervalSeconds int64 + Services []ServiceStatus + Storage StorageResponse + type StorageResponse struct + Driver string + LastError string + LastErrorAt *time.Time + Status string + type Store interface + Cleanup func(ctx context.Context, options CleanupOptions) error + Close func() error + Init func(ctx context.Context) error + ListServices func(ctx context.Context) ([]Service, error) + QueryDaily func(ctx context.Context, options QueryDailyOptions) ([]DailyStatus, error) + QueryTodaySamples func(ctx context.Context, options QueryTodaySamplesOptions) ([]TodaySampleStatus, error) + RollupDaily func(ctx context.Context, options RollupOptions) error + UpsertInstance func(ctx context.Context, instance Instance) error + UpsertService func(ctx context.Context, service Service) error + WriteHeartbeat func(ctx context.Context, heartbeat Heartbeat) error + type Theme string + const ThemeDark + const ThemeLight + type TodaySampleStatus struct + Day string + ServiceID string + UpSlots int + type UIConfig struct + Background Background + DefaultLanguage Language + DefaultTheme Theme + Description string + Footer string + GreenThreshold float64 + Path string + ShowInstanceDetails bool + Title string + YellowThreshold float64 + type Uptime struct + func New(config Config) (*Uptime, error) + func (u *Uptime) CachedSnapshot(ctx context.Context) (Snapshot, error) + func (u *Uptime) Close() error + func (u *Uptime) Handler() http.Handler + func (u *Uptime) LastError() (error, time.Time) + func (u *Uptime) Middleware(next http.Handler) http.Handler + func (u *Uptime) Snapshot(ctx context.Context) (Snapshot, error)