limitprom

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxConcurrentPolicy = Policy("MaxConcurrent")
	TokenBucketPolicy   = Policy("TokenBucket")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Observer

type Observer interface {
	limit.Observer
	prometheus.Collector
}

func NewObserver

func NewObserver(name string, policy Policy, options ...Option) Observer

NewObserver returns a new Observer with the given name, policy, and options.

type Option

type Option interface {
	// contains filtered or unexported methods
}

An Option provides optional configuration for an Observer.

func WithAbandonedCounter added in v0.4.0

func WithAbandonedCounter(enabled bool) Option

WithAbandonedCounter returns an Option that sets if the rejected counter is enabled. It is enabled by default.

func WithCanceledCounter

func WithCanceledCounter(enabled bool) Option

WithCanceledCounter returns an Option that sets if the canceled counter is enabled. It is enabled by default.

func WithConstLabels added in v0.6.0

func WithConstLabels(labels prometheus.Labels) Option

WithConstLabels returns an Option that adds constant labels to all metrics.

func WithDequeuedCounter

func WithDequeuedCounter(enabled bool) Option

WithDequeuedCounter returns an Option that sets if the dequeued counter is enabled. It is enabled by default.

func WithNamespace added in v0.6.0

func WithNamespace(namespace string) Option

WithNamespace returns an Option that sets the namespace for all metrics. The default is empty.

func WithPendingCounter

func WithPendingCounter(enabled bool) Option

WithPendingCounter returns an Option that sets if the pending counter is enabled. It is enabled by default.

func WithPendingGauge

func WithPendingGauge(enabled bool) Option

WithPendingGauge returns an Option that sets if the pending gauge is enabled. It is enabled by default.

func WithQueuedCounter

func WithQueuedCounter(enabled bool) Option

WithQueuedCounter returns an Option that sets if the queued counter is enabled. It is enabled by default.

func WithQueuedGauge

func WithQueuedGauge(enabled bool) Option

WithQueuedGauge returns an Option that sets if the queued gauge is enabled. It is enabled by default.

func WithRejectedCounter

func WithRejectedCounter(enabled bool) Option

WithRejectedCounter returns an Option that sets if the rejected counter is enabled. It is enabled by default.

func WithReportedCounter added in v0.3.0

func WithReportedCounter(enabled bool) Option

WithReportedCounter returns an Option that sets if the reported counter is enabled. It is enabled by default.

type Policy

type Policy string

A Policy is a type of limit policy.

Jump to

Keyboard shortcuts

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