api

package
v0.0.0-...-e32b5e2 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

	// 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 ReadConsistencyLevelFromContext.

func ContextWithReadConsistencyEncodedOffsets

func ContextWithReadConsistencyEncodedOffsets(ctx context.Context, offsets EncodedOffsets) context.Context

ContextWithReadConsistencyEncodedOffsets returns a new context with the given partition offsets. The offsets can be retrieved with ReadConsistencyEncodedOffsetsFromContext.

func ContextWithReadConsistencyLevel

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

ContextWithReadConsistencyLevel returns a new context with the given consistency level. The consistency level can be retrieved with ReadConsistencyLevelFromContext.

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 ReadConsistencyLevelFromContext

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

ReadConsistencyLevelFromContext returns the consistency level from the context if set via ContextWithReadConsistencyLevel. 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 EncodedOffsets

type EncodedOffsets string

EncodedOffsets holds the encoded partition offsets.

func EncodeOffsets

func EncodeOffsets(offsets map[int32]int64) EncodedOffsets

EncodeOffsets serialise the input offsets into a string which is safe to be used as HTTP header value. Empty partitions (offset is -1) are NOT skipped.

func ReadConsistencyEncodedOffsetsFromContext

func ReadConsistencyEncodedOffsetsFromContext(ctx context.Context) (EncodedOffsets, bool)

ReadConsistencyEncodedOffsetsFromContext returns the partition offsets to enforce strong read consistency. The second return value is true if offsets were found in the context.

func (EncodedOffsets) Lookup

func (p EncodedOffsets) Lookup(partitionID int32) (int64, bool)

Lookup the offset for the input partitionID.

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