Documentation
¶
Overview ¶
Package metrics owns the opt-in Prometheus exposition (ADR-48, issue #325). Collectors live on a private registry, never the global default one, and every label value is a constant chosen here: callers pass typed enums, so no request data can reach a label. Incrementing is cheap and harmless when no metrics listener runs (hook subprocesses, or serve without OPENSTORAGE_METRICS_LISTEN).
Index ¶
- func CommitGraphRefresh(o CommitGraphOutcome)
- func Handler() http.Handler
- func InstrumentHTTP(s Surface, next http.Handler) http.Handler
- func InstrumentMux(mux *http.ServeMux, classify func(pattern string) Surface) http.Handler
- func IsUnspecifiedBind(addr string) bool
- func JobRun(j Job, r Result)
- func NewServer() *http.Server
- func S3WALContentionExhausted(scope ContentionScope)
- func S3WALLeaseRenewalFailed()
- func S3WALManifestSizeGuard(r SizeGuardResult)
- func SetS3WALLeaseHeld(held bool)
- func Value(metric string, labels map[string]string) float64
- type CommitGraphOutcome
- type ContentionScope
- type Job
- type Result
- type SizeGuardResult
- type Surface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitGraphRefresh ¶
func CommitGraphRefresh(o CommitGraphOutcome)
CommitGraphRefresh counts one cache commit-graph refresh outcome.
func InstrumentHTTP ¶
InstrumentHTTP counts requests and their duration under the fixed surface label. Nothing from the request (path, host, headers, method) becomes a label value.
func InstrumentMux ¶
InstrumentMux instruments a whole ServeMux, so responses the mux generates itself (the /api → /api/ redirect, path-cleaning redirects) are counted too. The surface comes from classify applied to the pattern mux.Handler reports: the matched registration, or for a mux redirect the path the redirect leads to. classify must map every input to one of the fixed surfaces; the pattern itself never becomes a label.
func IsUnspecifiedBind ¶
IsUnspecifiedBind reports whether addr binds every interface (empty host or an unspecified IP). Such binds get a startup warning; they are not refused (ADR-48). The warning is not exposure detection.
func NewServer ¶
NewServer builds the metrics listener's server: a private mux with the single GET /metrics route (HEAD is served by the same pattern; other methods get 405, other paths 404) and fixed timeouts.
func S3WALContentionExhausted ¶
func S3WALContentionExhausted(scope ContentionScope)
S3WALContentionExhausted counts one S3WAL mutation that returned ErrCASContention to its caller.
func S3WALLeaseRenewalFailed ¶
func S3WALLeaseRenewalFailed()
S3WALLeaseRenewalFailed counts one lease renewal write attempt that returned an error.
func S3WALManifestSizeGuard ¶
func S3WALManifestSizeGuard(r SizeGuardResult)
S3WALManifestSizeGuard counts one manifest size-guard event.
func SetS3WALLeaseHeld ¶
func SetS3WALLeaseHeld(held bool)
SetS3WALLeaseHeld records whether this process holds the instance lease.
Types ¶
type CommitGraphOutcome ¶
type CommitGraphOutcome int
CommitGraphOutcome is how one cache commit-graph refresh ended (ADR-47, issue #322). Label values equal githttp's outcome names, which are also its documented log contract.
const ( CommitGraphWritten CommitGraphOutcome = iota CommitGraphWrittenPlain CommitGraphSkippedTipCap CommitGraphSkippedBusy CommitGraphLockHeld CommitGraphMemoryLimit CommitGraphTimedOut CommitGraphCanceled CommitGraphFailed )
type ContentionScope ¶
type ContentionScope int
ContentionScope names the S3WAL mutation loop that exhausted its CAS attempts.
const ( ScopeRefs ContentionScope = iota ScopeScanState ScopeMeta )
type SizeGuardResult ¶
type SizeGuardResult int
SizeGuardResult is the manifest size-guard outcome.
const ( SizeGuardWarn SizeGuardResult = iota SizeGuardRefuse )