Documentation ¶
Index ¶
- Constants
- Variables
- func ConsistencyMiddleware() middleware.Interface
- func ContextWithReadConsistencyEncodedOffsets(ctx context.Context, offsets EncodedOffsets) context.Context
- func ContextWithReadConsistencyLevel(parent context.Context, level string) context.Context
- func IsValidReadConsistency(lvl string) bool
- func ReadConsistencyClientStreamInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
- func ReadConsistencyClientUnaryInterceptor(ctx context.Context, method string, req any, reply any, cc *grpc.ClientConn, ...) error
- func ReadConsistencyLevelFromContext(ctx context.Context) (string, bool)
- func ReadConsistencyServerStreamInterceptor(srv interface{}, ss grpc.ServerStream, _ *grpc.StreamServerInfo, ...) error
- func ReadConsistencyServerUnaryInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, ...) (interface{}, error)
- type ActiveSeriesResponse
- type EncodedOffsets
- type LabelNamesCardinality
- type LabelNamesCardinalityItem
- type LabelNamesCardinalityResponse
- type LabelValuesCardinality
- type LabelValuesCardinalityResponse
Constants ¶
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" )
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 ¶
var ReadConsistencies = []string{ReadConsistencyStrong, ReadConsistencyEventual}
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 ¶
ContextWithReadConsistencyLevel returns a new context with the given consistency level. The consistency level can be retrieved with ReadConsistencyLevelFromContext.
func IsValidReadConsistency ¶
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 ¶
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 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.
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 LabelNamesCardinalityResponse ¶
type LabelNamesCardinalityResponse struct { LabelValuesCountTotal int `json:"label_values_count_total"` LabelNamesCount int `json:"label_names_count"` Cardinality []*LabelNamesCardinalityItem `json:"cardinality"` }
type LabelValuesCardinality ¶
type LabelValuesCardinalityResponse ¶
type LabelValuesCardinalityResponse struct { SeriesCountTotal uint64 `json:"series_count_total"` Labels []LabelNamesCardinality `json:"labels"` }