metrics

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 11 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")
	FailureType, _ = tag.NewKey("failure_type")

	Endpoint, _     = tag.NewKey("endpoint")
	APIInterface, _ = tag.NewKey("api") // to distinguish between gateway api and full node api endpoint calls
)

Global Tags

View Source
var (
	// common
	TitanInfo          = stats.Int64("info", "Arbitrary counter to tag titan info to", stats.UnitDimensionless)
	APIRequestDuration = stats.Float64("api/request_duration_ms", "Duration of API requests", stats.UnitMilliseconds)
)

Measures

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

	APIRequestDurationView = &view.View{
		Measure:     APIRequestDuration,
		Aggregation: defaultMillisecondsDistribution,
		TagKeys:     []tag.Key{APIInterface, Endpoint},
	}
)
View Source
var DefaultViews = func() []*view.View {
	views := []*view.View{
		InfoView,
		APIRequestDurationView,
	}
	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 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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