Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitFromEnv ¶
func InitFromEnv()
InitFromEnv enables Prometheus exporter if METRICS_PROMETHEUS=true. It also starts a small HTTP server on the port configured by METRICS_PORT (default 9090) and listens on ":<port>" with endpoints: /metrics (prom) and /healthz (200 ok).
func ObserveToolResultSize ¶
ObserveToolResultSize records a histogram of result sizes for a tool, applying basic sampling to reduce cardinality/volume. Sampling rate is controlled by METRICS_RESULT_SAMPLE_N (default 1 = every call).
func SetRecorder ¶
func SetRecorder(r Recorder)
SetRecorder swaps the global recorder implementation.
Types ¶
type Recorder ¶
type Recorder interface {
IncDBOpTotal(op string, success bool)
ObserveDBOpSeconds(op string, success bool, seconds float64)
IncToolTotal(tool string, success bool)
ObserveToolSeconds(tool string, success bool, seconds float64)
// Optional: result size metrics (low-cardinality by tool)
ObserveToolResultSize(tool string, size int)
// Optional: statement-cache and pool metrics
IncStmtCacheHit(op string)
IncStmtCacheMiss(op string)
ObservePoolStats(inUse, idle int)
}
Recorder defines the metrics surface used across the codebase.
Click to show internal directories.
Click to hide internal directories.