Documentation ¶
Index ¶
Constants ¶
const (
// StatusLabel is the label used for the status of a provider response.
StatusLabel = "status"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionStatus ¶
type ConnectionStatus int
ConnectionStatus is a type that represents the status of a connection.
const ( // DialErr indicates that the provider could not establish a connection. DialErr ConnectionStatus = iota // DialSuccess indicates that the provider successfully established a connection. DialSuccess // WriteErr indicates that the provider could not write the message to the data provider. WriteErr // WriteSuccess indicates that the provider successfully wrote the message to the data provider. WriteSuccess // ReadErr indicates that the provider could not read the message from the data provider. ReadErr // ReadSuccess indicates that the provider successfully read the message from the data provider. ReadSuccess // CloseErr indicates that the provider could not close the connection. CloseErr // CloseSuccess indicates that the provider successfully closed the connection. CloseSuccess // Healthy indicates that the provider is healthy. Healthy // Unhealthy indicates that the provider is unhealthy. Unhealthy )
func (ConnectionStatus) String ¶
func (s ConnectionStatus) String() string
String returns a string representation of the connection status.
type HandlerStatus ¶
type HandlerStatus int
HandlerStatus is a type that represents the status of a data handler.
const ( // CreateMessageErr indicates that the provider could not construct a valid message to send // to the data provider. CreateMessageErr HandlerStatus = iota // CreateMessageSuccess indicates that the provider successfully constructed a valid message // to send to the data provider. CreateMessageSuccess // HandleMessageErr indicates that the provider could not handle the message from the data // provider. HandleMessageErr // HandleMessageSuccess indicates that the provider successfully handled the message from the // data provider. HandleMessageSuccess // HeartBeatSuccess indicates that the provider successfully constructed a heartbeat message // to send to the data provider. HeartBeatSuccess // HeartBeatErr indicates that the provider could not construct a heartbeat message to send // to the data provider. HeartBeatErr // Unknown indicates that the provider encountered an unknown error. Unknown )
func (HandlerStatus) String ¶
func (s HandlerStatus) String() string
String returns a string representation of the handler status.
type WebSocketMetrics ¶
type WebSocketMetrics interface { // AddWebSocketConnectionStatus adds a method / status response to the metrics collector for the // given provider. Specifically, this tracks various connection related errors. AddWebSocketConnectionStatus(provider string, status ConnectionStatus) // AddWebSocketDataHandlerStatus adds a method / status response to the metrics collector for the // given provider. Specifically, this tracks various data handler related errors. AddWebSocketDataHandlerStatus(provider string, status HandlerStatus) // ObserveWebSocketLatency adds a latency observation to the metrics collector for the // given provider. ObserveWebSocketLatency(provider string, duration time.Duration) }
WebSocketMetrics is an interface that defines the API for metrics collection for providers that implement the WebSocketQueryHandler.
func NewNopWebSocketMetrics ¶
func NewNopWebSocketMetrics() WebSocketMetrics
NewNopWebSocketMetrics returns a Provider Metrics implementation that does not collect metrics.
func NewWebSocketMetrics ¶
func NewWebSocketMetrics() WebSocketMetrics
NewWebSocketMetrics returns a Provider Metrics implementation that uses Prometheus.
func NewWebSocketMetricsFromConfig ¶
func NewWebSocketMetricsFromConfig(config config.MetricsConfig) WebSocketMetrics
NewWebSocketMetricsFromConfig returns a new Metrics struct given the main oracle metrics config.
type WebSocketMetricsImpl ¶
type WebSocketMetricsImpl struct {
// contains filtered or unexported fields
}
WebSocketMetricsImpl contains metrics exposed by this package.
func (*WebSocketMetricsImpl) AddWebSocketConnectionStatus ¶
func (m *WebSocketMetricsImpl) AddWebSocketConnectionStatus(provider string, status ConnectionStatus)
AddWebSocketConnectionStatus adds a method / status response to the metrics collector for the given provider. Specifically, this tracks various connection related errors.
func (*WebSocketMetricsImpl) AddWebSocketDataHandlerStatus ¶
func (m *WebSocketMetricsImpl) AddWebSocketDataHandlerStatus(provider string, status HandlerStatus)
AddWebSocketDataHandlerStatus adds a method / status response to the metrics collector for the given provider. Specifically, this tracks various data handler related errors.
func (*WebSocketMetricsImpl) ObserveWebSocketLatency ¶
func (m *WebSocketMetricsImpl) ObserveWebSocketLatency(provider string, duration time.Duration)
ObserveWebSocketLatency adds a latency observation to the metrics collector for the given provider.