metrics

package
v0.0.0-...-43b7830 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RateLimiterRequestCounterObservers        = newUnionObserver()
	RateLimiterRequestLatenciesObservers      = newUnionObserver()
	RateLimiterResponseSizesObservers         = newUnionObserver()
	RateLimiterAllocatedLimitsObservers       = newUnionObserver()
	RateLimiterAllocatedTokenCounterObservers = newUnionObserver()
	RateLimiterLeaderElectionObservers        = newUnionObserver()
)

Functions

func MonitorAcquiredTokenCounter

func MonitorAcquiredTokenCounter(serverName, clientID, flowControl, flowControlType, strategy, method string, limit int32)

func MonitorAllocateRequest

func MonitorAllocateRequest(serverName, clientID, flowControl, flowControlType, strategy, method string, limit int32)

func MonitorLeaderElection

func MonitorLeaderElection(shard int, leader string, leaderState int)

func MonitorLimiterRequest

func MonitorLimiterRequest(req *http.Request, serverName, clientID string, requestInfo *request.RequestInfo, httpCode, respSize int, elapsed time.Duration)

func Register

func Register()

Register all metrics.

Types

type MetricInfo

type MetricInfo struct {
	Request      *http.Request
	ServerName   string
	ClientID     string
	Verb         string
	Resource     string
	HttpCode     string
	ResponseSize float64
	Latency      float64

	// for limit allocation
	FlowControl     string
	FlowControlType string
	Strategy        string
	Method          string
	Limit           float64

	// for leader election
	Shard       string
	Leader      string
	LeaderState int
}

type MetricObserver

type MetricObserver interface {
	Observe(metric MetricInfo)
}

type UnionObserver

type UnionObserver interface {
	MetricObserver
	AddObserver(MetricObserver)
}

Jump to

Keyboard shortcuts

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