data

package
v0.8.0 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: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxPoints = 1000
)

Variables

View Source
var (
	ErrInvalidEnvironment = fmt.Errorf("invalid environment")
)

Functions

func NewProvider

func NewProvider(cfg *ProviderConfig) (*provider, error)

Types

type Circuit

type Circuit struct {
	Code         string `json:"code"`
	OriginDevice Device `json:"origin_device"`
	TargetDevice Device `json:"target_device"`
	Link         Link   `json:"link"`
}

type CircuitLatenciesWithHeader

type CircuitLatenciesWithHeader struct {
	Header  *telemetry.DeviceLatencySamplesHeader
	Samples []datastats.CircuitLatencySample
}

type CircuitSummary added in v0.6.3

type CircuitSummary struct {
	Circuit         string `json:"circuit"`
	LinkType        string `json:"link_type"`
	ContributorCode string `json:"contributor_code"`

	stats.CircuitLatencyStat `json:",inline"`
	CommittedRTT             float64 `json:"committed_rtt"`
	CommittedJitter          float64 `json:"committed_jitter"`

	// Committed RTT and jitter deltas calculated as: committed - measured
	// Positive values mean the measured values are greater than the committed values.
	CommittedRTTDelta    float64 `json:"committed_rtt_delta"`
	CommittedJitterDelta float64 `json:"committed_jitter_delta"`

	// Committed RTT and jitter change ratios calcuated as: committed - measured / committed
	// Positive values mean the measured values are greater than the committed values.
	CommittedRTTChangeRatio    float64 `json:"committed_rtt_change_ratio"`
	CommittedJitterChangeRatio float64 `json:"committed_jitter_change_ratio"`
}

type Device

type Device struct {
	PK       solana.PublicKey `json:"pk"`
	Code     string           `json:"code"`
	Location Location         `json:"location"`
}

type EpochRange

type EpochRange struct {
	From uint64
	To   uint64
}

func (*EpochRange) String

func (e *EpochRange) String() string

type GetCircuitLatenciesConfig

type GetCircuitLatenciesConfig struct {
	Epochs    *EpochRange
	Time      *TimeRange
	Interval  time.Duration
	MaxPoints uint64
	Unit      Unit
	Circuit   string
}

type GetSummaryForCircuitsConfig added in v0.6.3

type GetSummaryForCircuitsConfig struct {
	Epochs   *EpochRange
	Time     *TimeRange
	Unit     Unit
	Circuits []string
}
type Link struct {
	PK              solana.PublicKey `json:"pk"`
	Code            string           `json:"code"`
	LinkType        string           `json:"link_type"`
	ContributorCode string           `json:"contributor_code"`

	// Committed RTT and jitter are in microseconds.
	CommittedRTT    float64 `json:"committed_rtt"`
	CommittedJitter float64 `json:"committed_jitter"`
}

type Location

type Location struct {
	PK        solana.PublicKey `json:"pk"`
	Name      string           `json:"name"`
	Country   string           `json:"country"`
	Latitude  float64          `json:"latitude"`
	Longitude float64          `json:"longitude"`
}

type Provider

type Provider interface {
	GetCircuits(ctx context.Context) ([]Circuit, error)
	GetCircuitLatencies(ctx context.Context, cfg GetCircuitLatenciesConfig) ([]stats.CircuitLatencyStat, error)
	GetSummaryForCircuits(ctx context.Context, cfg GetSummaryForCircuitsConfig) ([]CircuitSummary, error)
}

type ProviderConfig

type ProviderConfig struct {
	Logger               *slog.Logger
	ServiceabilityClient ServiceabilityClient
	TelemetryClient      TelemetryClient
	EpochFinder          epoch.Finder

	CircuitsCacheTTL               time.Duration
	HistoricEpochLatenciesCacheTTL time.Duration
	CurrentEpochLatenciesCacheTTL  time.Duration
	GetCircuitLatenciesPoolSize    int
}

func (*ProviderConfig) Validate

func (c *ProviderConfig) Validate() error

type Server

type Server struct {
	Mux *http.ServeMux
	// contains filtered or unexported fields
}

func NewServer

func NewServer(log *slog.Logger, mainnetProvider, testnetProvider, devnetProvider Provider) (*Server, error)

type ServiceabilityClient

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

type TelemetryClient

type TelemetryClient interface {
	GetDeviceLatencySamples(ctx context.Context, originDevicePubKey, targetDevicePubKey, linkPubKey solana.PublicKey, epoch uint64) (*telemetry.DeviceLatencySamples, error)
}

type TimeRange

type TimeRange struct {
	From time.Time
	To   time.Time
}

func (*TimeRange) String

func (t *TimeRange) String() string

type Unit

type Unit string
const (
	UnitMillisecond Unit = "ms"
	UnitMicrosecond Unit = "us"
)

Jump to

Keyboard shortcuts

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