Documentation ¶
Index ¶
- Constants
- Variables
- func ConsistencyMiddleware() middleware.Interface
- func ContextWithReadConsistency(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 ReadConsistencyFromContext(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 LabelNamesCardinality
- type LabelNamesCardinalityItem
- type LabelNamesCardinalityResponse
- type LabelValuesCardinality
- type LabelValuesCardinalityResponse
Constants ¶
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" )
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 ReadConsistencyFromContext.
func ContextWithReadConsistency ¶
ContextWithReadConsistency returns a new context with the given consistency level. The consistency level can be retrieved with ReadConsistencyFromContext.
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 ReadConsistencyFromContext ¶
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 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"` }