Documentation
¶
Index ¶
- func AddressRequiresToken(addr string) bool
- func MetricsServeTask(server *http.Server, listener net.Listener, address string) func() error
- func MetricsShutdownTask(ctx context.Context, server *http.Server, address string) func() error
- func NewMetricsServer(handler http.Handler, bearerToken string) *http.Server
- func NewPprofHandler() http.Handler
- func NewPprofServer(bearerToken string) *http.Server
- func PprofServeTask(server *http.Server, listener net.Listener, address string) func() error
- func PprofShutdownTask(ctx context.Context, server *http.Server, address string) func() error
- func ProtectHandler(handler http.Handler, bearerToken string) http.Handler
- type DynamoDBMetrics
- type DynamoDBRequestObserver
- type DynamoDBRequestReport
- type DynamoDBTableMetrics
- type RaftMetrics
- type RaftObserver
- type RaftRuntime
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressRequiresToken ¶
AddressRequiresToken reports whether the address is exposed beyond loopback and therefore requires bearer-token protection.
func MetricsServeTask ¶
MetricsServeTask returns an errgroup task that serves the metrics endpoint until shutdown.
func MetricsShutdownTask ¶
MetricsShutdownTask returns an errgroup task that stops the metrics server on context cancellation.
func NewMetricsServer ¶
NewMetricsServer constructs an HTTP server for the protected metrics handler.
func NewPprofHandler ¶
NewPprofHandler returns an http.Handler that serves the Go runtime profiling endpoints under /debug/pprof/.
func NewPprofServer ¶
NewPprofServer creates an HTTP server for the pprof debug endpoints, optionally protected by bearer-token authentication.
func PprofServeTask ¶
PprofServeTask returns an errgroup task that serves the pprof endpoint until shutdown.
func PprofShutdownTask ¶
PprofShutdownTask returns an errgroup task that stops the pprof server on context cancellation.
Types ¶
type DynamoDBMetrics ¶
type DynamoDBMetrics struct {
// contains filtered or unexported fields
}
func (*DynamoDBMetrics) ObserveDynamoDBRequest ¶
func (m *DynamoDBMetrics) ObserveDynamoDBRequest(report DynamoDBRequestReport)
ObserveDynamoDBRequest records the final outcome of a request.
func (*DynamoDBMetrics) ObserveInFlightChange ¶
func (m *DynamoDBMetrics) ObserveInFlightChange(operation string, delta float64)
ObserveInFlightChange adjusts the in-flight request gauge for an operation.
type DynamoDBRequestObserver ¶
type DynamoDBRequestObserver interface {
ObserveInFlightChange(operation string, delta float64)
ObserveDynamoDBRequest(report DynamoDBRequestReport)
}
DynamoDBRequestObserver records per-request DynamoDB-compatible API metrics.
type DynamoDBRequestReport ¶
type DynamoDBRequestReport struct {
Operation string
HTTPStatus int
ErrorType string
Duration time.Duration
RequestBytes int
ResponseBytes int
Tables []string
TableMetrics map[string]DynamoDBTableMetrics
}
DynamoDBRequestReport is the normalized result of a single request.
type DynamoDBTableMetrics ¶
DynamoDBTableMetrics captures table-scoped work done by a request.
type RaftMetrics ¶
type RaftMetrics struct {
// contains filtered or unexported fields
}
RaftMetrics holds all Prometheus gauge vectors for a single Raft group. Fields are populated by observeRuntime from raft.Raft.Stats().
type RaftObserver ¶
type RaftObserver struct {
// contains filtered or unexported fields
}
func (*RaftObserver) ObserveOnce ¶
func (o *RaftObserver) ObserveOnce(runtimes []RaftRuntime)
ObserveOnce captures the latest raft state for all configured runtimes.
func (*RaftObserver) Start ¶
func (o *RaftObserver) Start(ctx context.Context, runtimes []RaftRuntime, interval time.Duration)
Start polls raft state and configuration on a fixed interval until ctx is canceled.
type RaftRuntime ¶
RaftRuntime describes a raft group observed by the metrics exporter.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry owns the Prometheus registry used by a single Elastickv node.
func NewRegistry ¶
NewRegistry builds a registry with constant labels that identify the local node.
func (*Registry) DynamoDBObserver ¶
func (r *Registry) DynamoDBObserver() DynamoDBRequestObserver
DynamoDBObserver returns the DynamoDB request observer backed by this registry.
func (*Registry) Gatherer ¶
func (r *Registry) Gatherer() prometheus.Gatherer
Gatherer exposes the underlying gatherer for tests and custom exporters.
func (*Registry) Handler ¶
Handler returns an HTTP handler that exposes the Prometheus scrape endpoint.
func (*Registry) RaftObserver ¶
func (r *Registry) RaftObserver() *RaftObserver
RaftObserver returns the Raft topology observer backed by this registry.