diff --git a/pkg/logql/metrics.go b/pkg/logql/metrics.go index a00ce77cd5d1a..d918c65d0f5eb 100644 --- a/pkg/logql/metrics.go +++ b/pkg/logql/metrics.go @@ -126,14 +126,6 @@ func RecordRangeAndInstantQueryMetrics( "total_entries", stats.Summary.TotalEntriesReturned, "queue_time", logql_stats.ConvertSecondsToNanoseconds(stats.Summary.QueueTime), "subqueries", stats.Summary.Subqueries, - "cache_chunk_req", stats.Caches.Chunk.EntriesRequested, - "cache_chunk_hit", stats.Caches.Chunk.EntriesFound, - "cache_chunk_bytes_stored", stats.Caches.Chunk.BytesSent, - "cache_chunk_bytes_fetched", stats.Caches.Chunk.BytesReceived, - "cache_index_req", stats.Caches.Index.EntriesRequested, - "cache_index_hit", stats.Caches.Index.EntriesFound, - "cache_result_req", stats.Caches.Result.EntriesRequested, - "cache_result_hit", stats.Caches.Result.EntriesFound, }...) logValues = append(logValues, tagsToKeyValues(queryTags)...) diff --git a/pkg/logql/metrics_test.go b/pkg/logql/metrics_test.go index 99064b2d32415..46db6463a20bc 100644 --- a/pkg/logql/metrics_test.go +++ b/pkg/logql/metrics_test.go @@ -84,7 +84,7 @@ func TestLogSlowQuery(t *testing.T) { }, logqlmodel.Streams{logproto.Stream{Entries: make([]logproto.Entry, 10)}}) require.Equal(t, fmt.Sprintf( - "level=info org_id=foo traceID=%s latency=slow query=\"{foo=\\\"bar\\\"} |= \\\"buzz\\\"\" query_type=filter range_type=range length=1h0m0s step=1m0s duration=25.25s status=200 limit=1000 returned_lines=10 throughput=100kB total_bytes=100kB total_entries=10 queue_time=2ns subqueries=0 cache_chunk_req=0 cache_chunk_hit=0 cache_chunk_bytes_stored=0 cache_chunk_bytes_fetched=0 cache_index_req=0 cache_index_hit=0 cache_result_req=0 cache_result_hit=0 source=logvolhist feature=beta\n", + "level=info org_id=foo traceID=%s latency=slow query=\"{foo=\\\"bar\\\"} |= \\\"buzz\\\"\" query_type=filter range_type=range length=1h0m0s step=1m0s duration=25.25s status=200 limit=1000 returned_lines=10 throughput=100kB total_bytes=100kB total_entries=10 queue_time=2ns subqueries=0 source=logvolhist feature=beta\n", sp.Context().(jaeger.SpanContext).SpanID().String(), ), buf.String()) diff --git a/pkg/logqlmodel/stats/context.go b/pkg/logqlmodel/stats/context.go index 4b1ab3148ad55..1d23f76ef3216 100644 --- a/pkg/logqlmodel/stats/context.go +++ b/pkg/logqlmodel/stats/context.go @@ -43,7 +43,6 @@ const ( type Context struct { querier Querier ingester Ingester - caches Caches // store is the store statistics collected across the query path store Store @@ -53,15 +52,6 @@ type Context struct { mtx sync.Mutex } -type CacheType string - -const ( - ChunkCache CacheType = "chunk" //nolint:staticcheck - IndexCache = "index" - ResultCache = "result" - WriteDedupeCache = "write-dedupe" -) - // NewContext creates a new statistics context func NewContext(ctx context.Context) (*Context, context.Context) { contextData := &Context{} @@ -89,15 +79,6 @@ func (c *Context) Ingester() Ingester { } } -// Caches returns the cache statistics accumulated so far. -func (c *Context) Caches() Caches { - return Caches{ - Chunk: c.caches.Chunk, - Index: c.caches.Index, - Result: c.caches.Result, - } -} - // Reset clears the statistics. func (c *Context) Reset() { c.mtx.Lock() @@ -107,7 +88,6 @@ func (c *Context) Reset() { c.querier.Reset() c.ingester.Reset() c.result.Reset() - c.caches.Reset() } // Result calculates the summary based on store and ingester data. @@ -119,7 +99,6 @@ func (c *Context) Result(execTime time.Duration, queueTime time.Duration, totalE Store: c.store, }, Ingester: c.ingester, - Caches: c.caches, }) r.ComputeSummary(execTime, queueTime, totalEntriesReturned) @@ -189,28 +168,12 @@ func (i *Ingester) Merge(m Ingester) { i.TotalReached += m.TotalReached } -func (c *Caches) Merge(m Caches) { - c.Chunk.Merge(m.Chunk) - c.Index.Merge(m.Index) - c.Result.Merge(m.Result) -} - -func (c *Cache) Merge(m Cache) { - c.EntriesFound += m.EntriesFound - c.EntriesRequested += m.EntriesRequested - c.EntriesStored += m.EntriesStored - c.Requests += m.Requests - c.BytesSent += m.BytesSent - c.BytesReceived += m.BytesReceived -} - // Merge merges two results of statistics. // This will increase the total number of Subqueries. func (r *Result) Merge(m Result) { r.Summary.Subqueries++ r.Querier.Merge(m.Querier) r.Ingester.Merge(m.Ingester) - r.Caches.Merge(m.Caches) r.ComputeSummary(ConvertSecondsToNanoseconds(r.Summary.ExecTime+m.Summary.ExecTime), ConvertSecondsToNanoseconds(r.Summary.QueueTime+m.Summary.QueueTime), int(r.Summary.TotalEntriesReturned)) } @@ -294,85 +257,6 @@ func (c *Context) AddChunksRef(i int64) { atomic.AddInt64(&c.store.TotalChunksRef, i) } -// AddCacheEntriesFound counts the number of cache entries requested and found -func (c *Context) AddCacheEntriesFound(t CacheType, i int) { - stats := c.getCacheStatsByType(t) - if stats == nil { - return - } - - atomic.AddInt32(&stats.EntriesFound, int32(i)) -} - -// AddCacheEntriesRequested counts the number of keys requested from the cache -func (c *Context) AddCacheEntriesRequested(t CacheType, i int) { - stats := c.getCacheStatsByType(t) - if stats == nil { - return - } - - atomic.AddInt32(&stats.EntriesRequested, int32(i)) -} - -// AddCacheEntriesStored counts the number of keys *attempted* to be stored in the cache -// It should be noted that if a background writeback (https://grafana.com/docs/loki/latest/configuration/#cache_config) -// is configured we cannot know if these store attempts succeeded or not as this happens asynchronously -func (c *Context) AddCacheEntriesStored(t CacheType, i int) { - stats := c.getCacheStatsByType(t) - if stats == nil { - return - } - - atomic.AddInt32(&stats.EntriesStored, int32(i)) -} - -// AddCacheBytesRetrieved counts the amount of bytes retrieved from the cache -func (c *Context) AddCacheBytesRetrieved(t CacheType, i int) { - stats := c.getCacheStatsByType(t) - if stats == nil { - return - } - - atomic.AddInt64(&stats.BytesReceived, int64(i)) -} - -// AddCacheBytesSent counts the amount of bytes sent to the cache -// It should be noted that if a background writeback (https://grafana.com/docs/loki/latest/configuration/#cache_config) -// is configured we cannot know if these bytes actually got stored or not as this happens asynchronously -func (c *Context) AddCacheBytesSent(t CacheType, i int) { - stats := c.getCacheStatsByType(t) - if stats == nil { - return - } - - atomic.AddInt64(&stats.BytesSent, int64(i)) -} - -// AddCacheRequest counts the number of fetch/store requests to the cache -func (c *Context) AddCacheRequest(t CacheType, i int) { - stats := c.getCacheStatsByType(t) - if stats == nil { - return - } - - atomic.AddInt32(&stats.Requests, int32(i)) -} - -func (c *Context) getCacheStatsByType(t CacheType) *Cache { - var stats *Cache - switch t { - case ChunkCache: - stats = &c.caches.Chunk - case IndexCache: - stats = &c.caches.Index - case ResultCache: - stats = &c.caches.Result - default: - return nil - } - return stats -} - // Log logs a query statistics result. func (r Result) Log(log log.Logger) { _ = log.Log( @@ -400,7 +284,6 @@ func (r Result) Log(log log.Logger) { "Querier.CompressedBytes", humanize.Bytes(uint64(r.Querier.Store.Chunk.CompressedBytes)), "Querier.TotalDuplicates", r.Querier.Store.Chunk.TotalDuplicates, ) - r.Caches.Log(log) r.Summary.Log(log) } @@ -414,26 +297,3 @@ func (s Summary) Log(log log.Logger) { "Summary.QueueTime", ConvertSecondsToNanoseconds(s.QueueTime), ) } - -func (c Caches) Log(log log.Logger) { - _ = log.Log( - "Cache.Chunk.Requests", c.Chunk.Requests, - "Cache.Chunk.EntriesRequested", c.Chunk.EntriesRequested, - "Cache.Chunk.EntriesFound", c.Chunk.EntriesFound, - "Cache.Chunk.EntriesStored", c.Chunk.EntriesStored, - "Cache.Chunk.BytesSent", humanize.Bytes(uint64(c.Chunk.BytesSent)), - "Cache.Chunk.BytesReceived", humanize.Bytes(uint64(c.Chunk.BytesReceived)), - "Cache.Index.Requests", c.Index.Requests, - "Cache.Index.EntriesRequested", c.Index.EntriesRequested, - "Cache.Index.EntriesFound", c.Index.EntriesFound, - "Cache.Index.EntriesStored", c.Index.EntriesStored, - "Cache.Index.BytesSent", humanize.Bytes(uint64(c.Index.BytesSent)), - "Cache.Index.BytesReceived", humanize.Bytes(uint64(c.Index.BytesReceived)), - "Cache.Result.Requests", c.Result.Requests, - "Cache.Result.EntriesRequested", c.Result.EntriesRequested, - "Cache.Result.EntriesFound", c.Result.EntriesFound, - "Cache.Result.EntriesStored", c.Result.EntriesStored, - "Cache.Result.BytesSent", humanize.Bytes(uint64(c.Result.BytesSent)), - "Cache.Result.BytesReceived", humanize.Bytes(uint64(c.Result.BytesReceived)), - ) -} diff --git a/pkg/logqlmodel/stats/context_test.go b/pkg/logqlmodel/stats/context_test.go index 220c81980c31b..0b97024c9b88f 100644 --- a/pkg/logqlmodel/stats/context_test.go +++ b/pkg/logqlmodel/stats/context_test.go @@ -22,9 +22,6 @@ func TestResult(t *testing.T) { stats.AddChunksRef(50) stats.AddChunksDownloaded(60) stats.AddChunksDownloadTime(time.Second) - stats.AddCacheRequest(ChunkCache, 3) - stats.AddCacheRequest(IndexCache, 4) - stats.AddCacheRequest(ResultCache, 1) fakeIngesterQuery(ctx) fakeIngesterQuery(ctx) @@ -63,17 +60,6 @@ func TestResult(t *testing.T) { }, }, }, - Caches: Caches{ - Chunk: Cache{ - Requests: 3, - }, - Index: Cache{ - Requests: 4, - }, - Result: Cache{ - Requests: 1, - }, - }, Summary: Summary{ ExecTime: 2 * time.Second.Seconds(), QueueTime: 2 * time.Nanosecond.Seconds(), @@ -196,20 +182,6 @@ func TestResult_Merge(t *testing.T) { }, }, }, - Caches: Caches{ - Chunk: Cache{ - Requests: 5, - BytesReceived: 1024, - BytesSent: 512, - }, - Index: Cache{ - EntriesRequested: 22, - EntriesFound: 2, - }, - Result: Cache{ - EntriesStored: 3, - }, - }, Summary: Summary{ ExecTime: 2 * time.Second.Seconds(), QueueTime: 2 * time.Nanosecond.Seconds(), @@ -258,20 +230,6 @@ func TestResult_Merge(t *testing.T) { }, }, }, - Caches: Caches{ - Chunk: Cache{ - Requests: 2 * 5, - BytesReceived: 2 * 1024, - BytesSent: 2 * 512, - }, - Index: Cache{ - EntriesRequested: 2 * 22, - EntriesFound: 2 * 2, - }, - Result: Cache{ - EntriesStored: 2 * 3, - }, - }, Summary: Summary{ ExecTime: 2 * 2 * time.Second.Seconds(), QueueTime: 2 * 2 * time.Nanosecond.Seconds(), @@ -315,29 +273,3 @@ func TestIngester(t *testing.T) { }, }, statsCtx.Ingester()) } - -func TestCaches(t *testing.T) { - statsCtx, _ := NewContext(context.Background()) - - statsCtx.AddCacheRequest(ChunkCache, 5) - statsCtx.AddCacheEntriesStored(ResultCache, 3) - statsCtx.AddCacheEntriesRequested(IndexCache, 22) - statsCtx.AddCacheBytesRetrieved(ChunkCache, 1024) - statsCtx.AddCacheBytesSent(ChunkCache, 512) - statsCtx.AddCacheEntriesFound(IndexCache, 2) - - require.Equal(t, Caches{ - Chunk: Cache{ - Requests: 5, - BytesReceived: 1024, - BytesSent: 512, - }, - Index: Cache{ - EntriesRequested: 22, - EntriesFound: 2, - }, - Result: Cache{ - EntriesStored: 3, - }, - }, statsCtx.Caches()) -} diff --git a/pkg/logqlmodel/stats/stats.pb.go b/pkg/logqlmodel/stats/stats.pb.go index 509645e9b195b..a8748ebe9ef52 100644 --- a/pkg/logqlmodel/stats/stats.pb.go +++ b/pkg/logqlmodel/stats/stats.pb.go @@ -31,7 +31,6 @@ type Result struct { Summary Summary `protobuf:"bytes,1,opt,name=summary,proto3" json:"summary"` Querier Querier `protobuf:"bytes,2,opt,name=querier,proto3" json:"querier"` Ingester Ingester `protobuf:"bytes,3,opt,name=ingester,proto3" json:"ingester"` - Caches Caches `protobuf:"bytes,4,opt,name=caches,proto3" json:"cache"` } func (m *Result) Reset() { *m = Result{} } @@ -87,72 +86,6 @@ func (m *Result) GetIngester() Ingester { return Ingester{} } -func (m *Result) GetCaches() Caches { - if m != nil { - return m.Caches - } - return Caches{} -} - -type Caches struct { - Chunk Cache `protobuf:"bytes,1,opt,name=chunk,proto3" json:"chunk"` - Index Cache `protobuf:"bytes,2,opt,name=index,proto3" json:"index"` - Result Cache `protobuf:"bytes,3,opt,name=result,proto3" json:"result"` -} - -func (m *Caches) Reset() { *m = Caches{} } -func (*Caches) ProtoMessage() {} -func (*Caches) Descriptor() ([]byte, []int) { - return fileDescriptor_6cdfe5d2aea33ebb, []int{1} -} -func (m *Caches) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Caches) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Caches.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Caches) XXX_Merge(src proto.Message) { - xxx_messageInfo_Caches.Merge(m, src) -} -func (m *Caches) XXX_Size() int { - return m.Size() -} -func (m *Caches) XXX_DiscardUnknown() { - xxx_messageInfo_Caches.DiscardUnknown(m) -} - -var xxx_messageInfo_Caches proto.InternalMessageInfo - -func (m *Caches) GetChunk() Cache { - if m != nil { - return m.Chunk - } - return Cache{} -} - -func (m *Caches) GetIndex() Cache { - if m != nil { - return m.Index - } - return Cache{} -} - -func (m *Caches) GetResult() Cache { - if m != nil { - return m.Result - } - return Cache{} -} - // Summary is the summary of a query statistics. type Summary struct { // Total bytes processed per second. @@ -180,7 +113,7 @@ type Summary struct { func (m *Summary) Reset() { *m = Summary{} } func (*Summary) ProtoMessage() {} func (*Summary) Descriptor() ([]byte, []int) { - return fileDescriptor_6cdfe5d2aea33ebb, []int{2} + return fileDescriptor_6cdfe5d2aea33ebb, []int{1} } func (m *Summary) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -272,7 +205,7 @@ type Querier struct { func (m *Querier) Reset() { *m = Querier{} } func (*Querier) ProtoMessage() {} func (*Querier) Descriptor() ([]byte, []int) { - return fileDescriptor_6cdfe5d2aea33ebb, []int{3} + return fileDescriptor_6cdfe5d2aea33ebb, []int{2} } func (m *Querier) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -323,7 +256,7 @@ type Ingester struct { func (m *Ingester) Reset() { *m = Ingester{} } func (*Ingester) ProtoMessage() {} func (*Ingester) Descriptor() ([]byte, []int) { - return fileDescriptor_6cdfe5d2aea33ebb, []int{4} + return fileDescriptor_6cdfe5d2aea33ebb, []int{3} } func (m *Ingester) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -400,7 +333,7 @@ type Store struct { func (m *Store) Reset() { *m = Store{} } func (*Store) ProtoMessage() {} func (*Store) Descriptor() ([]byte, []int) { - return fileDescriptor_6cdfe5d2aea33ebb, []int{5} + return fileDescriptor_6cdfe5d2aea33ebb, []int{4} } func (m *Store) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -475,7 +408,7 @@ type Chunk struct { func (m *Chunk) Reset() { *m = Chunk{} } func (*Chunk) ProtoMessage() {} func (*Chunk) Descriptor() ([]byte, []int) { - return fileDescriptor_6cdfe5d2aea33ebb, []int{6} + return fileDescriptor_6cdfe5d2aea33ebb, []int{5} } func (m *Chunk) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -546,163 +479,67 @@ func (m *Chunk) GetTotalDuplicates() int64 { return 0 } -type Cache struct { - EntriesFound int32 `protobuf:"varint,1,opt,name=entriesFound,proto3" json:"entriesFound"` - EntriesRequested int32 `protobuf:"varint,2,opt,name=entriesRequested,proto3" json:"entriesRequested"` - EntriesStored int32 `protobuf:"varint,3,opt,name=entriesStored,proto3" json:"entriesStored"` - BytesReceived int64 `protobuf:"varint,4,opt,name=bytesReceived,proto3" json:"bytesReceived"` - BytesSent int64 `protobuf:"varint,5,opt,name=bytesSent,proto3" json:"bytesSent"` - Requests int32 `protobuf:"varint,6,opt,name=requests,proto3" json:"requests"` -} - -func (m *Cache) Reset() { *m = Cache{} } -func (*Cache) ProtoMessage() {} -func (*Cache) Descriptor() ([]byte, []int) { - return fileDescriptor_6cdfe5d2aea33ebb, []int{7} -} -func (m *Cache) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Cache) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Cache.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Cache) XXX_Merge(src proto.Message) { - xxx_messageInfo_Cache.Merge(m, src) -} -func (m *Cache) XXX_Size() int { - return m.Size() -} -func (m *Cache) XXX_DiscardUnknown() { - xxx_messageInfo_Cache.DiscardUnknown(m) -} - -var xxx_messageInfo_Cache proto.InternalMessageInfo - -func (m *Cache) GetEntriesFound() int32 { - if m != nil { - return m.EntriesFound - } - return 0 -} - -func (m *Cache) GetEntriesRequested() int32 { - if m != nil { - return m.EntriesRequested - } - return 0 -} - -func (m *Cache) GetEntriesStored() int32 { - if m != nil { - return m.EntriesStored - } - return 0 -} - -func (m *Cache) GetBytesReceived() int64 { - if m != nil { - return m.BytesReceived - } - return 0 -} - -func (m *Cache) GetBytesSent() int64 { - if m != nil { - return m.BytesSent - } - return 0 -} - -func (m *Cache) GetRequests() int32 { - if m != nil { - return m.Requests - } - return 0 -} - func init() { proto.RegisterType((*Result)(nil), "stats.Result") - proto.RegisterType((*Caches)(nil), "stats.Caches") proto.RegisterType((*Summary)(nil), "stats.Summary") proto.RegisterType((*Querier)(nil), "stats.Querier") proto.RegisterType((*Ingester)(nil), "stats.Ingester") proto.RegisterType((*Store)(nil), "stats.Store") proto.RegisterType((*Chunk)(nil), "stats.Chunk") - proto.RegisterType((*Cache)(nil), "stats.Cache") } func init() { proto.RegisterFile("pkg/logqlmodel/stats/stats.proto", fileDescriptor_6cdfe5d2aea33ebb) } var fileDescriptor_6cdfe5d2aea33ebb = []byte{ - // 932 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0x4b, 0x6f, 0xe4, 0x44, - 0x10, 0x1e, 0xcf, 0xc4, 0x33, 0xd9, 0x26, 0xaf, 0xed, 0xdd, 0x65, 0x0d, 0x48, 0x76, 0x34, 0xa7, - 0x48, 0x40, 0x46, 0x3c, 0x24, 0x04, 0x62, 0x25, 0xe4, 0x2c, 0x2b, 0x45, 0x5a, 0xc4, 0x52, 0x81, - 0x0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3, 0x7d, 0x58, 0x16, 0xce, 0x0a, 0x07, - 0x2b, 0x08, 0xfd, 0x8c, 0x6c, 0x2b, 0x0c, 0x6b, 0x44, 0x36, 0x7c, 0xd3, 0xbd, 0x5f, 0x16, 0x8e, - 0x4e, 0x80, 0xee, 0x0a, 0x21, 0xfe, 0x43, 0x01, 0xf3, 0x59, 0xf8, 0x53, 0xd5, 0xde, 0x51, 0xa8, - 0x11, 0xa0, 0xbb, 0xa2, 0x51, 0x23, 0x80, 0x95, 0x2f, 0x53, 0x06, 0x1b, 0x75, 0x05, 0x42, 0x6d, - 0x8a, 0xfe, 0x9f, 0xc8, 0xbd, 0xca, 0xfc, 0x30, 0x65, 0xff, 0x5f, 0x62, 0x50, 0x59, 0xee, 0xf4, - 0xfa, 0xc6, 0xee, 0xbd, 0xbe, 0xb1, 0x7b, 0x77, 0x37, 0xb6, 0xf1, 0xcb, 0xc2, 0x36, 0xfe, 0x5a, - 0xd8, 0xc6, 0xd5, 0xc2, 0x36, 0xae, 0x17, 0xb6, 0xf1, 0xcf, 0xc2, 0x36, 0xfe, 0x5d, 0xd8, 0xbd, - 0xbb, 0x85, 0x6d, 0xfc, 0x7e, 0x6b, 0xf7, 0xae, 0x6f, 0xed, 0xde, 0xeb, 0x5b, 0xbb, 0xf7, 0xe3, - 0x07, 0xcd, 0x6f, 0xaf, 0xc4, 0x3b, 0xf5, 0x62, 0x6f, 0x12, 0xf1, 0xf3, 0x70, 0xd2, 0xf5, 0xf1, - 0x36, 0x1d, 0xe2, 0x17, 0xd8, 0x27, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xee, 0x30, 0x71, - 0xdb, 0x09, 0x00, 0x00, + // 759 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0x8e, 0x93, 0xe6, 0xa3, 0xfb, 0xf6, 0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xff, 0x9a, + 0x84, 0xb3, 0x79, 0xb3, 0x07, 0x00, 0x00, } func (this *Result) Equal(that interface{}) bool { @@ -733,39 +570,6 @@ func (this *Result) Equal(that interface{}) bool { if !this.Ingester.Equal(&that1.Ingester) { return false } - if !this.Caches.Equal(&that1.Caches) { - return false - } - return true -} -func (this *Caches) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Caches) - if !ok { - that2, ok := that.(Caches) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Chunk.Equal(&that1.Chunk) { - return false - } - if !this.Index.Equal(&that1.Index) { - return false - } - if !this.Result.Equal(&that1.Result) { - return false - } return true } func (this *Summary) Equal(that interface{}) bool { @@ -945,67 +749,15 @@ func (this *Chunk) Equal(that interface{}) bool { } return true } -func (this *Cache) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Cache) - if !ok { - that2, ok := that.(Cache) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.EntriesFound != that1.EntriesFound { - return false - } - if this.EntriesRequested != that1.EntriesRequested { - return false - } - if this.EntriesStored != that1.EntriesStored { - return false - } - if this.BytesReceived != that1.BytesReceived { - return false - } - if this.BytesSent != that1.BytesSent { - return false - } - if this.Requests != that1.Requests { - return false - } - return true -} func (this *Result) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 8) + s := make([]string, 0, 7) s = append(s, "&stats.Result{") s = append(s, "Summary: "+strings.Replace(this.Summary.GoString(), `&`, ``, 1)+",\n") s = append(s, "Querier: "+strings.Replace(this.Querier.GoString(), `&`, ``, 1)+",\n") s = append(s, "Ingester: "+strings.Replace(this.Ingester.GoString(), `&`, ``, 1)+",\n") - s = append(s, "Caches: "+strings.Replace(this.Caches.GoString(), `&`, ``, 1)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Caches) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&stats.Caches{") - s = append(s, "Chunk: "+strings.Replace(this.Chunk.GoString(), `&`, ``, 1)+",\n") - s = append(s, "Index: "+strings.Replace(this.Index.GoString(), `&`, ``, 1)+",\n") - s = append(s, "Result: "+strings.Replace(this.Result.GoString(), `&`, ``, 1)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -1078,21 +830,6 @@ func (this *Chunk) GoString() string { s = append(s, "}") return strings.Join(s, "") } -func (this *Cache) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&stats.Cache{") - s = append(s, "EntriesFound: "+fmt.Sprintf("%#v", this.EntriesFound)+",\n") - s = append(s, "EntriesRequested: "+fmt.Sprintf("%#v", this.EntriesRequested)+",\n") - s = append(s, "EntriesStored: "+fmt.Sprintf("%#v", this.EntriesStored)+",\n") - s = append(s, "BytesReceived: "+fmt.Sprintf("%#v", this.BytesReceived)+",\n") - s = append(s, "BytesSent: "+fmt.Sprintf("%#v", this.BytesSent)+",\n") - s = append(s, "Requests: "+fmt.Sprintf("%#v", this.Requests)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} func valueToGoStringStats(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -1121,16 +858,6 @@ func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Caches.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStats(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 { size, err := m.Ingester.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1164,59 +891,6 @@ func (m *Result) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Caches) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Caches) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Caches) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStats(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Index.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStats(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Chunk.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintStats(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *Summary) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1469,74 +1143,21 @@ func (m *Chunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Cache) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintStats(dAtA []byte, offset int, v uint64) int { + offset -= sovStats(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *Cache) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *Cache) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Requests != 0 { - i = encodeVarintStats(dAtA, i, uint64(m.Requests)) - i-- - dAtA[i] = 0x30 - } - if m.BytesSent != 0 { - i = encodeVarintStats(dAtA, i, uint64(m.BytesSent)) - i-- - dAtA[i] = 0x28 - } - if m.BytesReceived != 0 { - i = encodeVarintStats(dAtA, i, uint64(m.BytesReceived)) - i-- - dAtA[i] = 0x20 - } - if m.EntriesStored != 0 { - i = encodeVarintStats(dAtA, i, uint64(m.EntriesStored)) - i-- - dAtA[i] = 0x18 - } - if m.EntriesRequested != 0 { - i = encodeVarintStats(dAtA, i, uint64(m.EntriesRequested)) - i-- - dAtA[i] = 0x10 - } - if m.EntriesFound != 0 { - i = encodeVarintStats(dAtA, i, uint64(m.EntriesFound)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintStats(dAtA []byte, offset int, v uint64) int { - offset -= sovStats(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Result) Size() (n int) { - if m == nil { - return 0 - } +func (m *Result) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l l = m.Summary.Size() @@ -1545,23 +1166,6 @@ func (m *Result) Size() (n int) { n += 1 + l + sovStats(uint64(l)) l = m.Ingester.Size() n += 1 + l + sovStats(uint64(l)) - l = m.Caches.Size() - n += 1 + l + sovStats(uint64(l)) - return n -} - -func (m *Caches) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Chunk.Size() - n += 1 + l + sovStats(uint64(l)) - l = m.Index.Size() - n += 1 + l + sovStats(uint64(l)) - l = m.Result.Size() - n += 1 + l + sovStats(uint64(l)) return n } @@ -1679,33 +1283,6 @@ func (m *Chunk) Size() (n int) { return n } -func (m *Cache) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.EntriesFound != 0 { - n += 1 + sovStats(uint64(m.EntriesFound)) - } - if m.EntriesRequested != 0 { - n += 1 + sovStats(uint64(m.EntriesRequested)) - } - if m.EntriesStored != 0 { - n += 1 + sovStats(uint64(m.EntriesStored)) - } - if m.BytesReceived != 0 { - n += 1 + sovStats(uint64(m.BytesReceived)) - } - if m.BytesSent != 0 { - n += 1 + sovStats(uint64(m.BytesSent)) - } - if m.Requests != 0 { - n += 1 + sovStats(uint64(m.Requests)) - } - return n -} - func sovStats(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1720,19 +1297,6 @@ func (this *Result) String() string { `Summary:` + strings.Replace(strings.Replace(this.Summary.String(), "Summary", "Summary", 1), `&`, ``, 1) + `,`, `Querier:` + strings.Replace(strings.Replace(this.Querier.String(), "Querier", "Querier", 1), `&`, ``, 1) + `,`, `Ingester:` + strings.Replace(strings.Replace(this.Ingester.String(), "Ingester", "Ingester", 1), `&`, ``, 1) + `,`, - `Caches:` + strings.Replace(strings.Replace(this.Caches.String(), "Caches", "Caches", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *Caches) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Caches{`, - `Chunk:` + strings.Replace(strings.Replace(this.Chunk.String(), "Cache", "Cache", 1), `&`, ``, 1) + `,`, - `Index:` + strings.Replace(strings.Replace(this.Index.String(), "Cache", "Cache", 1), `&`, ``, 1) + `,`, - `Result:` + strings.Replace(strings.Replace(this.Result.String(), "Cache", "Cache", 1), `&`, ``, 1) + `,`, `}`, }, "") return s @@ -1806,21 +1370,6 @@ func (this *Chunk) String() string { }, "") return s } -func (this *Cache) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Cache{`, - `EntriesFound:` + fmt.Sprintf("%v", this.EntriesFound) + `,`, - `EntriesRequested:` + fmt.Sprintf("%v", this.EntriesRequested) + `,`, - `EntriesStored:` + fmt.Sprintf("%v", this.EntriesStored) + `,`, - `BytesReceived:` + fmt.Sprintf("%v", this.BytesReceived) + `,`, - `BytesSent:` + fmt.Sprintf("%v", this.BytesSent) + `,`, - `Requests:` + fmt.Sprintf("%v", this.Requests) + `,`, - `}`, - }, "") - return s -} func valueToStringStats(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -1957,191 +1506,6 @@ func (m *Result) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Caches", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStats - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStats - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Caches.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStats(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStats - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStats - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Caches) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Caches: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Caches: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chunk", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStats - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStats - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Chunk.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStats - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStats - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Index.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStats - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthStats - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Result.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStats(dAtA[iNdEx:]) @@ -2913,173 +2277,6 @@ func (m *Chunk) Unmarshal(dAtA []byte) error { } return nil } -func (m *Cache) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Cache: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Cache: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EntriesFound", wireType) - } - m.EntriesFound = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EntriesFound |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EntriesRequested", wireType) - } - m.EntriesRequested = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EntriesRequested |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EntriesStored", wireType) - } - m.EntriesStored = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EntriesStored |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BytesReceived", wireType) - } - m.BytesReceived = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BytesReceived |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BytesSent", wireType) - } - m.BytesSent = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BytesSent |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Requests", wireType) - } - m.Requests = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStats - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Requests |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipStats(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStats - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthStats - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipStats(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/pkg/logqlmodel/stats/stats.proto b/pkg/logqlmodel/stats/stats.proto index d376214c27de5..657c8e2545d1a 100644 --- a/pkg/logqlmodel/stats/stats.proto +++ b/pkg/logqlmodel/stats/stats.proto @@ -22,25 +22,6 @@ message Result { (gogoproto.nullable) = false, (gogoproto.jsontag) = "ingester" ]; - Caches caches = 4 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "cache" - ]; -} - -message Caches { - Cache chunk = 1 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "chunk" - ]; - Cache index = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "index" - ]; - Cache result = 3 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "result" - ]; } // Summary is the summary of a query statistics. @@ -118,12 +99,3 @@ message Chunk { // Total duplicates found while processing. int64 totalDuplicates = 9 [(gogoproto.jsontag) = "totalDuplicates"]; } - -message Cache { - int32 entriesFound = 1 [(gogoproto.jsontag) = "entriesFound"]; - int32 entriesRequested = 2 [(gogoproto.jsontag) = "entriesRequested"]; - int32 entriesStored = 3 [(gogoproto.jsontag) = "entriesStored"]; - int64 bytesReceived = 4 [(gogoproto.jsontag) = "bytesReceived"]; - int64 bytesSent = 5 [(gogoproto.jsontag) = "bytesSent"]; - int32 requests = 6 [(gogoproto.jsontag) = "requests"]; -} diff --git a/pkg/querier/queryrange/codec_test.go b/pkg/querier/queryrange/codec_test.go index 35cc91e8d95a5..a558b5106780a 100644 --- a/pkg/querier/queryrange/codec_test.go +++ b/pkg/querier/queryrange/codec_test.go @@ -978,32 +978,6 @@ var ( "totalChunksDownloaded": 18 } }, - "cache": { - "chunk": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "index": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "result": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - } - }, "summary": { "bytesProcessedPerSecond": 20, "execTime": 22, @@ -1204,12 +1178,6 @@ var ( TotalLinesSent: 9, TotalReached: 10, }, - - Caches: stats.Caches{ - Chunk: stats.Cache{}, - Index: stats.Cache{}, - Result: stats.Cache{}, - }, } ) diff --git a/pkg/querier/queryrange/prometheus_test.go b/pkg/querier/queryrange/prometheus_test.go index 84bd2112b155f..aff5172f634d8 100644 --- a/pkg/querier/queryrange/prometheus_test.go +++ b/pkg/querier/queryrange/prometheus_test.go @@ -47,32 +47,6 @@ var emptyStats = `"stats": { } } }, - "cache": { - "chunk": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "index": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "result": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - } - }, "summary": { "bytesProcessedPerSecond": 0, "execTime": 0, diff --git a/pkg/querier/queryrange/queryrangebase/results_cache_test.go b/pkg/querier/queryrange/queryrangebase/results_cache_test.go index a4545664d719e..1bb0182366ad5 100644 --- a/pkg/querier/queryrange/queryrangebase/results_cache_test.go +++ b/pkg/querier/queryrange/queryrangebase/results_cache_test.go @@ -16,7 +16,6 @@ import ( "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/logproto" - "github.com/grafana/loki/pkg/logqlmodel/stats" "github.com/grafana/loki/pkg/storage/chunk/cache" ) @@ -753,7 +752,7 @@ func TestResultsCache(t *testing.T) { Cache: cache.NewMockCache(), }, } - c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger(), stats.ResultCache) + c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger()) require.NoError(t, err) rcm, err := NewResultsCacheMiddleware( log.NewNopLogger(), @@ -795,7 +794,7 @@ func TestResultsCacheRecent(t *testing.T) { var cfg ResultsCacheConfig flagext.DefaultValues(&cfg) cfg.CacheConfig.Cache = cache.NewMockCache() - c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger(), stats.ResultCache) + c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger()) require.NoError(t, err) rcm, err := NewResultsCacheMiddleware( log.NewNopLogger(), @@ -858,7 +857,7 @@ func TestResultsCacheMaxFreshness(t *testing.T) { var cfg ResultsCacheConfig flagext.DefaultValues(&cfg) cfg.CacheConfig.Cache = cache.NewMockCache() - c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger(), stats.ResultCache) + c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger()) require.NoError(t, err) fakeLimits := tc.fakeLimits rcm, err := NewResultsCacheMiddleware( @@ -898,7 +897,7 @@ func Test_resultsCache_MissingData(t *testing.T) { Cache: cache.NewMockCache(), }, } - c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger(), stats.ResultCache) + c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger()) require.NoError(t, err) rm, err := NewResultsCacheMiddleware( log.NewNopLogger(), @@ -1009,7 +1008,7 @@ func TestResultsCacheShouldCacheFunc(t *testing.T) { var cfg ResultsCacheConfig flagext.DefaultValues(&cfg) cfg.CacheConfig.Cache = cache.NewMockCache() - c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger(), stats.ResultCache) + c, err := cache.New(cfg.CacheConfig, nil, log.NewNopLogger()) require.NoError(t, err) rcm, err := NewResultsCacheMiddleware( log.NewNopLogger(), diff --git a/pkg/querier/queryrange/roundtrip.go b/pkg/querier/queryrange/roundtrip.go index 0f40e79770b30..d613fcd934230 100644 --- a/pkg/querier/queryrange/roundtrip.go +++ b/pkg/querier/queryrange/roundtrip.go @@ -15,7 +15,6 @@ import ( "github.com/grafana/loki/pkg/loghttp" "github.com/grafana/loki/pkg/logql/syntax" - "github.com/grafana/loki/pkg/logqlmodel/stats" "github.com/grafana/loki/pkg/querier/queryrange/queryrangebase" "github.com/grafana/loki/pkg/storage/chunk/cache" "github.com/grafana/loki/pkg/storage/config" @@ -53,7 +52,7 @@ func NewTripperware( err error ) if cfg.CacheResults { - c, err = cache.New(cfg.CacheConfig, registerer, log, stats.ResultCache) + c, err = cache.New(cfg.CacheConfig, registerer, log) if err != nil { return nil, nil, err } diff --git a/pkg/querier/queryrange/stats.go b/pkg/querier/queryrange/stats.go index 230650e298d5d..cc0c2b6b6e491 100644 --- a/pkg/querier/queryrange/stats.go +++ b/pkg/querier/queryrange/stats.go @@ -110,11 +110,8 @@ func StatsCollectorMiddleware() queryrangebase.Middleware { logger := spanlogger.FromContext(ctx) start := time.Now() - // start a new statistics context to be used by middleware, which we will merge with the response's statistics - st, statsCtx := stats.NewContext(ctx) - // execute the request - resp, err := next.Do(statsCtx, req) + resp, err := next.Do(ctx, req) // collect stats and status var statistics *stats.Result @@ -148,9 +145,6 @@ func StatsCollectorMiddleware() queryrangebase.Middleware { } if statistics != nil { - // merge the response's statistics with the stats collected by the middleware - statistics.Merge(st.Result(time.Since(start), 0, totalEntries)) - // Re-calculate the summary: the queueTime result is already merged so should not be updated // Log and record metrics for the current query statistics.ComputeSummary(time.Since(start), 0, totalEntries) diff --git a/pkg/storage/chunk/cache/cache.go b/pkg/storage/chunk/cache/cache.go index 8fe3d0e63aaae..9e2d5e8f9e6af 100644 --- a/pkg/storage/chunk/cache/cache.go +++ b/pkg/storage/chunk/cache/cache.go @@ -9,8 +9,6 @@ import ( "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" - - "github.com/grafana/loki/pkg/logqlmodel/stats" ) // Cache byte arrays by key. @@ -24,8 +22,6 @@ type Cache interface { Store(ctx context.Context, key []string, buf [][]byte) error Fetch(ctx context.Context, keys []string) (found []string, bufs [][]byte, missing []string, err error) Stop() - // GetCacheType returns a string indicating the cache "type" for the purpose of grouping cache usage statistics - GetCacheType() stats.CacheType } // Config for building Caches. @@ -87,7 +83,7 @@ func IsRedisSet(cfg Config) bool { } // New creates a new Cache using Config. -func New(cfg Config, reg prometheus.Registerer, logger log.Logger, cacheType stats.CacheType) (Cache, error) { +func New(cfg Config, reg prometheus.Registerer, logger log.Logger) (Cache, error) { if cfg.Cache != nil { return cfg.Cache, nil } @@ -99,8 +95,8 @@ func New(cfg Config, reg prometheus.Registerer, logger log.Logger, cacheType sta cfg.Fifocache.TTL = cfg.DefaultValidity } - if cache := NewFifoCache(cfg.Prefix+"fifocache", cfg.Fifocache, reg, logger, cacheType); cache != nil { - caches = append(caches, CollectStats(Instrument(cfg.Prefix+"fifocache", cache, reg))) + if cache := NewFifoCache(cfg.Prefix+"fifocache", cfg.Fifocache, reg, logger); cache != nil { + caches = append(caches, Instrument(cfg.Prefix+"fifocache", cache, reg)) } } @@ -114,10 +110,10 @@ func New(cfg Config, reg prometheus.Registerer, logger log.Logger, cacheType sta } client := NewMemcachedClient(cfg.MemcacheClient, cfg.Prefix, reg, logger) - cache := NewMemcached(cfg.Memcache, client, cfg.Prefix, reg, logger, cacheType) + cache := NewMemcached(cfg.Memcache, client, cfg.Prefix, reg, logger) cacheName := cfg.Prefix + "memcache" - caches = append(caches, CollectStats(NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache, reg), reg))) + caches = append(caches, NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache, reg), reg)) } if IsRedisSet(cfg) { @@ -129,8 +125,8 @@ func New(cfg Config, reg prometheus.Registerer, logger log.Logger, cacheType sta if err != nil { return nil, fmt.Errorf("redis client setup failed: %w", err) } - cache := NewRedisCache(cacheName, client, logger, cacheType) - caches = append(caches, CollectStats(NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache, reg), reg))) + cache := NewRedisCache(cacheName, client, logger) + caches = append(caches, NewBackground(cacheName, cfg.Background, Instrument(cacheName, cache, reg), reg)) } cache := NewTiered(caches) diff --git a/pkg/storage/chunk/cache/cache_gen.go b/pkg/storage/chunk/cache/cache_gen.go index 5bd7038aa4016..022cb5194b1c4 100644 --- a/pkg/storage/chunk/cache/cache_gen.go +++ b/pkg/storage/chunk/cache/cache_gen.go @@ -2,8 +2,6 @@ package cache import ( "context" - - "github.com/grafana/loki/pkg/logqlmodel/stats" ) type contextKey int @@ -46,10 +44,6 @@ func (c GenNumMiddleware) Stop() { c.downstreamCache.Stop() } -func (c GenNumMiddleware) GetCacheType() stats.CacheType { - return c.downstreamCache.GetCacheType() -} - // InjectCacheGenNumber returns a derived context containing the cache gen. func InjectCacheGenNumber(ctx context.Context, cacheGen string) context.Context { return context.WithValue(ctx, interface{}(cacheGenContextKey), cacheGen) diff --git a/pkg/storage/chunk/cache/cache_test.go b/pkg/storage/chunk/cache/cache_test.go index 6d75f45a8d7eb..50329b51c6603 100644 --- a/pkg/storage/chunk/cache/cache_test.go +++ b/pkg/storage/chunk/cache/cache_test.go @@ -188,7 +188,7 @@ func testCache(t *testing.T, cache cache.Cache) { func TestMemcache(t *testing.T) { t.Run("Unbatched", func(t *testing.T) { cache := cache.NewMemcached(cache.MemcachedConfig{}, newMockMemcache(), - "test", nil, log.NewNopLogger(), "test") + "test", nil, log.NewNopLogger()) testCache(t, cache) }) @@ -196,14 +196,14 @@ func TestMemcache(t *testing.T) { cache := cache.NewMemcached(cache.MemcachedConfig{ BatchSize: 10, Parallelism: 3, - }, newMockMemcache(), "test", nil, log.NewNopLogger(), "test") + }, newMockMemcache(), "test", nil, log.NewNopLogger()) testCache(t, cache) }) } func TestFifoCache(t *testing.T) { cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 1e3, TTL: 1 * time.Hour}, - nil, log.NewNopLogger(), "test") + nil, log.NewNopLogger()) testCache(t, cache) } diff --git a/pkg/storage/chunk/cache/fifo_cache.go b/pkg/storage/chunk/cache/fifo_cache.go index f2722466f5365..c7ee2c6fdad42 100644 --- a/pkg/storage/chunk/cache/fifo_cache.go +++ b/pkg/storage/chunk/cache/fifo_cache.go @@ -17,7 +17,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/grafana/loki/pkg/logqlmodel/stats" util_log "github.com/grafana/loki/pkg/util/log" ) @@ -72,8 +71,6 @@ func parsebytes(s string) (uint64, error) { // FifoCache is a simple string -> interface{} cache which uses a fifo slide to // manage evictions. O(1) inserts and updates, O(1) gets. type FifoCache struct { - cacheType stats.CacheType - lock sync.RWMutex maxSizeItems int maxSizeBytes uint64 @@ -107,7 +104,7 @@ type cacheEntry struct { } // NewFifoCache returns a new initialised FifoCache of size. -func NewFifoCache(name string, cfg FifoCacheConfig, reg prometheus.Registerer, logger log.Logger, cacheType stats.CacheType) *FifoCache { +func NewFifoCache(name string, cfg FifoCacheConfig, reg prometheus.Registerer, logger log.Logger) *FifoCache { util_log.WarnExperimentalUse(fmt.Sprintf("In-memory (FIFO) cache - %s", name), logger) if cfg.DeprecatedSize > 0 { @@ -136,8 +133,6 @@ func NewFifoCache(name string, cfg FifoCacheConfig, reg prometheus.Registerer, l } cache := &FifoCache{ - cacheType: cacheType, - maxSizeItems: cfg.MaxSizeItems, maxSizeBytes: maxSizeBytes, entries: make(map[string]*list.Element), @@ -292,10 +287,6 @@ func (c *FifoCache) Stop() { c.memoryBytes.Set(float64(0)) } -func (c *FifoCache) GetCacheType() stats.CacheType { - return c.cacheType -} - func (c *FifoCache) put(key string, value []byte) { // See if we already have the item in the cache. element, ok := c.entries[key] diff --git a/pkg/storage/chunk/cache/fifo_cache_test.go b/pkg/storage/chunk/cache/fifo_cache_test.go index 6bc7153b64bf4..a69d160c4622d 100644 --- a/pkg/storage/chunk/cache/fifo_cache_test.go +++ b/pkg/storage/chunk/cache/fifo_cache_test.go @@ -38,7 +38,7 @@ func TestFifoCacheEviction(t *testing.T) { } for _, test := range tests { - c := NewFifoCache(test.name, test.cfg, nil, log.NewNopLogger(), "test") + c := NewFifoCache(test.name, test.cfg, nil, log.NewNopLogger()) ctx := context.Background() // Check put / get works @@ -195,7 +195,7 @@ func TestFifoCacheExpiry(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - c := NewFifoCache(test.name, test.cfg, nil, log.NewNopLogger(), "test") + c := NewFifoCache(test.name, test.cfg, nil, log.NewNopLogger()) ctx := context.Background() err := c.Store(ctx, []string{key1, key2, key3, key4}, [][]byte{data1, data2, data3, data4}) diff --git a/pkg/storage/chunk/cache/memcached.go b/pkg/storage/chunk/cache/memcached.go index 57b5ba83e0e1a..8da4be22fa856 100644 --- a/pkg/storage/chunk/cache/memcached.go +++ b/pkg/storage/chunk/cache/memcached.go @@ -15,7 +15,6 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" instr "github.com/weaveworks/common/instrument" - "github.com/grafana/loki/pkg/logqlmodel/stats" util_log "github.com/grafana/loki/pkg/util/log" "github.com/grafana/loki/pkg/util/math" ) @@ -37,10 +36,9 @@ func (cfg *MemcachedConfig) RegisterFlagsWithPrefix(prefix, description string, // Memcached type caches chunks in memcached type Memcached struct { - cfg MemcachedConfig - memcache MemcachedClient - name string - cacheType stats.CacheType + cfg MemcachedConfig + memcache MemcachedClient + name string requestDuration *instr.HistogramCollector @@ -51,13 +49,12 @@ type Memcached struct { } // NewMemcached makes a new Memcached. -func NewMemcached(cfg MemcachedConfig, client MemcachedClient, name string, reg prometheus.Registerer, logger log.Logger, cacheType stats.CacheType) *Memcached { +func NewMemcached(cfg MemcachedConfig, client MemcachedClient, name string, reg prometheus.Registerer, logger log.Logger) *Memcached { c := &Memcached{ - cfg: cfg, - memcache: client, - name: name, - logger: logger, - cacheType: cacheType, + cfg: cfg, + memcache: client, + name: name, + logger: logger, requestDuration: instr.NewHistogramCollector( promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ Namespace: "loki", @@ -237,10 +234,6 @@ func (c *Memcached) Stop() { c.wg.Wait() } -func (c *Memcached) GetCacheType() stats.CacheType { - return c.cacheType -} - // HashKey hashes key into something you can store in memcached. func HashKey(key string) string { hasher := fnv.New64a() diff --git a/pkg/storage/chunk/cache/memcached_test.go b/pkg/storage/chunk/cache/memcached_test.go index 210be024c1b30..d16a906619111 100644 --- a/pkg/storage/chunk/cache/memcached_test.go +++ b/pkg/storage/chunk/cache/memcached_test.go @@ -18,7 +18,7 @@ func TestMemcached(t *testing.T) { t.Run("unbatched", func(t *testing.T) { client := newMockMemcache() memcache := cache.NewMemcached(cache.MemcachedConfig{}, client, - "test", nil, log.NewNopLogger(), "test") + "test", nil, log.NewNopLogger()) testMemcache(t, memcache) }) @@ -28,7 +28,7 @@ func TestMemcached(t *testing.T) { memcache := cache.NewMemcached(cache.MemcachedConfig{ BatchSize: 10, Parallelism: 5, - }, client, "test", nil, log.NewNopLogger(), "test") + }, client, "test", nil, log.NewNopLogger()) testMemcache(t, memcache) }) @@ -95,7 +95,7 @@ func TestMemcacheFailure(t *testing.T) { t.Run("unbatched", func(t *testing.T) { client := newMockMemcacheFailing() memcache := cache.NewMemcached(cache.MemcachedConfig{}, client, - "test", nil, log.NewNopLogger(), "test") + "test", nil, log.NewNopLogger()) testMemcacheFailing(t, memcache) }) @@ -105,7 +105,7 @@ func TestMemcacheFailure(t *testing.T) { memcache := cache.NewMemcached(cache.MemcachedConfig{ BatchSize: 10, Parallelism: 5, - }, client, "test", nil, log.NewNopLogger(), "test") + }, client, "test", nil, log.NewNopLogger()) testMemcacheFailing(t, memcache) }) diff --git a/pkg/storage/chunk/cache/mock.go b/pkg/storage/chunk/cache/mock.go index 8064e793eb47d..7cc0cad7a0606 100644 --- a/pkg/storage/chunk/cache/mock.go +++ b/pkg/storage/chunk/cache/mock.go @@ -3,8 +3,6 @@ package cache import ( "context" "sync" - - "github.com/grafana/loki/pkg/logqlmodel/stats" ) type mockCache struct { @@ -39,10 +37,6 @@ func (m *mockCache) Fetch(ctx context.Context, keys []string) (found []string, b func (m *mockCache) Stop() { } -func (m *mockCache) GetCacheType() stats.CacheType { - return "mock" -} - // NewMockCache makes a new MockCache. func NewMockCache() Cache { return &mockCache{ diff --git a/pkg/storage/chunk/cache/redis_cache.go b/pkg/storage/chunk/cache/redis_cache.go index 5a4f9f73b87a7..ec3491db7e7d6 100644 --- a/pkg/storage/chunk/cache/redis_cache.go +++ b/pkg/storage/chunk/cache/redis_cache.go @@ -7,26 +7,23 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" - "github.com/grafana/loki/pkg/logqlmodel/stats" util_log "github.com/grafana/loki/pkg/util/log" ) // RedisCache type caches chunks in redis type RedisCache struct { - name string - cacheType stats.CacheType - redis *RedisClient - logger log.Logger + name string + redis *RedisClient + logger log.Logger } // NewRedisCache creates a new RedisCache -func NewRedisCache(name string, redisClient *RedisClient, logger log.Logger, cacheType stats.CacheType) *RedisCache { +func NewRedisCache(name string, redisClient *RedisClient, logger log.Logger) *RedisCache { util_log.WarnExperimentalUse(fmt.Sprintf("Redis cache - %s", name), logger) cache := &RedisCache{ - name: name, - redis: redisClient, - logger: logger, - cacheType: cacheType, + name: name, + redis: redisClient, + logger: logger, } if err := cache.redis.Ping(context.Background()); err != nil { level.Error(logger).Log("msg", "error connecting to redis", "name", name, "err", err) @@ -67,7 +64,3 @@ func (c *RedisCache) Store(ctx context.Context, keys []string, bufs [][]byte) er func (c *RedisCache) Stop() { _ = c.redis.Close() } - -func (c *RedisCache) GetCacheType() stats.CacheType { - return c.cacheType -} diff --git a/pkg/storage/chunk/cache/redis_cache_test.go b/pkg/storage/chunk/cache/redis_cache_test.go index 0215b5702e74a..3048473dba911 100644 --- a/pkg/storage/chunk/cache/redis_cache_test.go +++ b/pkg/storage/chunk/cache/redis_cache_test.go @@ -64,5 +64,5 @@ func mockRedisCache() (*RedisCache, error) { Addrs: []string{redisServer.Addr()}, }), } - return NewRedisCache("mock", redisClient, log.NewNopLogger(), "test"), nil + return NewRedisCache("mock", redisClient, log.NewNopLogger()), nil } diff --git a/pkg/storage/chunk/cache/snappy.go b/pkg/storage/chunk/cache/snappy.go index 000827d1bcff5..9fa708888d367 100644 --- a/pkg/storage/chunk/cache/snappy.go +++ b/pkg/storage/chunk/cache/snappy.go @@ -6,8 +6,6 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/golang/snappy" - - "github.com/grafana/loki/pkg/logqlmodel/stats" ) type snappyCache struct { @@ -49,7 +47,3 @@ func (s *snappyCache) Fetch(ctx context.Context, keys []string) ([]string, [][]b func (s *snappyCache) Stop() { s.next.Stop() } - -func (c *snappyCache) GetCacheType() stats.CacheType { - return c.next.GetCacheType() -} diff --git a/pkg/storage/chunk/cache/stats.go b/pkg/storage/chunk/cache/stats.go deleted file mode 100644 index 9964532ad8456..0000000000000 --- a/pkg/storage/chunk/cache/stats.go +++ /dev/null @@ -1,53 +0,0 @@ -package cache - -import ( - "context" - - "github.com/grafana/loki/pkg/logqlmodel/stats" -) - -type statsCollector struct { - Cache -} - -// CollectStats returns a new Cache that keeps various statistics on cache usage. -func CollectStats(cache Cache) Cache { - return &statsCollector{ - Cache: cache, - } -} - -func (s statsCollector) Store(ctx context.Context, keys []string, bufs [][]byte) error { - st := stats.FromContext(ctx) - st.AddCacheRequest(s.Cache.GetCacheType(), 1) - - // we blindly count the number of keys to be stored since we can't know if these will actually be written back to - // the cache successfully if cache.backgroundCache is in use - st.AddCacheEntriesStored(s.Cache.GetCacheType(), len(keys)) - - return s.Cache.Store(ctx, keys, bufs) -} - -func (s statsCollector) Fetch(ctx context.Context, keys []string) (found []string, bufs [][]byte, missing []string, err error) { - st := stats.FromContext(ctx) - st.AddCacheRequest(s.Cache.GetCacheType(), 1) - - found, bufs, missing, err = s.Cache.Fetch(ctx, keys) - - st.AddCacheEntriesFound(s.Cache.GetCacheType(), len(found)) - st.AddCacheEntriesRequested(s.Cache.GetCacheType(), len(keys)) - - for j := range bufs { - st.AddCacheBytesRetrieved(s.Cache.GetCacheType(), len(bufs[j])) - } - - return found, bufs, missing, err -} - -func (s statsCollector) Stop() { - s.Cache.Stop() -} - -func (s statsCollector) GetCacheType() stats.CacheType { - return s.Cache.GetCacheType() -} diff --git a/pkg/storage/chunk/cache/tiered.go b/pkg/storage/chunk/cache/tiered.go index 5ff128d34d34e..ea8b7192108b0 100644 --- a/pkg/storage/chunk/cache/tiered.go +++ b/pkg/storage/chunk/cache/tiered.go @@ -1,10 +1,6 @@ package cache -import ( - "context" - - "github.com/grafana/loki/pkg/logqlmodel/stats" -) +import "context" type tiered []Cache @@ -82,7 +78,3 @@ func (t tiered) Stop() { c.Stop() } } - -func (t tiered) GetCacheType() stats.CacheType { - return "tiered" -} diff --git a/pkg/storage/chunk/fetcher/fetcher.go b/pkg/storage/chunk/fetcher/fetcher.go index fa4ed43619141..94e7e82b76869 100644 --- a/pkg/storage/chunk/fetcher/fetcher.go +++ b/pkg/storage/chunk/fetcher/fetcher.go @@ -10,7 +10,6 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/prometheus/promql" - "github.com/grafana/loki/pkg/logqlmodel/stats" "github.com/grafana/loki/pkg/storage/chunk" "github.com/grafana/loki/pkg/storage/chunk/cache" "github.com/grafana/loki/pkg/storage/chunk/client" @@ -183,17 +182,6 @@ func (c *Fetcher) FetchChunks(ctx context.Context, chunks []chunk.Chunk, keys [] fromStorage, err = c.storage.GetChunks(ctx, missing) } - // normally these stats would be collected by the cache.statsCollector wrapper, but chunks are written back - // to the cache asynchronously in the background and we lose the context - var bytes int - for _, c := range fromStorage { - bytes += c.Size() - } - - st := stats.FromContext(ctx) - st.AddCacheEntriesStored(stats.ChunkCache, len(fromStorage)) - st.AddCacheBytesSent(stats.ChunkCache, bytes) - // Always cache any chunks we did get if cacheErr := c.writeBackCacheAsync(fromStorage); cacheErr != nil { if cacheErr == errAsyncBufferFull { diff --git a/pkg/storage/chunk/tests/caching_fixtures_test.go b/pkg/storage/chunk/tests/caching_fixtures_test.go index 44404afe50c02..3d8c45a946a45 100644 --- a/pkg/storage/chunk/tests/caching_fixtures_test.go +++ b/pkg/storage/chunk/tests/caching_fixtures_test.go @@ -8,7 +8,6 @@ import ( "github.com/grafana/dskit/flagext" "github.com/prometheus/client_golang/prometheus" - "github.com/grafana/loki/pkg/logqlmodel/stats" "github.com/grafana/loki/pkg/storage/chunk/cache" "github.com/grafana/loki/pkg/storage/chunk/client" "github.com/grafana/loki/pkg/storage/chunk/client/gcp" @@ -34,7 +33,7 @@ func (f fixture) Clients() (index.Client, client.Client, index.TableClient, conf indexClient = index.NewCachingIndexClient(indexClient, cache.NewFifoCache("index-fifo", cache.FifoCacheConfig{ MaxSizeItems: 500, TTL: 5 * time.Minute, - }, reg, logger, stats.ChunkCache), 5*time.Minute, limits, logger, false) + }, reg, logger), 5*time.Minute, limits, logger, false) return indexClient, chunkClient, tableClient, schemaConfig, closer, err } diff --git a/pkg/storage/store.go b/pkg/storage/store.go index 20bc005aa8336..9a2540b646a9c 100644 --- a/pkg/storage/store.go +++ b/pkg/storage/store.go @@ -88,19 +88,19 @@ func NewStore(cfg Config, storeCfg config.ChunkStoreConfig, schemaCfg config.Sch } } - indexReadCache, err := cache.New(cfg.IndexQueriesCacheConfig, registerer, logger, stats.IndexCache) + indexReadCache, err := cache.New(cfg.IndexQueriesCacheConfig, registerer, logger) if err != nil { return nil, err } - writeDedupeCache, err := cache.New(storeCfg.WriteDedupeCacheConfig, registerer, logger, stats.WriteDedupeCache) + writeDedupeCache, err := cache.New(storeCfg.WriteDedupeCacheConfig, registerer, logger) if err != nil { return nil, err } chunkCacheCfg := storeCfg.ChunkCacheConfig chunkCacheCfg.Prefix = "chunks" - chunksCache, err := cache.New(chunkCacheCfg, registerer, logger, stats.ChunkCache) + chunksCache, err := cache.New(chunkCacheCfg, registerer, logger) if err != nil { return nil, err } @@ -154,7 +154,7 @@ func (s *store) init() error { if err != nil { return err } - f, err := fetcher.New(cache.CollectStats(s.chunksCache), s.storeCfg.ChunkCacheStubs(), s.schemaCfg, chunkClient, s.storeCfg.ChunkCacheConfig.AsyncCacheWriteBackConcurrency, s.storeCfg.ChunkCacheConfig.AsyncCacheWriteBackBufferSize) + f, err := fetcher.New(s.chunksCache, s.storeCfg.ChunkCacheStubs(), s.schemaCfg, chunkClient, s.storeCfg.ChunkCacheConfig.AsyncCacheWriteBackConcurrency, s.storeCfg.ChunkCacheConfig.AsyncCacheWriteBackBufferSize) if err != nil { return err } diff --git a/pkg/storage/stores/series/index/caching_index_client_test.go b/pkg/storage/stores/series/index/caching_index_client_test.go index 7c934740a4f94..b1962ad41735d 100644 --- a/pkg/storage/stores/series/index/caching_index_client_test.go +++ b/pkg/storage/stores/series/index/caching_index_client_test.go @@ -49,7 +49,7 @@ func TestCachingStorageClientBasic(t *testing.T) { limits, err := defaultLimits() require.NoError(t, err) logger := log.NewNopLogger() - cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger, "test") + cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger) client := index.NewCachingIndexClient(store, cache, 1*time.Second, limits, logger, false) queries := []index.Query{{ TableName: "table", @@ -81,7 +81,7 @@ func TestTempCachingStorageClient(t *testing.T) { limits, err := defaultLimits() require.NoError(t, err) logger := log.NewNopLogger() - cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger, "test") + cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger) client := index.NewCachingIndexClient(store, cache, 100*time.Millisecond, limits, logger, false) queries := []index.Query{ {TableName: "table", HashValue: "foo"}, @@ -140,7 +140,7 @@ func TestPermCachingStorageClient(t *testing.T) { limits, err := defaultLimits() require.NoError(t, err) logger := log.NewNopLogger() - cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger, "test") + cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger) client := index.NewCachingIndexClient(store, cache, 100*time.Millisecond, limits, logger, false) queries := []index.Query{ {TableName: "table", HashValue: "foo", Immutable: true}, @@ -196,7 +196,7 @@ func TestCachingStorageClientEmptyResponse(t *testing.T) { limits, err := defaultLimits() require.NoError(t, err) logger := log.NewNopLogger() - cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger, "test") + cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger) client := index.NewCachingIndexClient(store, cache, 1*time.Second, limits, logger, false) queries := []index.Query{{TableName: "table", HashValue: "foo"}} err = client.QueryPages(ctx, queries, func(query index.Query, batch index.ReadBatchResult) bool { @@ -235,7 +235,7 @@ func TestCachingStorageClientCollision(t *testing.T) { limits, err := defaultLimits() require.NoError(t, err) logger := log.NewNopLogger() - cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger, "test") + cache := cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger) client := index.NewCachingIndexClient(store, cache, 1*time.Second, limits, logger, false) queries := []index.Query{ {TableName: "table", HashValue: "foo", RangeValuePrefix: []byte("bar")}, @@ -415,7 +415,7 @@ func TestCachingStorageClientStoreQueries(t *testing.T) { require.NoError(t, err) logger := log.NewNopLogger() cache := &mockCache{ - Cache: cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger, "test"), + Cache: cache.NewFifoCache("test", cache.FifoCacheConfig{MaxSizeItems: 10, TTL: 10 * time.Second}, nil, logger), } client := index.NewCachingIndexClient(store, cache, 1*time.Second, limits, logger, disableBroadQueries) var callbackQueries []index.Query diff --git a/pkg/storage/stores/series/series_store_test.go b/pkg/storage/stores/series/series_store_test.go index 3f4e9b1538c53..9160ef34c4f27 100644 --- a/pkg/storage/stores/series/series_store_test.go +++ b/pkg/storage/stores/series/series_store_test.go @@ -19,7 +19,6 @@ import ( "github.com/weaveworks/common/user" "github.com/grafana/loki/pkg/ingester/client" - "github.com/grafana/loki/pkg/logqlmodel/stats" "github.com/grafana/loki/pkg/storage" "github.com/grafana/loki/pkg/storage/chunk" "github.com/grafana/loki/pkg/storage/chunk/cache" @@ -55,7 +54,7 @@ var ( flagext.DefaultValues(&storeCfg) storeCfg.WriteDedupeCacheConfig.Cache = cache.NewFifoCache("test", cache.FifoCacheConfig{ MaxSizeItems: 500, - }, prometheus.NewRegistry(), log.NewNopLogger(), stats.ChunkCache) + }, prometheus.NewRegistry(), log.NewNopLogger()) return storeCfg }, }, diff --git a/pkg/storage/util_test.go b/pkg/storage/util_test.go index c2be1a2d51a80..291948e5b4c41 100644 --- a/pkg/storage/util_test.go +++ b/pkg/storage/util_test.go @@ -15,7 +15,6 @@ import ( "github.com/grafana/loki/pkg/ingester/client" "github.com/grafana/loki/pkg/logproto" "github.com/grafana/loki/pkg/logql/syntax" - "github.com/grafana/loki/pkg/logqlmodel/stats" "github.com/grafana/loki/pkg/querier/astmapper" "github.com/grafana/loki/pkg/storage/chunk" "github.com/grafana/loki/pkg/storage/chunk/cache" @@ -243,7 +242,7 @@ func (m *mockChunkStore) GetChunkRefs(ctx context.Context, userID string, from, refs = append(refs, r) } - cache, err := cache.New(cache.Config{Prefix: "chunks"}, nil, util_log.Logger, stats.ChunkCache) + cache, err := cache.New(cache.Config{Prefix: "chunks"}, nil, util_log.Logger) if err != nil { panic(err) } diff --git a/pkg/util/marshal/legacy/marshal_test.go b/pkg/util/marshal/legacy/marshal_test.go index cf8a18b7bbd41..e565c40aabeab 100644 --- a/pkg/util/marshal/legacy/marshal_test.go +++ b/pkg/util/marshal/legacy/marshal_test.go @@ -78,32 +78,6 @@ var queryTests = []struct { } } }, - "cache": { - "chunk": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "index": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "result": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - } - }, "summary": { "bytesProcessedPerSecond": 0, "execTime": 0, diff --git a/pkg/util/marshal/marshal_test.go b/pkg/util/marshal/marshal_test.go index 38b7cc74dca6e..d11db731b492f 100644 --- a/pkg/util/marshal/marshal_test.go +++ b/pkg/util/marshal/marshal_test.go @@ -84,32 +84,6 @@ var queryTests = []struct { } } }, - "cache": { - "chunk": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "index": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "result": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - } - }, "summary": { "bytesProcessedPerSecond": 0, "execTime": 0, @@ -220,32 +194,6 @@ var queryTests = []struct { } } }, - "cache": { - "chunk": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "index": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "result": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - } - }, "summary": { "bytesProcessedPerSecond": 0, "execTime": 0, @@ -373,32 +321,6 @@ var queryTests = []struct { } } }, - "cache": { - "chunk": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "index": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - }, - "result": { - "entriesFound": 0, - "entriesRequested": 0, - "entriesStored": 0, - "bytesReceived": 0, - "bytesSent": 0, - "requests": 0 - } - }, "summary": { "bytesProcessedPerSecond": 0, "execTime": 0,