metric

package
v1.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultJsonrpcDurationsSize   = 20000
	DefaultJsonrpcDurationsExpire = 10 * time.Second
)
View Source
const (
	TxTypePatch  = "patch"
	TxTypeNormal = "normal"
)

Variables

View Source
var (
	MetricKeyHostname = NewMetricKey("hostname")
	MetricKeyChain    = NewMetricKey("channel")
)

metric common tag key

Functions

func BeforeExport added in v1.2.0

func BeforeExport()

func DefaultMetricContext

func DefaultMetricContext() context.Context

func GetCIDFromMetricContext added in v1.2.0

func GetCIDFromMetricContext(ctx context.Context) (int, bool)

func GetMetricContext

func GetMetricContext(p context.Context, mk *tag.Key, v string) context.Context

func GetMetricContextByCID

func GetMetricContextByCID(cid int) context.Context

func Initialize

func Initialize(w module.Wallet)

func Inspect

func Inspect(c module.Chain, informal bool) map[string]interface{}

func NewMetricKey

func NewMetricKey(k string) tag.Key

func ParseMetricData

func ParseMetricData(r *view.Row, prev interface{}, cnt int) interface{}

func PrometheusExporter

func PrometheusExporter() *prometheus.Exporter

func RegisterBeforeExportFunc added in v1.2.0

func RegisterBeforeExportFunc(f func())

func RegisterConsensus

func RegisterConsensus()

func RegisterJsonrpc added in v1.2.0

func RegisterJsonrpc()

func RegisterMetricView

func RegisterMetricView(m stats.Measure, a *view.Aggregation, tks []tag.Key) *view.View

func RegisterNetwork

func RegisterNetwork()

func RegisterTransaction

func RegisterTransaction()

func RemoveMetricContext

func RemoveMetricContext(mk *tag.Key, v string)

func RemoveMetricContextByCID

func RemoveMetricContextByCID(cid int)

func ResetMetricViews

func ResetMetricViews()

Types

type ConsensusMetric

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

func NewConsensusMetric

func NewConsensusMetric(ctx context.Context) *ConsensusMetric

func (*ConsensusMetric) OnHeight

func (m *ConsensusMetric) OnHeight(height int64)

func (*ConsensusMetric) OnRound

func (m *ConsensusMetric) OnRound(round int32)

type Duration added in v1.2.0

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

type Durations added in v1.2.0

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

func NewDurations added in v1.2.0

func NewDurations(size int) *Durations

func (*Durations) Add added in v1.2.0

func (ds *Durations) Add(ts time.Time) *Duration

func (*Durations) Avg added in v1.2.0

func (ds *Durations) Avg() time.Duration

func (*Durations) Count added in v1.2.0

func (ds *Durations) Count() int

func (*Durations) Remove added in v1.2.0

func (ds *Durations) Remove(expire time.Duration)

func (*Durations) Size added in v1.2.0

func (ds *Durations) Size() int

func (*Durations) Sum added in v1.2.0

func (ds *Durations) Sum() int64

type JsonrpcMeasure added in v1.2.0

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

func (*JsonrpcMeasure) Remove added in v1.2.0

func (m *JsonrpcMeasure) Remove(expire time.Duration)

func (*JsonrpcMeasure) RemoveAndRecord added in v1.2.0

func (m *JsonrpcMeasure) RemoveAndRecord(ctx context.Context, ts time.Time, expire time.Duration)

type JsonrpcMetric added in v1.2.0

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

func NewJsonrpcMetric added in v1.2.0

func NewJsonrpcMetric(expire time.Duration, durationsSize int, useDefault bool) *JsonrpcMetric

func (*JsonrpcMetric) EnsureMeasure added in v1.2.0

func (m *JsonrpcMetric) EnsureMeasure(ctx context.Context, ms *measure) *JsonrpcMeasure

func (*JsonrpcMetric) OnHandle added in v1.2.0

func (m *JsonrpcMetric) OnHandle(ctx context.Context, method string, ts time.Time, err error)

func (*JsonrpcMetric) Remove added in v1.2.0

func (m *JsonrpcMetric) Remove()

type NetworkMetric

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

func NewNetworkMetric

func NewNetworkMetric(ctx context.Context) *NetworkMetric

func (*NetworkMetric) OnRecv

func (m *NetworkMetric) OnRecv(dest byte, ttl byte, hint byte, protocol uint16, pktLen uint32)

func (*NetworkMetric) OnSend

func (m *NetworkMetric) OnSend(dest byte, ttl byte, hint byte, protocol uint16, pktLen uint32)

type TxMetric

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

func NewTransactionMetric

func NewTransactionMetric(ctx context.Context, t string) *TxMetric

func (*TxMetric) OnAddTx

func (c *TxMetric) OnAddTx(n int, user bool)

func (*TxMetric) OnCommit

func (c *TxMetric) OnCommit(hash []byte, ts time.Time, d time.Duration)

func (*TxMetric) OnDropTx

func (c *TxMetric) OnDropTx(n int, user bool)

func (*TxMetric) OnFinalize

func (c *TxMetric) OnFinalize(hash []byte, ts time.Time)

func (*TxMetric) OnRemoveTx

func (c *TxMetric) OnRemoveTx(n int, user bool)

Jump to

Keyboard shortcuts

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