Documentation ¶
Index ¶
- Constants
- func RegisterJaeger(name string, cfg *config.TraceConfig) error
- func RegisterPrometheusEndpoint(cfg *config.MetricsConfig) error
- type Float64Timer
- 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
- type Int64Counter
- type Int64Gauge
- type JSONFormatter
- type Stopwatch
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 RegisterJaeger ¶
func RegisterJaeger(name string, cfg *config.TraceConfig) error
RegisterJaeger registers the jaeger endpoint with opencensus and names the tracer `name`.
func RegisterPrometheusEndpoint ¶
func RegisterPrometheusEndpoint(cfg *config.MetricsConfig) error
RegisterPrometheusEndpoint registers and serves prometheus metrics
Types ¶
type Float64Timer ¶
type Float64Timer struct {
// contains filtered or unexported fields
}
Float64Timer contains a opencensus measurement and view
func NewTimerMs ¶
func NewTimerMs(name, desc string, tagKeys ...tag.Key) *Float64Timer
NewTimerMs creates a Float64Timer with units of milliseconds and a default set of aggregation bounds for latencies up to a few seconds.
func NewTimerWithBuckets ¶
func NewTimerWithBuckets(name, desc, unit string, bounds []float64, tagKeys ...tag.Key) *Float64Timer
NewTimerWithBuckets creates a Float64Timer wrapping an opencensus float64 measurement.
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.
type Int64Counter ¶
type Int64Counter struct {
// contains filtered or unexported fields
}
Int64Counter wraps an opencensus int64 measure that is uses as a counter.
func NewInt64Counter ¶
func NewInt64Counter(name, desc string) *Int64Counter
NewInt64Counter creates a new Int64Counter with demensionless units.
type Int64Gauge ¶
type Int64Gauge struct {
// contains filtered or unexported fields
}
Int64Gauge wraps an opencensus int64 measure that is uses as a gauge.
func NewInt64Gauge ¶
func NewInt64Gauge(name, desc string, keys ...tag.Key) *Int64Gauge
NewInt64Gauge creates a new Int64Gauge with demensionless units.
type JSONFormatter ¶
type JSONFormatter struct { }
JSONFormatter implements go-logging Formatter for JSON encoded logs
func (*JSONFormatter) Format ¶
func (jf *JSONFormatter) Format(calldepth int, r *oldlogging.Record, w io.Writer) error
Format implements go-logging Formatter