Documentation
¶
Overview ¶
Package obs owns Subflux's observability surface: the Prometheus registry (exposition prefix "subflux_") and every counter, gauge and histogram it serves — searches, downloads, imports, scans, the HTTP transport, and the bbolt store. The collectors are unexported, so a caller records through a named method and cannot register, rename or delete a series.
Named obs, not metrics: the github.com/cplieger/metrics library it wraps owns that name, and while this package was called metrics the collision forced every reference to the library through an extmetrics alias. The rename removed the collision, so the library is imported plainly.
Index ¶
- type Metrics
- func (m *Metrics) AdaptiveSkip()
- func (m *Metrics) DeleteMediaRoot(root string)
- func (m *Metrics) DeleteMediaRootUnavailable(root string)
- func (m *Metrics) DeleteProviderDisabled(id subflux.ProviderID)
- func (m *Metrics) Handler() http.HandlerFunc
- func (m *Metrics) IncProviderAuthFailure(id subflux.ProviderID)
- func (m *Metrics) IncProviderRateLimited(id subflux.ProviderID, op providergate.Op)
- func (m *Metrics) IncSubtitleWriteError()
- func (m *Metrics) RecordBackupSuccess(dur time.Duration)
- func (m *Metrics) RecordDownload(provider subflux.ProviderID, err error)
- func (m *Metrics) RecordEmbeddedDetectorError()
- func (m *Metrics) RecordHTTP(rm webhttp.RequestMetric)
- func (m *Metrics) RecordImport(source subflux.PollKey)
- func (m *Metrics) RecordPanic()
- func (m *Metrics) RecordReconcile(deleted int, reset int64, dur time.Duration)
- func (m *Metrics) RecordSSEConnect(verdict string, legacy bool)
- func (m *Metrics) RecordSSEDisconnect(cause string)
- func (m *Metrics) RecordSSEPresenceTransition(kind string)
- func (m *Metrics) RecordScan(items, found int, dur time.Duration)
- func (m *Metrics) RecordSearch(provider subflux.ProviderID, dur time.Duration, err error)
- func (m *Metrics) RecordStoreFileSize(bytes int64)
- func (m *Metrics) RecordStoreFreelistBytes(bytes int64)
- func (m *Metrics) RecordSubtitleSaved(provider subflux.ProviderID)
- func (m *Metrics) SetConfigured(ok bool)
- func (m *Metrics) SetMediaRootUnavailable(root string, unavailable bool)
- func (m *Metrics) SetMediaRootUnwritable(root string, unwritable bool)
- func (m *Metrics) SetPollCursorsDirty(n int)
- func (m *Metrics) SetProviderDisabled(id subflux.ProviderID, disabled bool)
- func (m *Metrics) SetProviderSettingRejected(id subflux.ProviderID, setting string, rejected bool)
- func (m *Metrics) SetSSEClients(n int)
- func (m *Metrics) SetSSEHead(n uint64)
- func (m *Metrics) SetSSEQueuedFrames(n int)
- func (m *Metrics) TotalSearches() int64
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 (*Metrics) AdaptiveSkip ¶
func (m *Metrics) AdaptiveSkip()
AdaptiveSkip records an item skipped by adaptive search.
func (*Metrics) DeleteMediaRoot ¶ added in v0.6.6
DeleteMediaRoot removes the media root's unwritable series.
func (*Metrics) DeleteMediaRootUnavailable ¶ added in v0.6.6
DeleteMediaRootUnavailable removes the media root's unavailable series.
func (*Metrics) DeleteProviderDisabled ¶ added in v0.6.6
func (m *Metrics) DeleteProviderDisabled(id subflux.ProviderID)
DeleteProviderDisabled removes the provider's disabled series.
func (*Metrics) Handler ¶
func (m *Metrics) Handler() http.HandlerFunc
Handler returns an HTTP handler that serves Prometheus metrics.
func (*Metrics) IncProviderAuthFailure ¶ added in v0.6.6
func (m *Metrics) IncProviderAuthFailure(id subflux.ProviderID)
IncProviderAuthFailure counts one credential rejection for the provider.
func (*Metrics) IncProviderRateLimited ¶ added in v0.6.6
func (m *Metrics) IncProviderRateLimited(id subflux.ProviderID, op providergate.Op)
IncProviderRateLimited counts one rate-limit pause for the provider and op.
func (*Metrics) IncSubtitleWriteError ¶ added in v0.6.6
func (m *Metrics) IncSubtitleWriteError()
IncSubtitleWriteError counts one failed subtitle write or media folder write test.
func (*Metrics) RecordBackupSuccess ¶
RecordBackupSuccess records a successful backup's timestamp and duration.
func (*Metrics) RecordDownload ¶
func (m *Metrics) RecordDownload(provider subflux.ProviderID, err error)
RecordDownload records a download attempt, routing to the success or error counter.
func (*Metrics) RecordEmbeddedDetectorError ¶
func (m *Metrics) RecordEmbeddedDetectorError()
RecordEmbeddedDetectorError counts a failed embedded track probe. The search engine excludes context cancellations before calling this.
func (*Metrics) RecordHTTP ¶
func (m *Metrics) RecordHTTP(rm webhttp.RequestMetric)
RecordHTTP records one HTTP request. It takes webhttp's named-field record rather than four positional values so the two adjacent strings cannot be transposed on the way to a metric label.
func (*Metrics) RecordImport ¶
RecordImport records an import detected.
func (*Metrics) RecordPanic ¶
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 ¶
RecordReconcile records metrics from a reconcile pass.
func (*Metrics) RecordSSEConnect ¶ added in v0.5.39
RecordSSEConnect counts one accepted SSE connection under its hello verdict and under its client generation. The generation label is decided by whether the SSE-Wire header was present, never by its value.
func (*Metrics) RecordSSEDisconnect ¶ added in v0.5.39
RecordSSEDisconnect counts one SSE departure under the hub's cause.
func (*Metrics) RecordSSEPresenceTransition ¶ added in v0.5.39
RecordSSEPresenceTransition counts one presence-table transition (alive or expired).
func (*Metrics) RecordScan ¶
RecordScan records scan completion.
func (*Metrics) RecordSearch ¶
RecordSearch records a search attempt for a provider.
func (*Metrics) RecordStoreFileSize ¶
RecordStoreFileSize records the current bbolt database file size.
func (*Metrics) RecordStoreFreelistBytes ¶
RecordStoreFreelistBytes records the reclaimable freelist bytes.
func (*Metrics) RecordSubtitleSaved ¶ added in v0.6.6
func (m *Metrics) RecordSubtitleSaved(provider subflux.ProviderID)
RecordSubtitleSaved counts one subtitle file written for the provider.
func (*Metrics) SetConfigured ¶
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) SetMediaRootUnavailable ¶ added in v0.6.6
SetMediaRootUnavailable sets the media root's unavailable gauge.
func (*Metrics) SetMediaRootUnwritable ¶ added in v0.6.6
SetMediaRootUnwritable sets the media root's unwritable gauge.
func (*Metrics) SetPollCursorsDirty ¶
SetPollCursorsDirty records how many poll cursors currently have a failing durable persist (0 when healthy).
func (*Metrics) SetProviderDisabled ¶ added in v0.6.6
func (m *Metrics) SetProviderDisabled(id subflux.ProviderID, disabled bool)
SetProviderDisabled sets the provider's disabled gauge.
func (*Metrics) SetProviderSettingRejected ¶ added in v0.6.6
func (m *Metrics) SetProviderSettingRejected(id subflux.ProviderID, setting string, rejected bool)
SetProviderSettingRejected sets the series for a rejected optional setting, or deletes it when the rejection clears.
func (*Metrics) SetSSEClients ¶ added in v0.5.39
SetSSEClients records the connected SSE client count.
func (*Metrics) SetSSEHead ¶ added in v0.5.39
SetSSEHead records the newest replay-ring offset published this epoch.
func (*Metrics) SetSSEQueuedFrames ¶ added in v0.5.39
SetSSEQueuedFrames records the frames queued across all SSE client channels.
func (*Metrics) TotalSearches ¶
TotalSearches returns the cumulative search count across all providers.