Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Metrics names. MetricNameErrors = "doublezero_monitor_twozoracle_errors_total" MetricNameHealthNotHealthy = "doublezero_monitor_twozoracle_health_not_healthy_total" MetricNameSwapRate = "doublezero_monitor_twozoracle_swap_rate" MetricNameSOLPriceUSD = "doublezero_monitor_twozoracle_sol_price_usd" MetricNameTwoZPriceUSD = "doublezero_monitor_twozoracle_twoz_price_usd" MetricNameHealthResponse = "doublezero_monitor_twozoracle_health_responses_total" MetricNameSwapRateResponse = "doublezero_monitor_twozoracle_swap_rate_responses_total" // Labels. MetricLabelErrorType = "error_type" MetricLabelStatusCode = "status_code" // Error types. MetricErrorTypeGetHealth = "get_health" MetricErrorTypeGetSwapRate = "get_swap_rate" MetricErrorTypeParseSOLPriceUSD = "parse_sol_price_usd" MetricErrorTypeParseTwoZPriceUSD = "parse_twoz_price_usd" )
Variables ¶
View Source
var ( MetricErrors = promauto.NewCounterVec( prometheus.CounterOpts{ Name: MetricNameErrors, Help: "Number of errors encountered", }, []string{MetricLabelErrorType, MetricLabelStatusCode}, ) MetricHealthResponse = promauto.NewCounterVec( prometheus.CounterOpts{ Name: MetricNameHealthResponse, Help: "Number of health responses", }, []string{MetricLabelStatusCode}, ) MetricSwapRateResponse = promauto.NewCounterVec( prometheus.CounterOpts{ Name: MetricNameSwapRateResponse, Help: "Number of swap rate responses", }, []string{MetricLabelStatusCode}, ) MetricHealthNotHealthy = promauto.NewCounter( prometheus.CounterOpts{ Name: MetricNameHealthNotHealthy, Help: "Number of health not healthy", }, ) MetricSwapRate = promauto.NewGauge( prometheus.GaugeOpts{ Name: MetricNameSwapRate, Help: "Swap rate", }, ) MetricSOLPriceUSD = promauto.NewGauge( prometheus.GaugeOpts{ Name: MetricNameSOLPriceUSD, Help: "SOL price USD", }, ) MetricTwoZPriceUSD = promauto.NewGauge( prometheus.GaugeOpts{ Name: MetricNameTwoZPriceUSD, Help: "2Z price USD", }, ) )
Functions ¶
This section is empty.
Types ¶
type CircuitBreaker ¶
type Config ¶
type Config struct {
Logger *slog.Logger
Interval time.Duration
Client TwoZOracleClient
}
type HealthCheck ¶
type HealthResponse ¶
type HealthResponse struct {
Healthy bool `json:"healthy"`
HealthChecks []HealthCheck `json:"healthChecks"`
CircuitBreaker CircuitBreaker `json:"circuitBreaker"`
Timestamp string `json:"timestamp"`
}
type SwapRateResponse ¶
type TwoZOracleClient ¶
type TwoZOracleClient interface {
SwapRate(ctx context.Context) (SwapRateResponse, int, error)
Health(ctx context.Context) (HealthResponse, int, error)
}
func NewTwoZOracleClient ¶
func NewTwoZOracleClient(httpClient *http.Client, baseURL string) TwoZOracleClient
type TwoZOracleWatcher ¶
type TwoZOracleWatcher struct {
// contains filtered or unexported fields
}
func NewTwoZOracleWatcher ¶
func NewTwoZOracleWatcher(cfg *Config) (*TwoZOracleWatcher, error)
func (*TwoZOracleWatcher) Name ¶
func (w *TwoZOracleWatcher) Name() string
Click to show internal directories.
Click to hide internal directories.