metrics

package
v0.0.0-...-fe3dd8e Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CostSendXch     = 9401710
	CostSendCat     = 36382111
	CostTransferNFT = 74385541
	CostTakeOffer   = 721393265
)

Fee data is based on the estimates here https://github.com/Chia-Network/chia-blockchain/blob/37fcafa0d31358f6ff7276a78764a0cc7ffeb030/chia/rpc/full_node_rpc_api.py#L754

View Source
const (
	// PlotTypeOg is the original plot format, no plotNFT
	PlotTypeOg = PlotType(0)
	// PlotTypePool is the new plotNFT plot format
	PlotTypePool = PlotType(1)
)

Variables

This section is empty.

Functions

func PlotSizeCountHelper

func PlotSizeCountHelper(plots []protocols.Plot) (map[uint8]map[uint8]map[PlotType]uint64, map[uint8]map[uint8]map[PlotType]uint64)

PlotSizeCountHelper returns information about plot sizes and counts for the given set of plots Return is (plotSize, plotCount)

Types

type ASNRecord

type ASNRecord struct {
	AutonomousSystemNumber       uint32 `maxminddb:"autonomous_system_number"`
	AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"`
}

ASNRecord record of a country from maxmind

type Country

type Country struct {
	ISOCode string            `maxminddb:"iso_code"`
	Names   map[string]string `maxminddb:"names"`
}

Country record of country data from maxmind record

type CountryRecord

type CountryRecord struct {
	Country Country `maxminddb:"country"`
}

CountryRecord record of a country from maxmind

type CrawlerServiceMetrics

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

CrawlerServiceMetrics contains all metrics related to the crawler

func (*CrawlerServiceMetrics) Disconnected

func (s *CrawlerServiceMetrics) Disconnected()

Disconnected clears/unregisters metrics when the connection drops

func (*CrawlerServiceMetrics) GetASNForIP

func (s *CrawlerServiceMetrics) GetASNForIP(ipStr string) (*ASNRecord, error)

GetASNForIP Gets ASN data for an ip address

func (*CrawlerServiceMetrics) GetCountryForIP

func (s *CrawlerServiceMetrics) GetCountryForIP(ipStr string) (*CountryRecord, error)

GetCountryForIP Gets country data for an ip address

func (*CrawlerServiceMetrics) GetIPsAfterTimestamp

func (s *CrawlerServiceMetrics) GetIPsAfterTimestamp(ips *rpc.GetIPsAfterTimestampResponse)

GetIPsAfterTimestamp processes a response of IPs seen since a timestamp Currently assumes all IPs will be in one response

func (*CrawlerServiceMetrics) GetPeerCounts

func (s *CrawlerServiceMetrics) GetPeerCounts(resp *types.WebsocketResponse)

GetPeerCounts handles a response from get_peer_counts

func (*CrawlerServiceMetrics) InitMetrics

func (s *CrawlerServiceMetrics) InitMetrics(network *string)

InitMetrics sets all the metrics properties

func (*CrawlerServiceMetrics) InitialData

func (s *CrawlerServiceMetrics) InitialData()

InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data

func (*CrawlerServiceMetrics) ProcessIPASNMapping

func (s *CrawlerServiceMetrics) ProcessIPASNMapping(ips *rpc.GetIPsAfterTimestampResponse)

ProcessIPASNMapping Processes the list of IPs to ASNs

func (*CrawlerServiceMetrics) ProcessIPCountryMapping

func (s *CrawlerServiceMetrics) ProcessIPCountryMapping(ips *rpc.GetIPsAfterTimestampResponse)

ProcessIPCountryMapping Processes the list of IPs to countries

func (*CrawlerServiceMetrics) ReceiveResponse

func (s *CrawlerServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)

ReceiveResponse handles crawler responses that are returned over the websocket

func (*CrawlerServiceMetrics) Reconnected

func (s *CrawlerServiceMetrics) Reconnected()

Reconnected is called when the service is reconnected after the websocket was disconnected

func (*CrawlerServiceMetrics) SetupPollingMetrics

func (s *CrawlerServiceMetrics) SetupPollingMetrics()

SetupPollingMetrics starts any metrics that happen on an interval

func (*CrawlerServiceMetrics) StartIPMapping

func (s *CrawlerServiceMetrics) StartIPMapping(limit uint)

StartIPMapping starts the process to fetch current IPs from the crawler when a response is received, the IPs are mapped to countries and/or ASNs using maxmind, if databases are provided Updates metrics value once all pages have been received

type FarmerServiceMetrics

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

FarmerServiceMetrics contains all metrics related to the harvester

func (*FarmerServiceMetrics) Disconnected

func (s *FarmerServiceMetrics) Disconnected()

Disconnected clears/unregisters metrics when the connection drops

func (*FarmerServiceMetrics) GetConnections

func (s *FarmerServiceMetrics) GetConnections(resp *types.WebsocketResponse)

GetConnections handler for get_connections events

func (*FarmerServiceMetrics) GetHarvesters

func (s *FarmerServiceMetrics) GetHarvesters()

GetHarvesters loads data about harvesters connected to the farmer

func (*FarmerServiceMetrics) InitMetrics

func (s *FarmerServiceMetrics) InitMetrics(network *string)

InitMetrics sets all the metrics properties

func (*FarmerServiceMetrics) InitialData

func (s *FarmerServiceMetrics) InitialData()

InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data

func (*FarmerServiceMetrics) NewFarmingInfo

func (s *FarmerServiceMetrics) NewFarmingInfo(resp *types.WebsocketResponse)

NewFarmingInfo handles new_farming_info events

func (*FarmerServiceMetrics) Proof

Proof handles a received `proof` event from the farmer

func (*FarmerServiceMetrics) ReceiveResponse

func (s *FarmerServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)

ReceiveResponse handles crawler responses that are returned over the websocket

func (*FarmerServiceMetrics) Reconnected

func (s *FarmerServiceMetrics) Reconnected()

Reconnected is called when the service is reconnected after the websocket was disconnected

func (*FarmerServiceMetrics) SetupPollingMetrics

func (s *FarmerServiceMetrics) SetupPollingMetrics()

SetupPollingMetrics starts any metrics that happen on an interval

func (*FarmerServiceMetrics) SubmittedPartial

func (s *FarmerServiceMetrics) SubmittedPartial(resp *types.WebsocketResponse)

SubmittedPartial handles a received submitted_partial event

type FullNodeServiceMetrics

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

FullNodeServiceMetrics contains all metrics related to the full node

func (*FullNodeServiceMetrics) Block

Block handler for block events

func (*FullNodeServiceMetrics) Disconnected

func (s *FullNodeServiceMetrics) Disconnected()

Disconnected clears/unregisters metrics when the connection drops

func (*FullNodeServiceMetrics) GetBlockCountMetrics

func (s *FullNodeServiceMetrics) GetBlockCountMetrics(resp *types.WebsocketResponse)

GetBlockCountMetrics updates count metrics when we receive a response to get_block_count_metrics We ask for this data every time we get a new `block` event

func (*FullNodeServiceMetrics) GetBlockchainState

func (s *FullNodeServiceMetrics) GetBlockchainState(resp *types.WebsocketResponse)

GetBlockchainState handler for get_blockchain_state events

func (*FullNodeServiceMetrics) GetConnections

func (s *FullNodeServiceMetrics) GetConnections(resp *types.WebsocketResponse)

GetConnections handler for get_connections events

func (*FullNodeServiceMetrics) GetFeeEstimates

func (s *FullNodeServiceMetrics) GetFeeEstimates()

GetFeeEstimates gets fee estimates for the main costs we're estimating, for 1, 5, 15 minute windows We do this via http requests via async on the websocket since the fee estimate response doesn't indicate which cost the estimate is for

func (*FullNodeServiceMetrics) InitMetrics

func (s *FullNodeServiceMetrics) InitMetrics(network *string)

InitMetrics sets all the metrics properties

func (*FullNodeServiceMetrics) InitialData

func (s *FullNodeServiceMetrics) InitialData()

InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data

func (*FullNodeServiceMetrics) ReceiveResponse

func (s *FullNodeServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)

ReceiveResponse handles full node related responses that are returned over the websocket

func (*FullNodeServiceMetrics) Reconnected

func (s *FullNodeServiceMetrics) Reconnected()

Reconnected is called when the service is reconnected after the websocket was disconnected

func (*FullNodeServiceMetrics) RefreshFileSizes

func (s *FullNodeServiceMetrics) RefreshFileSizes()

RefreshFileSizes periodically checks how large files related to the full node are

func (*FullNodeServiceMetrics) SetupPollingMetrics

func (s *FullNodeServiceMetrics) SetupPollingMetrics()

SetupPollingMetrics starts any metrics that happen on an interval

func (*FullNodeServiceMetrics) SignagePoint

func (s *FullNodeServiceMetrics) SignagePoint(resp *types.WebsocketResponse)

SignagePoint handles signage point metrics

type HarvesterServiceMetrics

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

HarvesterServiceMetrics contains all metrics related to the harvester

func (*HarvesterServiceMetrics) Disconnected

func (s *HarvesterServiceMetrics) Disconnected()

Disconnected clears/unregisters metrics when the connection drops

func (*HarvesterServiceMetrics) FarmingInfo

func (s *HarvesterServiceMetrics) FarmingInfo(resp *types.WebsocketResponse)

FarmingInfo handles the farming_info event from the harvester

func (*HarvesterServiceMetrics) GetConnections

func (s *HarvesterServiceMetrics) GetConnections(resp *types.WebsocketResponse)

GetConnections handler for get_connections events

func (*HarvesterServiceMetrics) GetPlots

func (s *HarvesterServiceMetrics) GetPlots(resp *types.WebsocketResponse)

GetPlots handles a get_plots rpc response

func (*HarvesterServiceMetrics) InitMetrics

func (s *HarvesterServiceMetrics) InitMetrics(network *string)

InitMetrics sets all the metrics properties

func (*HarvesterServiceMetrics) InitialData

func (s *HarvesterServiceMetrics) InitialData()

InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data

func (*HarvesterServiceMetrics) ProcessGetPlots

func (s *HarvesterServiceMetrics) ProcessGetPlots(plots *rpc.HarvesterGetPlotsResponse)

ProcessGetPlots processes the `GetPlotsResponse` from get_plots so that we can use this with websockets or HTTP RPC requests

func (*HarvesterServiceMetrics) ReceiveResponse

func (s *HarvesterServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)

ReceiveResponse handles crawler responses that are returned over the websocket

func (*HarvesterServiceMetrics) Reconnected

func (s *HarvesterServiceMetrics) Reconnected()

Reconnected is called when the service is reconnected after the websocket was disconnected

func (*HarvesterServiceMetrics) SetupPollingMetrics

func (s *HarvesterServiceMetrics) SetupPollingMetrics()

SetupPollingMetrics starts any metrics that happen on an interval

type Metrics

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

Metrics is the main entrypoint

func NewMetrics

func NewMetrics(port uint16, logLevel log.Level) (*Metrics, error)

NewMetrics returns a new instance of metrics All metrics are registered here

func (*Metrics) CloseWebsocket

func (m *Metrics) CloseWebsocket() error

CloseWebsocket closes the websocket connection

func (*Metrics) DeleteASNRecords

func (m *Metrics) DeleteASNRecords(networkName string) error

DeleteASNRecords deletes all records from the asn table in the database

func (*Metrics) OpenWebsocket

func (m *Metrics) OpenWebsocket() error

OpenWebsocket sets up the RPC client and subscribes to relevant topics

func (*Metrics) StartServer

func (m *Metrics) StartServer() error

StartServer starts the metrics server

type PlotType

type PlotType uint8

PlotType is the type of plot (og or pool)

type TimelordServiceMetrics

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

TimelordServiceMetrics contains all metrics related to the crawler

func (*TimelordServiceMetrics) Disconnected

func (s *TimelordServiceMetrics) Disconnected()

Disconnected clears/unregisters metrics when the connection drops

func (*TimelordServiceMetrics) FinishedPoT

func (s *TimelordServiceMetrics) FinishedPoT(resp *types.WebsocketResponse)

FinishedPoT Handles new PoT Challenge Events

func (*TimelordServiceMetrics) InitMetrics

func (s *TimelordServiceMetrics) InitMetrics(network *string)

InitMetrics sets all the metrics properties

func (*TimelordServiceMetrics) InitialData

func (s *TimelordServiceMetrics) InitialData()

InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data

func (*TimelordServiceMetrics) NewCompactProof

func (s *TimelordServiceMetrics) NewCompactProof(resp *types.WebsocketResponse)

NewCompactProof Handles new compact proof events

func (*TimelordServiceMetrics) NewPeak

NewPeak Not the fastest :(

func (*TimelordServiceMetrics) ReceiveResponse

func (s *TimelordServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)

ReceiveResponse handles crawler responses that are returned over the websocket

func (*TimelordServiceMetrics) Reconnected

func (s *TimelordServiceMetrics) Reconnected()

Reconnected is called when the service is reconnected after the websocket was disconnected

func (*TimelordServiceMetrics) SetupPollingMetrics

func (s *TimelordServiceMetrics) SetupPollingMetrics()

SetupPollingMetrics starts any metrics that happen on an interval

func (*TimelordServiceMetrics) SkippingPeak

func (s *TimelordServiceMetrics) SkippingPeak(resp *types.WebsocketResponse)

SkippingPeak Fastest!

type WalletServiceMetrics

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

WalletServiceMetrics contains all metrics related to the wallet

func (*WalletServiceMetrics) CoinAdded

func (s *WalletServiceMetrics) CoinAdded(resp *types.WebsocketResponse)

CoinAdded handles coin_added events by asking for wallet balance details

func (*WalletServiceMetrics) Disconnected

func (s *WalletServiceMetrics) Disconnected()

Disconnected clears/unregisters metrics when the connection drops

func (*WalletServiceMetrics) GetConnections

func (s *WalletServiceMetrics) GetConnections(resp *types.WebsocketResponse)

GetConnections handler for get_connections events

func (*WalletServiceMetrics) GetSyncStatus

func (s *WalletServiceMetrics) GetSyncStatus(resp *types.WebsocketResponse)

GetSyncStatus sync status for the wallet

func (*WalletServiceMetrics) GetWalletBalance

func (s *WalletServiceMetrics) GetWalletBalance(resp *types.WebsocketResponse)

GetWalletBalance updates wallet balance metrics in response to balance changes

func (*WalletServiceMetrics) GetWallets

func (s *WalletServiceMetrics) GetWallets(resp *types.WebsocketResponse)

GetWallets handles a response for get_wallets and asks for the balance of each wallet

func (*WalletServiceMetrics) InitMetrics

func (s *WalletServiceMetrics) InitMetrics(network *string)

InitMetrics sets all the metrics properties

func (*WalletServiceMetrics) InitialData

func (s *WalletServiceMetrics) InitialData()

InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data

func (*WalletServiceMetrics) ReceiveResponse

func (s *WalletServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)

ReceiveResponse handles wallet responses that are returned over the websocket

func (*WalletServiceMetrics) Reconnected

func (s *WalletServiceMetrics) Reconnected()

Reconnected is called when the service is reconnected after the websocket was disconnected

func (*WalletServiceMetrics) SetupPollingMetrics

func (s *WalletServiceMetrics) SetupPollingMetrics()

SetupPollingMetrics starts any metrics that happen on an interval

func (*WalletServiceMetrics) SyncChanged

func (s *WalletServiceMetrics) SyncChanged(resp *types.WebsocketResponse)

SyncChanged handles the sync_changed event from the websocket

Jump to

Keyboard shortcuts

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