metrics

package
v0.1.119 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: GPL-2.0, GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package metrics provides Prometheus-compatible metrics for Subflux. Exposes counters and summaries for searches, downloads, and provider health.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics holds all application metrics.

func New

func New() *Metrics

New creates a new Metrics instance.

func (*Metrics) AdaptiveSkip

func (m *Metrics) AdaptiveSkip()

AdaptiveSkip records an item skipped by adaptive search.

func (*Metrics) Handler

func (m *Metrics) Handler() http.HandlerFunc

Handler returns an HTTP handler that serves Prometheus metrics.

func (*Metrics) RecordBackupSuccess added in v0.1.54

func (m *Metrics) RecordBackupSuccess(dur time.Duration)

RecordBackupSuccess records a successful backup's timestamp and duration.

func (*Metrics) RecordDownload

func (m *Metrics) RecordDownload(provider api.ProviderID, err error)

RecordDownload records a download attempt, routing to the success or error counter.

func (*Metrics) RecordHTTP added in v0.1.29

func (m *Metrics) RecordHTTP(method, path string, status int, d time.Duration)

RecordHTTP records one HTTP request (method, path, status, duration).

func (*Metrics) RecordImport

func (m *Metrics) RecordImport(source api.PollKey)

RecordImport records an import detected.

func (*Metrics) RecordPanic added in v0.1.92

func (m *Metrics) RecordPanic()

RecordPanic records one HTTP handler panic recovered by the webhttp.Recoverer middleware. Wired as Recoverer's WithPanicHook so a recovered 500 also increments a monitorable counter.

func (*Metrics) RecordReconcile added in v0.1.54

func (m *Metrics) RecordReconcile(deleted int, reset int64, dur time.Duration)

RecordReconcile records metrics from a reconcile pass.

func (*Metrics) RecordScan

func (m *Metrics) RecordScan(items, found int, dur time.Duration)

RecordScan records scan completion.

func (*Metrics) RecordSearch

func (m *Metrics) RecordSearch(provider api.ProviderID, dur time.Duration, err error)

RecordSearch records a search attempt for a provider.

func (*Metrics) RecordStoreFileSize added in v0.1.54

func (m *Metrics) RecordStoreFileSize(bytes int64)

RecordStoreFileSize records the current bbolt database file size.

func (*Metrics) RecordStoreFreelistBytes added in v0.1.54

func (m *Metrics) RecordStoreFreelistBytes(bytes int64)

RecordStoreFreelistBytes records the reclaimable freelist bytes.

func (*Metrics) SetConfigured added in v0.1.67

func (m *Metrics) SetConfigured(ok bool)

SetConfigured records whether a valid configuration is active. It sets the subflux_configured gauge to 1 when configured (background automation running) and 0 in unconfigured mode (scheduler/poller/backup goroutines skipped), enabling a level-triggered "stuck unconfigured" alert.

func (*Metrics) TotalSearches

func (m *Metrics) TotalSearches() int64

TotalSearches returns the cumulative search count across all providers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL