Documentation
¶
Overview ¶
Package metrics provides observability interfaces and telemetry data structures for distlimit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithRoute ¶
ContextWithRoute returns a copy of parent context carrying the given route pattern string.
func RouteFromContext ¶
RouteFromContext extracts the route pattern string from context if present.
Types ¶
type Event ¶
type Event struct {
// Key is the rate limit key evaluated.
Key string
// Route is the HTTP/RPC route pattern associated with the request (if route labeling is enabled).
Route string
// Allowed indicates whether the request was permitted.
Allowed bool
// Limit is the configured maximum request capacity.
Limit int64
// Remaining is the remaining request quota available.
Remaining int64
// ResetIn specifies the duration until quota resets.
ResetIn time.Duration
// Driver is the storage driver identifier (e.g., "memory", "redis", "hybrid").
Driver string
// Algorithm is the strategy identifier (e.g., "sliding_counter", "token_bucket").
Algorithm string
// Duration is the internal execution latency of the rate limit evaluation.
Duration time.Duration
}
Event represents a single rate limit evaluation telemetry snapshot.
type Observer ¶
type Observer interface {
// Observe receives rate limit evaluation events for recording metrics/telemetry.
Observe(ctx context.Context, event Event)
}
Observer defines the interface for collecting telemetry metrics and traces.
func NewNoopObserver ¶
func NewNoopObserver() Observer
NewNoopObserver creates an observer that discards all recorded events.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package otel provides an OpenTelemetry metrics observer implementation for distlimit.
|
Package otel provides an OpenTelemetry metrics observer implementation for distlimit. |
|
Package prometheus provides a Prometheus metrics observer implementation for distlimit.
|
Package prometheus provides a Prometheus metrics observer implementation for distlimit. |
Click to show internal directories.
Click to hide internal directories.