metadata

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package metadata provides primitives for recording metadata across the query path. Metadata is passed through the query context.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoCtxData = errors.New("unable to add headers to context: no existing context data")
)

Functions

func AddWarnings

func AddWarnings(ctx context.Context, warnings ...string) error

func ExtendHeaders

func ExtendHeaders(dst map[string][]string, src []*definitions.PrometheusResponseHeader)

func JoinHeaders

func JoinHeaders(ctx context.Context, headers []*definitions.PrometheusResponseHeader) error

JoinHeaders merges a Headers with the embedded Headers in a context in a concurrency-safe manner. JoinHeaders will consolidate all distinct headers but will override same-named headers in an undefined way

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context is the metadata context. It is passed through the query path and accumulates metadata.

func FromContext

func FromContext(ctx context.Context) *Context

FromContext returns the metadata context.

func NewContext

func NewContext(ctx context.Context) (*Context, context.Context)

NewContext creates a new metadata context

func (*Context) AddWarning added in v3.1.0

func (c *Context) AddWarning(warning string)

func (*Context) Headers

Headers returns the cache headers accumulated in the context so far.

func (*Context) Reset

func (c *Context) Reset()

func (*Context) Warnings

func (c *Context) Warnings() []string

Jump to

Keyboard shortcuts

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