stats

package
v0.0.0-...-fbfa8e9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RejectReasonMaxSeries                          = "max-fetched-series-per-query"
	RejectReasonMaxChunkBytes                      = "max-fetched-chunk-bytes-per-query"
	RejectReasonMaxChunks                          = "max-fetched-chunks-per-query"
	RejectReasonMaxEstimatedChunks                 = "max-estimated-fetched-chunks-per-query"
	RejectReasonMaxEstimatedQueryMemoryConsumption = "max-estimated-memory-consumption-per-query"
)

Variables

View Source
var (
	ErrInvalidLengthStats = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowStats   = fmt.Errorf("proto: integer overflow")
)

Functions

func IsEnabled

func IsEnabled(ctx context.Context) bool

IsEnabled returns whether stats tracking is enabled in the context.

func ShouldTrackHTTPGRPCResponse

func ShouldTrackHTTPGRPCResponse(r *httpgrpc.HTTPResponse) bool

Types

type QueryMetrics

type QueryMetrics struct {
	// The number of chunks received from ingesters that were exact duplicates of chunks received from other ingesters
	// responding to the same query.
	IngesterChunksDeduplicated prometheus.Counter

	// The total number of chunks received from ingesters that were used to evaluate queries, including any chunks
	// discarded due to deduplication.
	IngesterChunksTotal prometheus.Counter

	// The total number of queries that were rejected for some reason.
	QueriesRejectedTotal *prometheus.CounterVec

	// The total number of queries executed against a particular source
	QueriesExecutedTotal *prometheus.CounterVec
}

QueryMetrics collects metrics on the number of chunks used while serving queries.

func NewQueryMetrics

func NewQueryMetrics(reg prometheus.Registerer) *QueryMetrics

type Stats

type Stats struct {
	// The sum of all wall time spent in the querier to execute the query.
	WallTime time.Duration `protobuf:"bytes,1,opt,name=wall_time,json=wallTime,proto3,stdduration" json:"wall_time"`
	// The number of series fetched for the query
	FetchedSeriesCount uint64 `protobuf:"varint,2,opt,name=fetched_series_count,json=fetchedSeriesCount,proto3" json:"fetched_series_count,omitempty"`
	// The number of bytes of the chunks fetched for the query, after any deduplication
	FetchedChunkBytes uint64 `protobuf:"varint,3,opt,name=fetched_chunk_bytes,json=fetchedChunkBytes,proto3" json:"fetched_chunk_bytes,omitempty"`
	// The number of chunks fetched for the query, after any deduplication
	FetchedChunksCount uint64 `protobuf:"varint,4,opt,name=fetched_chunks_count,json=fetchedChunksCount,proto3" json:"fetched_chunks_count,omitempty"`
	// The number of sharded queries executed. 0 if sharding is disabled or the query can't be sharded.
	ShardedQueries uint32 `protobuf:"varint,5,opt,name=sharded_queries,json=shardedQueries,proto3" json:"sharded_queries,omitempty"`
	// The number of split partial queries executed. 0 if splitting is disabled or the query can't be split.
	SplitQueries uint32 `protobuf:"varint,6,opt,name=split_queries,json=splitQueries,proto3" json:"split_queries,omitempty"`
	// The number of index bytes fetched on the store-gateway for the query
	FetchedIndexBytes uint64 `protobuf:"varint,7,opt,name=fetched_index_bytes,json=fetchedIndexBytes,proto3" json:"fetched_index_bytes,omitempty"`
	// The estimated number of series to be fetched for the query
	EstimatedSeriesCount uint64 `protobuf:"varint,8,opt,name=estimated_series_count,json=estimatedSeriesCount,proto3" json:"estimated_series_count,omitempty"`
	// The sum of durations that the query spent in the queue, before it was handled by querier.
	QueueTime time.Duration `protobuf:"bytes,9,opt,name=queue_time,json=queueTime,proto3,stdduration" json:"queue_time"`
	// The time spent at the frontend encoding the query's final results. Does not include time spent serializing results at the querier.
	EncodeTime time.Duration `protobuf:"bytes,10,opt,name=encode_time,json=encodeTime,proto3,stdduration" json:"encode_time"`
}

func ContextWithEmptyStats

func ContextWithEmptyStats(ctx context.Context) (*Stats, context.Context)

ContextWithEmptyStats returns a context with empty stats.

func FromContext

func FromContext(ctx context.Context) *Stats

FromContext gets the Stats out of the Context. Returns nil if stats have not been initialised in the context.

func (*Stats) AddEncodeTime

func (s *Stats) AddEncodeTime(t time.Duration)

func (*Stats) AddEstimatedSeriesCount

func (s *Stats) AddEstimatedSeriesCount(c uint64)

func (*Stats) AddFetchedChunkBytes

func (s *Stats) AddFetchedChunkBytes(bytes uint64)

func (*Stats) AddFetchedChunks

func (s *Stats) AddFetchedChunks(chunks uint64)

func (*Stats) AddFetchedIndexBytes

func (s *Stats) AddFetchedIndexBytes(indexBytes uint64)

func (*Stats) AddFetchedSeries

func (s *Stats) AddFetchedSeries(series uint64)

func (*Stats) AddQueueTime

func (s *Stats) AddQueueTime(t time.Duration)

func (*Stats) AddShardedQueries

func (s *Stats) AddShardedQueries(num uint32)

func (*Stats) AddSplitQueries

func (s *Stats) AddSplitQueries(num uint32)

func (*Stats) AddWallTime

func (s *Stats) AddWallTime(t time.Duration)

AddWallTime adds some time to the counter.

func (*Stats) Copy

func (s *Stats) Copy() *Stats

Copy returns a copy of the stats. Use this rather than regular struct assignment to make sure atomic modifications are observed.

func (*Stats) Descriptor

func (*Stats) Descriptor() ([]byte, []int)

func (*Stats) Equal

func (this *Stats) Equal(that interface{}) bool

func (*Stats) GetEncodeTime

func (m *Stats) GetEncodeTime() time.Duration

func (*Stats) GetEstimatedSeriesCount

func (m *Stats) GetEstimatedSeriesCount() uint64

func (*Stats) GetFetchedChunkBytes

func (m *Stats) GetFetchedChunkBytes() uint64

func (*Stats) GetFetchedChunksCount

func (m *Stats) GetFetchedChunksCount() uint64

func (*Stats) GetFetchedIndexBytes

func (m *Stats) GetFetchedIndexBytes() uint64

func (*Stats) GetFetchedSeriesCount

func (m *Stats) GetFetchedSeriesCount() uint64

func (*Stats) GetQueueTime

func (m *Stats) GetQueueTime() time.Duration

func (*Stats) GetShardedQueries

func (m *Stats) GetShardedQueries() uint32

func (*Stats) GetSplitQueries

func (m *Stats) GetSplitQueries() uint32

func (*Stats) GetWallTime

func (m *Stats) GetWallTime() time.Duration

func (*Stats) GoString

func (this *Stats) GoString() string

func (*Stats) LoadEncodeTime

func (s *Stats) LoadEncodeTime() time.Duration

func (*Stats) LoadEstimatedSeriesCount

func (s *Stats) LoadEstimatedSeriesCount() uint64

func (*Stats) LoadFetchedChunkBytes

func (s *Stats) LoadFetchedChunkBytes() uint64

func (*Stats) LoadFetchedChunks

func (s *Stats) LoadFetchedChunks() uint64

func (*Stats) LoadFetchedIndexBytes

func (s *Stats) LoadFetchedIndexBytes() uint64

func (*Stats) LoadFetchedSeries

func (s *Stats) LoadFetchedSeries() uint64

func (*Stats) LoadQueueTime

func (s *Stats) LoadQueueTime() time.Duration

func (*Stats) LoadShardedQueries

func (s *Stats) LoadShardedQueries() uint32

func (*Stats) LoadSplitQueries

func (s *Stats) LoadSplitQueries() uint32

func (*Stats) LoadWallTime

func (s *Stats) LoadWallTime() time.Duration

LoadWallTime returns current wall time.

func (*Stats) Marshal

func (m *Stats) Marshal() (dAtA []byte, err error)

func (*Stats) MarshalTo

func (m *Stats) MarshalTo(dAtA []byte) (int, error)

func (*Stats) MarshalToSizedBuffer

func (m *Stats) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Stats) Merge

func (s *Stats) Merge(other *Stats)

Merge the provided Stats into this one.

func (*Stats) ProtoMessage

func (*Stats) ProtoMessage()

func (*Stats) Reset

func (m *Stats) Reset()

func (*Stats) Size

func (m *Stats) Size() (n int)

func (*Stats) String

func (this *Stats) String() string

func (*Stats) Unmarshal

func (m *Stats) Unmarshal(dAtA []byte) error

func (*Stats) XXX_DiscardUnknown

func (m *Stats) XXX_DiscardUnknown()

func (*Stats) XXX_Marshal

func (m *Stats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Stats) XXX_Merge

func (m *Stats) XXX_Merge(src proto.Message)

func (*Stats) XXX_Size

func (m *Stats) XXX_Size() int

func (*Stats) XXX_Unmarshal

func (m *Stats) XXX_Unmarshal(b []byte) error

type WallTimeMiddleware

type WallTimeMiddleware struct{}

WallTimeMiddleware tracks the wall time.

func NewWallTimeMiddleware

func NewWallTimeMiddleware() WallTimeMiddleware

NewWallTimeMiddleware makes a new WallTimeMiddleware.

func (WallTimeMiddleware) Wrap

Wrap implements middleware.Interface.

Jump to

Keyboard shortcuts

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