Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Contracts ¶
type Contracts struct { Pending uint64 `json:"pending"` Active uint64 `json:"active"` Rejected uint64 `json:"rejected"` Failed uint64 `json:"failed"` Successful uint64 `json:"successful"` }
Contracts is a collection of metrics related to contracts.
type Data ¶
type Data struct { // Ingress returns the number of bytes received by the host. Ingress uint64 `json:"ingress"` // Egress returns the number of bytes sent by the host. Egress uint64 `json:"egress"` }
Data is a collection of metrics related to data usage.
type DataMetrics ¶
DataMetrics is a collection of metrics related to data usage.
type Interval ¶
type Interval uint8
Interval is the interval at which metrics should be aggregated.
const ( Interval15Minutes Interval = iota IntervalHourly IntervalDaily IntervalWeekly IntervalMonthly IntervalYearly )
intervals at which metrics should be aggregated.
func (*Interval) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type MetricManager ¶
type MetricManager struct {
// contains filtered or unexported fields
}
A MetricManager retrieves metrics from a store
func NewManager ¶
func NewManager(store Store) *MetricManager
NewManager returns a new MetricManager
func (*MetricManager) Metrics ¶
func (mm *MetricManager) Metrics(timestamp time.Time) (m Metrics, err error)
Metrics returns the current metrics for the host.
func (*MetricManager) PeriodMetrics ¶
func (mm *MetricManager) PeriodMetrics(start time.Time, periods int, interval Interval) ([]Metrics, error)
PeriodMetrics returns metrics for n periods starting at start.
type Metrics ¶
type Metrics struct { Revenue RevenueMetrics `json:"revenue"` Pricing Pricing `json:"pricing"` Contracts Contracts `json:"contracts"` Storage Storage `json:"storage"` Registry Registry `json:"registry"` Data DataMetrics `json:"data"` Balance types.Currency `json:"balance"` Timestamp time.Time `json:"timestamp"` }
Metrics is a collection of metrics for the host.
type Pricing ¶
type Pricing struct { ContractPrice types.Currency `json:"contractPrice"` IngressPrice types.Currency `json:"ingressPrice"` EgressPrice types.Currency `json:"egressPrice"` BaseRPCPrice types.Currency `json:"baseRPCPrice"` SectorAccessPrice types.Currency `json:"sectorAccessPrice"` StoragePrice types.Currency `json:"storagePrice"` CollateralMultiplier float64 `json:"collateralMultiplier"` }
Pricing is a collection of metrics related to the host's pricing settings.
type Registry ¶
type Registry struct { Entries uint64 `json:"entries"` MaxEntries uint64 `json:"maxEntries"` Reads uint64 `json:"reads"` Writes uint64 `json:"writes"` }
Registry is a collection of metrics related to the host's registry.
type Revenue ¶
type Revenue struct { RPC types.Currency `json:"rpc"` Storage types.Currency `json:"storage"` Ingress types.Currency `json:"ingress"` Egress types.Currency `json:"egress"` RegistryRead types.Currency `json:"registryRead"` RegistryWrite types.Currency `json:"registryWrite"` }
Revenue is a collection of metrics related to revenue.
type RevenueMetrics ¶
RevenueMetrics is a collection of metrics related to revenue.
type Storage ¶
type Storage struct { TotalSectors uint64 `json:"totalSectors"` PhysicalSectors uint64 `json:"physicalSectors"` ContractSectors uint64 `json:"contractSectors"` TempSectors uint64 `json:"tempSectors"` Reads uint64 `json:"reads"` Writes uint64 `json:"writes"` }
Storage is a collection of metrics related to storage.
type Store ¶
type Store interface { // PeriodMetrics returns metrics for n periods starting at start. PeriodMetrics(start time.Time, n int, interval Interval) (period []Metrics, err error) // Metrics returns aggregated metrics for the host as of the timestamp. Metrics(time.Time) (m Metrics, err error) }
A Store retrieves metrics