Documentation ¶
Index ¶
- Constants
- func RegisterPrometheusEndpoint(cfg *config.MetricsConfig) error
- func SetupJaegerTracing(serviceName string, cfg *config.TraceConfig) (*tracesdk.TracerProvider, error)
- func ShutdownJaeger(ctx context.Context, je *tracesdk.TracerProvider) error
- type Heartbeat
- type HeartbeatService
- func (hbs *HeartbeatService) Beat(ctx context.Context) Heartbeat
- func (hbs *HeartbeatService) Connect(ctx context.Context) error
- func (hbs *HeartbeatService) Run(ctx context.Context) error
- func (hbs *HeartbeatService) SetStream(s net.Stream)
- func (hbs *HeartbeatService) Start(ctx context.Context)
- func (hbs *HeartbeatService) Stream() net.Stream
- type HeartbeatServiceOption
Constants ¶
const (
HeartbeatProtocol = "fil/heartbeat/1.0.0"
)
HeartbeatProtocol is the libp2p protocol used for the heartbeat service
Variables ¶
This section is empty.
Functions ¶
func RegisterPrometheusEndpoint ¶
func RegisterPrometheusEndpoint(cfg *config.MetricsConfig) error
RegisterPrometheusEndpoint registers and serves prometheus metrics
func SetupJaegerTracing ¶ added in v1.13.0
func SetupJaegerTracing(serviceName string, cfg *config.TraceConfig) (*tracesdk.TracerProvider, error)
SetupJaegerTracing setups the jaeger endpoint and names the tracer.
func ShutdownJaeger ¶ added in v1.13.0
func ShutdownJaeger(ctx context.Context, je *tracesdk.TracerProvider) error
Types ¶
type Heartbeat ¶
type Heartbeat struct { // Head represents the heaviest tipset the nodes is mining on Head string // Height represents the current height of the Tipset Height abi.ChainEpoch // Nickname is the nickname given to the filecoin node by the user Nickname string // MinerAddress of this node's active miner. Can be empty - will return the zero address MinerAddress address.Address // CID of this chain's genesis block. GenesisCID cid.Cid }
Heartbeat contains the information required to determine the current state of a node. Heartbeats are used for aggregating information about nodes in a log aggregator to support alerting and devnet visualization.
type HeartbeatService ¶
type HeartbeatService struct { Host host.Host GenesisCID cid.Cid Config *config.HeartbeatConfig // A function that returns the heaviest tipset HeadGetter func() (types.TipSet, error) // A function that returns the miner's address MinerAddressGetter func() address.Address // contains filtered or unexported fields }
HeartbeatService is responsible for sending heartbeats.
func NewHeartbeatService ¶
func NewHeartbeatService(h host.Host, genesisCID cid.Cid, hbc *config.HeartbeatConfig, hg func() (types.TipSet, error), options ...HeartbeatServiceOption) *HeartbeatService
NewHeartbeatService returns a HeartbeatService
func (*HeartbeatService) Beat ¶
func (hbs *HeartbeatService) Beat(ctx context.Context) Heartbeat
Beat will create a heartbeat.
func (*HeartbeatService) Connect ¶
func (hbs *HeartbeatService) Connect(ctx context.Context) error
Connect will connects to `hbs.Config.BeatTarget` or returns an error
func (*HeartbeatService) Run ¶
func (hbs *HeartbeatService) Run(ctx context.Context) error
Run is called once the heartbeat service connects to the aggregator. Run send the actual heartbeat. Run will block until `ctx` is 'Done`. An error will be returned if Run encounters an error when sending the heartbeat and the connection to the aggregator will be closed.
func (*HeartbeatService) SetStream ¶
func (hbs *HeartbeatService) SetStream(s net.Stream)
SetStream sets the stream on the HeartbeatService. Safe for concurrent access.
func (*HeartbeatService) Start ¶
func (hbs *HeartbeatService) Start(ctx context.Context)
Start starts the heartbeat service by, starting the connection loop. The connection loop will attempt to connected to the aggregator service, once a successful connection is made with the aggregator service hearbeats will be sent to it. If the connection is broken the heartbeat service will attempt to reconnect via the connection loop. Start will not return until context `ctx` is 'Done'.
func (*HeartbeatService) Stream ¶
func (hbs *HeartbeatService) Stream() net.Stream
Stream returns the HeartbeatService stream. Safe for concurrent access. Stream is a libp2p connection that heartbeat messages are sent over to an aggregator.
type HeartbeatServiceOption ¶
type HeartbeatServiceOption func(service *HeartbeatService)
HeartbeatServiceOption is the type of the heartbeat service's functional options.
func WithMinerAddressGetter ¶
func WithMinerAddressGetter(ag func() address.Address) HeartbeatServiceOption
WithMinerAddressGetter returns an option that can be used to set the miner address getter.