Documentation
¶
Index ¶
- Constants
- func NewTxIndexerMetrics() metrics.TxIndexerMetrics
- func RegisterMetrics(services []string, registry *prometheus.Registry, logger *logrus.Logger)
- type Config
- type HTTPMetrics
- type NoOpWorkerMetrics
- func (n *NoOpWorkerMetrics) Handler(taskType string, handler asynq.HandlerFunc) asynq.HandlerFunc
- func (n *NoOpWorkerMetrics) RecordError(taskType, errorType string)
- func (n *NoOpWorkerMetrics) RecordTaskCompleted(taskType string, duration float64)
- func (n *NoOpWorkerMetrics) RecordTaskFailed(taskType string, duration float64)
- func (n *NoOpWorkerMetrics) RecordTaskFinished(taskType string)
- func (n *NoOpWorkerMetrics) RecordTaskStarted(taskType string)
- func (n *NoOpWorkerMetrics) RecordVaultOperation(operation, status string, duration float64)
- type Server
- type TxIndexerMetrics
- func (tim *TxIndexerMetrics) RecordIterationDuration(chain common.Chain, duration float64)
- func (tim *TxIndexerMetrics) RecordProcessing(chain common.Chain)
- func (tim *TxIndexerMetrics) RecordProcessingError(chain common.Chain, errorType string)
- func (tim *TxIndexerMetrics) RecordRPCError(chain common.Chain)
- func (tim *TxIndexerMetrics) RecordTransactionStatus(chain common.Chain, status string)
- func (tim *TxIndexerMetrics) SetActiveTransactions(chain common.Chain, status string, count float64)
- func (tim *TxIndexerMetrics) SetChainHeight(chain common.Chain, height float64)
- func (tim *TxIndexerMetrics) SetLastProcessingTimestamp(timestamp float64)
- type WorkerMetrics
- func (wm *WorkerMetrics) Handler(taskType string, handler asynq.HandlerFunc) asynq.HandlerFunc
- func (wm *WorkerMetrics) RecordError(taskType, errorType string)
- func (wm *WorkerMetrics) RecordTaskCompleted(taskType string, duration float64)
- func (wm *WorkerMetrics) RecordTaskFailed(taskType string, duration float64)
- func (wm *WorkerMetrics) RecordTaskFinished(taskType string)
- func (wm *WorkerMetrics) RecordTaskStarted(taskType string)
- func (wm *WorkerMetrics) RecordVaultOperation(operation, status string, duration float64)
- type WorkerMetricsInterface
Constants ¶
const ( ServiceFee = "fee" ServiceTxIndexer = "tx_indexer" ServiceVault = "vault" ServiceWorker = "worker" ServiceHTTP = "http" )
Service names for metrics registration
Variables ¶
This section is empty.
Functions ¶
func NewTxIndexerMetrics ¶
func NewTxIndexerMetrics() metrics.TxIndexerMetrics
NewTxIndexerMetrics creates a new instance of TxIndexerMetrics
func RegisterMetrics ¶
func RegisterMetrics(services []string, registry *prometheus.Registry, logger *logrus.Logger)
RegisterMetrics registers metrics for the specified services with a custom registry
Types ¶
type Config ¶
type Config struct {
Enabled bool `mapstructure:"enabled" json:"enabled,omitempty"`
Host string `mapstructure:"host" json:"host,omitempty"`
Port int `mapstructure:"port" json:"port,omitempty"`
}
Config holds metrics server configuration
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns default metrics configuration
type HTTPMetrics ¶ added in v0.1.16
type HTTPMetrics struct{}
HTTPMetrics provides methods to update HTTP-related metrics
func NewHTTPMetrics ¶ added in v0.1.16
func NewHTTPMetrics() *HTTPMetrics
NewHTTPMetrics creates a new instance of HTTPMetrics
func (*HTTPMetrics) Middleware ¶ added in v0.1.16
func (hm *HTTPMetrics) Middleware() echo.MiddlewareFunc
Middleware returns an Echo middleware for HTTP metrics collection
func (*HTTPMetrics) RecordRequest ¶ added in v0.1.16
func (hm *HTTPMetrics) RecordRequest(method, path, statusCode string, duration float64)
RecordRequest manually records an HTTP request (for cases where middleware isn't used)
type NoOpWorkerMetrics ¶ added in v0.1.16
type NoOpWorkerMetrics struct{}
NoOpWorkerMetrics provides a no-op implementation of worker metrics
func NewNoOpWorkerMetrics ¶ added in v0.1.16
func NewNoOpWorkerMetrics() *NoOpWorkerMetrics
NewNoOpWorkerMetrics creates a new instance of NoOpWorkerMetrics
func (*NoOpWorkerMetrics) Handler ¶ added in v0.1.16
func (n *NoOpWorkerMetrics) Handler(taskType string, handler asynq.HandlerFunc) asynq.HandlerFunc
Handler returns the original handler without any metrics wrapping
func (*NoOpWorkerMetrics) RecordError ¶ added in v0.1.16
func (n *NoOpWorkerMetrics) RecordError(taskType, errorType string)
func (*NoOpWorkerMetrics) RecordTaskCompleted ¶ added in v0.1.16
func (n *NoOpWorkerMetrics) RecordTaskCompleted(taskType string, duration float64)
NoOpWorkerMetrics implementations - all methods are no-ops
func (*NoOpWorkerMetrics) RecordTaskFailed ¶ added in v0.1.16
func (n *NoOpWorkerMetrics) RecordTaskFailed(taskType string, duration float64)
func (*NoOpWorkerMetrics) RecordTaskFinished ¶ added in v0.1.16
func (n *NoOpWorkerMetrics) RecordTaskFinished(taskType string)
func (*NoOpWorkerMetrics) RecordTaskStarted ¶ added in v0.1.16
func (n *NoOpWorkerMetrics) RecordTaskStarted(taskType string)
func (*NoOpWorkerMetrics) RecordVaultOperation ¶ added in v0.1.16
func (n *NoOpWorkerMetrics) RecordVaultOperation(operation, status string, duration float64)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the metrics HTTP server
func StartMetricsServer ¶
StartMetricsServer is a convenience function to start the metrics server with services
func StartMetricsServerWithRegistry ¶
func StartMetricsServerWithRegistry(cfg Config, registry *prometheus.Registry, logger *logrus.Logger) *Server
StartMetricsServerWithRegistry starts a metrics server with a pre-configured registry
type TxIndexerMetrics ¶
type TxIndexerMetrics struct{}
TxIndexerMetrics provides Prometheus implementation of TxIndexerMetrics interface
func (*TxIndexerMetrics) RecordIterationDuration ¶
func (tim *TxIndexerMetrics) RecordIterationDuration(chain common.Chain, duration float64)
RecordIterationDuration records the duration of a processing iteration
func (*TxIndexerMetrics) RecordProcessing ¶
func (tim *TxIndexerMetrics) RecordProcessing(chain common.Chain)
RecordProcessing records a processing attempt
func (*TxIndexerMetrics) RecordProcessingError ¶
func (tim *TxIndexerMetrics) RecordProcessingError(chain common.Chain, errorType string)
RecordProcessingError records a processing error
func (*TxIndexerMetrics) RecordRPCError ¶
func (tim *TxIndexerMetrics) RecordRPCError(chain common.Chain)
RecordRPCError records an RPC error
func (*TxIndexerMetrics) RecordTransactionStatus ¶
func (tim *TxIndexerMetrics) RecordTransactionStatus(chain common.Chain, status string)
RecordTransactionStatus records a transaction status change
func (*TxIndexerMetrics) SetActiveTransactions ¶
func (tim *TxIndexerMetrics) SetActiveTransactions(chain common.Chain, status string, count float64)
SetActiveTransactions sets the number of active transactions
func (*TxIndexerMetrics) SetChainHeight ¶
func (tim *TxIndexerMetrics) SetChainHeight(chain common.Chain, height float64)
SetChainHeight sets the current chain height
func (*TxIndexerMetrics) SetLastProcessingTimestamp ¶
func (tim *TxIndexerMetrics) SetLastProcessingTimestamp(timestamp float64)
SetLastProcessingTimestamp sets the timestamp of the last processing iteration
type WorkerMetrics ¶ added in v0.1.16
type WorkerMetrics struct{}
WorkerMetrics provides methods to update worker-related metrics
func NewWorkerMetrics ¶ added in v0.1.16
func NewWorkerMetrics() *WorkerMetrics
NewWorkerMetrics creates a new instance of WorkerMetrics
func (*WorkerMetrics) Handler ¶ added in v0.1.16
func (wm *WorkerMetrics) Handler(taskType string, handler asynq.HandlerFunc) asynq.HandlerFunc
Handler wraps a task handler with worker metrics collection
func (*WorkerMetrics) RecordError ¶ added in v0.1.16
func (wm *WorkerMetrics) RecordError(taskType, errorType string)
RecordError records an error during task processing
func (*WorkerMetrics) RecordTaskCompleted ¶ added in v0.1.16
func (wm *WorkerMetrics) RecordTaskCompleted(taskType string, duration float64)
RecordTaskCompleted records a successfully completed task
func (*WorkerMetrics) RecordTaskFailed ¶ added in v0.1.16
func (wm *WorkerMetrics) RecordTaskFailed(taskType string, duration float64)
RecordTaskFailed records a failed task
func (*WorkerMetrics) RecordTaskFinished ¶ added in v0.1.16
func (wm *WorkerMetrics) RecordTaskFinished(taskType string)
RecordTaskFinished records when a task finishes (decrements active count)
func (*WorkerMetrics) RecordTaskStarted ¶ added in v0.1.16
func (wm *WorkerMetrics) RecordTaskStarted(taskType string)
RecordTaskStarted records when a task starts (increments active count)
func (*WorkerMetrics) RecordVaultOperation ¶ added in v0.1.16
func (wm *WorkerMetrics) RecordVaultOperation(operation, status string, duration float64)
RecordVaultOperation records a vault operation (keygen, keysign, reshare)
type WorkerMetricsInterface ¶ added in v0.1.16
type WorkerMetricsInterface interface {
RecordTaskCompleted(taskType string, duration float64)
RecordTaskFailed(taskType string, duration float64)
RecordTaskStarted(taskType string)
RecordTaskFinished(taskType string)
RecordVaultOperation(operation, status string, duration float64)
RecordError(taskType, errorType string)
Handler(taskType string, handler asynq.HandlerFunc) asynq.HandlerFunc
}
WorkerMetricsInterface defines the contract for worker metrics