metrics

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// common
	Version, _  = tag.NewKey("version")
	Commit, _   = tag.NewKey("commit")
	NodeType, _ = tag.NewKey("node_type")
	PeerID, _   = tag.NewKey("peer_id")

	// rcmgr
	ServiceID, _  = tag.NewKey("svc")
	ProtocolID, _ = tag.NewKey("proto")
	Direction, _  = tag.NewKey("direction")
	UseFD, _      = tag.NewKey("use_fd")
	Op, _         = tag.NewKey("op")
)

Global Tags

View Source
var (
	// common
	LotusInfo          = stats.Int64("info", "Arbitrary counter to tag lotus info to", stats.UnitDimensionless)
	PeerCount          = stats.Int64("peer/count", "Current number of FIL peers", stats.UnitDimensionless)
	APIRequestDuration = stats.Float64("api/request_duration_ms", "Duration of API requests", stats.UnitMilliseconds)

	// rcmgr
	RcmgrConn   = stats.Int64("rcmgr/conn", "Number of connections", stats.UnitDimensionless)
	RcmgrStream = stats.Int64("rcmgr/stream", "Number of allowed streams", stats.UnitDimensionless)
	RcmgrPeer   = stats.Int64("rcmgr/peer", "Number of peers", stats.UnitDimensionless)
	RcmgrProto  = stats.Int64("rcmgr/proto", "Number of allowed streams attached to a protocol", stats.UnitDimensionless)
	RcmgrSvc    = stats.Int64("rcmgr/svc", "Number of streams attached to a service", stats.UnitDimensionless)
	RcmgrMem    = stats.Int64("rcmgr/mem", "Number of memory reservations", stats.UnitDimensionless)
)

Measures

View Source
var (
	InfoView = &view.View{
		Name:        "info",
		Description: "Lotus node information",
		Measure:     LotusInfo,
		Aggregation: view.LastValue(),
		TagKeys:     []tag.Key{Version, Commit, NodeType},
	}

	// rcmgr
	RcmgrConnView = &view.View{
		Measure:     RcmgrConn,
		Aggregation: view.Count(),
		TagKeys:     []tag.Key{Direction, UseFD, Op},
	}

	RcmgrStreamView = &view.View{
		Measure:     RcmgrStream,
		Aggregation: view.Count(),
		TagKeys:     []tag.Key{Direction, UseFD, Op},
	}

	RcmgrPeerView = &view.View{
		Measure:     RcmgrPeer,
		Aggregation: view.Count(),
		TagKeys:     []tag.Key{Op},
	}

	RcmgrProtoView = &view.View{
		Measure:     RcmgrProto,
		Aggregation: view.Count(),
		TagKeys:     []tag.Key{ProtocolID, Op},
	}

	RcmgrSvcView = &view.View{
		Measure:     RcmgrSvc,
		Aggregation: view.Count(),
		TagKeys:     []tag.Key{ServiceID, Op},
	}

	RcmgrMemView = &view.View{
		Measure:     RcmgrMem,
		Aggregation: view.Count(),
	}
)
View Source
var DefaultViews = func() []*view.View {
	views := []*view.View{
		InfoView,
		RcmgrConnView,
		RcmgrStreamView,
		RcmgrPeerView,
		RcmgrProtoView,
		RcmgrSvcView,
		RcmgrMemView,
	}
	views = append(views, blockstore.DefaultViews...)
	views = append(views, rpcmetrics.DefaultViews...)
	return views
}()

DefaultViews is an array of OpenCensus views for metric gathering purposes

Functions

func Exporter

func Exporter() http.Handler

func NewJaegerTraceProvider

func NewJaegerTraceProvider(serviceName, agentEndpoint string, sampleRatio float64) (*sdktrace.TracerProvider, error)

NewJaegerTraceProvider returns a new and configured TracerProvider backed by Jaeger. based on https://github.com/open-telemetry/opentelemetry-go/blob/v0.20.0/example/jaeger/main.go

func SinceInMilliseconds

func SinceInMilliseconds(startTime time.Time) float64

SinceInMilliseconds returns the duration of time since the provide time as a float64.

func Timer

func Timer(ctx context.Context, m *stats.Float64Measure) func()

Timer is a function stopwatch, calling it starts the timer, calling the returned function will record the duration.

Types

This section is empty.

Jump to

Keyboard shortcuts

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