Documentation ¶
Index ¶
Constants ¶
View Source
const ( LblBackend = "backend" LblFrom = "from" LblTo = "to" LblReason = "reason" LblMigrateResult = "migrate_res" )
Label constants.
View Source
const ( LabelServer = "server" LabelBalance = "balance" LabelSession = "session" LabelMonitor = "monitor" LabelBackend = "backend" LabelTraffic = "traffic" LabelReplay = "replay" )
metrics labels.
View Source
const ( LblType = "type" EventStart = "start" EventClose = "close" )
View Source
const (
LblCmdType = "cmd_type"
)
LblCmdType is the label constant.
View Source
const (
LblRes = "res"
)
View Source
const (
ModuleProxy = "tiproxy"
)
Variables ¶
View Source
var ( BackendStatusGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelBackend, Name: "b_status", Help: "Gauge of backend status.", }, []string{LblBackend}) GetBackendHistogram = prometheus.NewHistogram( prometheus.HistogramOpts{ Namespace: ModuleProxy, Subsystem: LabelBackend, Name: "get_backend_duration_seconds", Help: "Bucketed histogram of time (s) for getting an available backend.", Buckets: prometheus.ExponentialBuckets(0.000001, 2, 26), }) GetBackendCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelBackend, Name: "get_backend", Help: "Counter of getting backend.", }, []string{LblRes}) PingBackendGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelBackend, Name: "ping_duration_seconds", Help: "Time (s) of pinging the SQL port of each backend.", }, []string{LblBackend}) HealthCheckCycleGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelBackend, Name: "health_check_seconds", Help: "Time (s) of each health check cycle.", }) )
View Source
var ( BackendConnGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelBalance, Name: "b_conn", Help: "Number of backend connections.", }, []string{LblBackend}) MigrateCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelBalance, Name: "migrate_total", Help: "Number and result of session migration.", }, []string{LblFrom, LblTo, LblReason, LblMigrateResult}) MigrateDurationHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: ModuleProxy, Subsystem: LabelBalance, Name: "migrate_duration_seconds", Help: "Bucketed histogram of migrating time (s) of sessions.", Buckets: prometheus.ExponentialBuckets(0.0001, 2, 26), }, []string{LblFrom, LblTo, LblMigrateResult}) )
View Source
var ( ReplayPendingCmdsGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelReplay, Name: "pending_cmds", Help: "Counter of pending commands.", }) ReplayWaitTime = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelReplay, Name: "wait_time", Help: "Wait time of replaying commands.", }) )
View Source
var ( ConnGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelServer, Name: "connections", Help: "Number of connections.", }) CreateConnCounter = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelServer, Name: "create_connection_total", Help: "Number of create connections.", }) DisConnCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelServer, Name: "disconnection_total", Help: "Number of disconnections.", }, []string{LblType}) OwnerGauge = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelServer, Name: "owner", Help: "The TiProxy owner of each job type.", }, []string{LblType}) MaxProcsGauge = prometheus.NewGauge( prometheus.GaugeOpts{ Namespace: ModuleProxy, Subsystem: LabelServer, Name: "maxprocs", Help: "The value of GOMAXPROCS.", }) ServerEventCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelServer, Name: "event", Help: "Counter of TiProxy event.", }, []string{LblType}) ServerErrCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelServer, Name: "err", Help: "Counter of server error.", }, []string{LblType}) TimeJumpBackCounter = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelMonitor, Name: "time_jump_back_total", Help: "Counter of system time jumps backward.", }) KeepAliveCounter = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelMonitor, Name: "keep_alive_total", Help: "Counter of proxy keep alive.", }) )
View Source
var ( QueryTotalCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelSession, Name: "query_total", Help: "Counter of queries.", }, []string{LblBackend, LblCmdType}) QueryDurationHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: ModuleProxy, Subsystem: LabelSession, Name: "query_duration_seconds", Help: "Bucketed histogram of processing time (s) of handled queries.", Buckets: prometheus.ExponentialBuckets(0.0005, 2, 29), }, []string{LblBackend, LblCmdType}) HandshakeDurationHistogram = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Namespace: ModuleProxy, Subsystem: LabelSession, Name: "handshake_duration_seconds", Help: "Bucketed histogram of processing time (s) of handshakes.", Buckets: prometheus.ExponentialBuckets(0.0005, 2, 29), }, []string{LblBackend}) )
View Source
var ( InboundBytesCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelTraffic, Name: "inbound_bytes", Help: "Counter of bytes from backends.", }, []string{LblBackend}) InboundPacketsCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelTraffic, Name: "inbound_packets", Help: "Counter of packets from backends.", }, []string{LblBackend}) OutboundBytesCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelTraffic, Name: "outbound_bytes", Help: "Counter of bytes to backends.", }, []string{LblBackend}) OutboundPacketsCounter = prometheus.NewCounterVec( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelTraffic, Name: "outbound_packets", Help: "Counter of packets to backends.", }, []string{LblBackend}) CrossLocationBytesCounter = prometheus.NewCounter( prometheus.CounterOpts{ Namespace: ModuleProxy, Subsystem: LabelTraffic, Name: "cross_location_bytes", Help: "Counter of bytes between TiProxy and cross-location backends.", }) )
Functions ¶
func DelBackend ¶ added in v1.2.0
func DelBackend(addr string)
func ReadCounter ¶
func ReadCounter(counter prometheus.Counter) (int, error)
ReadCounter reads the value from the counter. It is only used for testing.
Types ¶
type MetricsManager ¶
type MetricsManager struct {
// contains filtered or unexported fields
}
MetricsManager manages metrics.
func NewMetricsManager ¶
func NewMetricsManager() *MetricsManager
NewMetricsManager creates a MetricsManager.
Click to show internal directories.
Click to hide internal directories.