api

package
v0.0.0-...-8d5fd6e Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadConsistencyHeader = "X-Read-Consistency"

	// ReadConsistencyStrong means that a query sent by the same client will always observe the writes
	// that have completed before issuing the query.
	ReadConsistencyStrong = "strong"

	// ReadConsistencyEventual is the default consistency level for all queries.
	// This level means that a query sent by a client may not observe some of the writes that the same client has recently made.
	ReadConsistencyEventual = "eventual"
)
View Source
const ContentTypeRemoteReadStreamedChunks = "application/x-streamed-protobuf; proto=prometheus.ChunkedReadResponse"

ContentTypeRemoteReadStreamedChunks is taken from the prometheus protobuf definitions documentation. See: https://github.com/prometheus/prometheus/blob/d9d51c565c622cdc7d626d3e7569652bc28abe15/prompb/remote.proto#L48

Variables

Functions

func ConsistencyMiddleware

func ConsistencyMiddleware() middleware.Interface

ConsistencyMiddleware takes the consistency level from the X-Read-Consistency header and sets it in the context. It can be retrieved with ReadConsistencyFromContext.

func ContextWithReadConsistency

func ContextWithReadConsistency(parent context.Context, level string) context.Context

ContextWithReadConsistency returns a new context with the given consistency level. The consistency level can be retrieved with ReadConsistencyFromContext.

func IsValidReadConsistency

func IsValidReadConsistency(lvl string) bool

func ReadConsistencyClientStreamInterceptor

func ReadConsistencyClientStreamInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)

func ReadConsistencyClientUnaryInterceptor

func ReadConsistencyClientUnaryInterceptor(ctx context.Context, method string, req any, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

func ReadConsistencyFromContext

func ReadConsistencyFromContext(ctx context.Context) (string, bool)

ReadConsistencyFromContext returns the consistency level from the context if set via ContextWithReadConsistency. The second return value is true if the consistency level was found in the context and is valid.

func ReadConsistencyServerStreamInterceptor

func ReadConsistencyServerStreamInterceptor(srv interface{}, ss grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func ReadConsistencyServerUnaryInterceptor

func ReadConsistencyServerUnaryInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

Types

type ActiveSeriesResponse

type ActiveSeriesResponse struct {
	Data []labels.Labels `json:"data"`
}

type LabelNamesCardinality

type LabelNamesCardinality struct {
	LabelName        string                   `json:"label_name"`
	LabelValuesCount uint64                   `json:"label_values_count"`
	SeriesCount      uint64                   `json:"series_count"`
	Cardinality      []LabelValuesCardinality `json:"cardinality"`
}

type LabelNamesCardinalityItem

type LabelNamesCardinalityItem struct {
	LabelName        string `json:"label_name"`
	LabelValuesCount int    `json:"label_values_count"`
}

type LabelNamesCardinalityResponse

type LabelNamesCardinalityResponse struct {
	LabelValuesCountTotal int                          `json:"label_values_count_total"`
	LabelNamesCount       int                          `json:"label_names_count"`
	Cardinality           []*LabelNamesCardinalityItem `json:"cardinality"`
}

type LabelValuesCardinality

type LabelValuesCardinality struct {
	LabelValue  string `json:"label_value"`
	SeriesCount uint64 `json:"series_count"`
}

type LabelValuesCardinalityResponse

type LabelValuesCardinalityResponse struct {
	SeriesCountTotal uint64                  `json:"series_count_total"`
	Labels           []LabelNamesCardinality `json:"labels"`
}

Jump to

Keyboard shortcuts

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