Help us shape the future of Go! Take the 2026 Go Developer Survey

worker

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: Apache-2.0 Imports: 12 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
	Serviceability             ServiceabilityClient
	Telemetry                  TelemetryProgramClient
	InternetLatencyCollectorPK solana.PublicKey
	Interval                   time.Duration
}

func (*Config) Validate

func (c *Config) Validate() error

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