requestscoped

package
v0.0.0-...-be370ba Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package requestscoped implements features that rely on HTTP request headers, like applying tenant limitation, per-request limit of evaluated points/series, ...

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrParseTTLHeader      = errors.New("can't parse time to live header")
	ErrMissingTenantHeader = errors.New("the tenant header is missing")
	ErrInconsistentContext = errors.New("assertion failed, different context used in same Querier")
	ErrAssertion           = errors.New("assertion error")
	ErrNoContextValue      = errors.New("assertion error: missing call to ContextWithRequest")
)

Functions

This section is empty.

Types

type MutableLabelDetector

type MutableLabelDetector interface {
	IsMutableLabel(ctx context.Context, tenant, name string) (bool, error)
}

type Options

type Options struct {
	DefaultMaxEvaluatedSeries uint32
	DefaultMaxEvaluatedPoints uint64
	DefaultTTL                int64
	TenantLabelName           string
	RequireTenantHeader       bool
	Queryable                 types.QueryableWithOptions
	Appendable                types.AppendableWithOptions
	MutableLabelDetector      MutableLabelDetector
	OptionsParser             types.HTTPOptionsParser
	MetricRegistry            prometheus.Registerer
}

type Store

type Store struct {
	Options
	// contains filtered or unexported fields
}

func NewStore

func NewStore(options Options) *Store

NewStore return a store (Appendable + Queryable) that handle per HTTP request configuration and limits (tenant labels, maximum evaluated points/series, maximum concurrency, ...).

func (*Store) Appender

func (store *Store) Appender(ctx context.Context) storage.Appender

func (*Store) ChunkQuerier

func (store *Store) ChunkQuerier(mint, maxt int64) (storage.ChunkQuerier, error)

func (*Store) ContextWithRequest

func (store *Store) ContextWithRequest(
	ctx context.Context,
	r *http.Request,
	operationName string,
) (context.Context, types.DebugLevel, error)

ContextWithRequest add to the context the necessary value for Store to work. Any context provided to a function of the Store (Querier().Select(), Appender(), ...) must be a context from ContextWithRequest().

func (*Store) DebugAll

func (store *Store) DebugAll() bool

func (*Store) Querier

func (store *Store) Querier(mint, maxt int64) (storage.Querier, error)

func (*Store) ToggleDebug

func (store *Store) ToggleDebug() bool

Jump to

Keyboard shortcuts

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