worker

package
v0.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Metrics names.
	MetricNameBuildInfo = "doublezero_monitor_build_info"
	MetricNameErrors    = "doublezero_monitor_errors_total"

	// Labels.
	MetricLabelVersion   = "version"
	MetricLabelCommit    = "commit"
	MetricLabelDate      = "date"
	MetricLabelErrorType = "error_type"
)

Variables

View Source
var (
	MetricBuildInfo = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: MetricNameBuildInfo,
			Help: "Build information of the monitor agent",
		},
		[]string{MetricLabelVersion, MetricLabelCommit, MetricLabelDate},
	)

	MetricErrors = promauto.NewCounterVec(
		prometheus.CounterOpts{
			Name: MetricNameErrors,
			Help: "Number of errors encountered",
		},
		[]string{MetricLabelErrorType},
	)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger                     *slog.Logger
	LedgerRPCClient            LedgerRPCClient
	SolanaRPCClient            LedgerRPCClient
	Serviceability             ServiceabilityClient
	Telemetry                  TelemetryProgramClient
	InternetLatencyCollectorPK solana.PublicKey
	Interval                   time.Duration
	SlackWebhookURL            string
	TwoZOracleClient           twozoracle.TwoZOracleClient
	TwoZOracleInterval         time.Duration
	InfluxWriter               InfluxWriter
	Env                        string
}

func (*Config) Validate

func (c *Config) Validate() error

type InfluxWriter added in v0.7.2

type InfluxWriter interface {
	Errors() <-chan error
	WriteRecord(string)
	Flush()
}

type LedgerRPCClient

type LedgerRPCClient interface {
	GetEpochInfo(ctx context.Context, commitment solanarpc.CommitmentType) (*solanarpc.GetEpochInfoResult, error)
}

type ServiceabilityClient

type ServiceabilityClient interface {
	GetProgramData(context.Context) (*serviceability.ProgramData, error)
}

type TelemetryProgramClient

type TelemetryProgramClient interface {
	GetDeviceLatencySamples(ctx context.Context, originDevicePubKey, targetDevicePubKey, linkPubKey solana.PublicKey, epoch uint64) (*telemetry.DeviceLatencySamples, error)
	GetInternetLatencySamples(ctx context.Context, dataProviderName string, originExchangePubKey, targetExchangePubKey, linkPubKey solana.PublicKey, epoch uint64) (*telemetry.InternetLatencySamples, error)
}

type Watcher

type Watcher interface {
	Name() string
	Run(ctx context.Context) error
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) (*Worker, error)

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL