diff --git a/pkg/api/query/querypb/query.pb.go b/pkg/api/query/querypb/query.pb.go index 9ec2460a8a8..dc6a40e0644 100644 --- a/pkg/api/query/querypb/query.pb.go +++ b/pkg/api/query/querypb/query.pb.go @@ -352,78 +352,6 @@ func (*QueryPlan) XXX_OneofWrappers() []interface{} { } } -type QueryPlan struct { - // Types that are valid to be assigned to Encoding: - // *QueryPlan_Json - Encoding isQueryPlan_Encoding `protobuf_oneof:"encoding"` -} - -func (m *QueryPlan) Reset() { *m = QueryPlan{} } -func (m *QueryPlan) String() string { return proto.CompactTextString(m) } -func (*QueryPlan) ProtoMessage() {} -func (*QueryPlan) Descriptor() ([]byte, []int) { - return fileDescriptor_4b2aba43925d729f, []int{3} -} -func (m *QueryPlan) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryPlan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryPlan.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 *QueryPlan) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryPlan.Merge(m, src) -} -func (m *QueryPlan) XXX_Size() int { - return m.Size() -} -func (m *QueryPlan) XXX_DiscardUnknown() { - xxx_messageInfo_QueryPlan.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryPlan proto.InternalMessageInfo - -type isQueryPlan_Encoding interface { - isQueryPlan_Encoding() - MarshalTo([]byte) (int, error) - Size() int -} - -type QueryPlan_Json struct { - Json []byte `protobuf:"bytes,1,opt,name=json,proto3,oneof" json:"json,omitempty"` -} - -func (*QueryPlan_Json) isQueryPlan_Encoding() {} - -func (m *QueryPlan) GetEncoding() isQueryPlan_Encoding { - if m != nil { - return m.Encoding - } - return nil -} - -func (m *QueryPlan) GetJson() []byte { - if x, ok := m.GetEncoding().(*QueryPlan_Json); ok { - return x.Json - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*QueryPlan) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*QueryPlan_Json)(nil), - } -} - type QueryRangeRequest struct { Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` QueryPlan *QueryPlan `protobuf:"bytes,16,opt,name=queryPlan,proto3" json:"queryPlan,omitempty"` @@ -2449,89 +2377,6 @@ func (m *QueryPlan) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryPlan) 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 ErrIntOverflowQuery - } - 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: queryPlan: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: queryPlan: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Json", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Encoding = &QueryPlan_Json{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryRangeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3180,4 +3025,4 @@ var ( ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) +) \ No newline at end of file diff --git a/pkg/logging/options.go b/pkg/logging/options.go index 2b4ed3190ea..0d3afbd6fe8 100644 --- a/pkg/logging/options.go +++ b/pkg/logging/options.go @@ -6,6 +6,7 @@ package logging import ( "context" "fmt" + "math/rand" "time" "github.com/oklog/ulid" diff --git a/pkg/queryfrontend/queryinstant_codec.go b/pkg/queryfrontend/queryinstant_codec.go index 4b3452185f7..a44bb7d94ec 100644 --- a/pkg/queryfrontend/queryinstant_codec.go +++ b/pkg/queryfrontend/queryinstant_codec.go @@ -20,7 +20,6 @@ import ( "github.com/prometheus/prometheus/promql/parser" "github.com/weaveworks/common/httpgrpc" - "github.com/prometheus/prometheus/promql/parser" "github.com/thanos-io/thanos/internal/cortex/cortexpb" "github.com/thanos-io/thanos/internal/cortex/querier/queryrange" cortexutil "github.com/thanos-io/thanos/internal/cortex/util" diff --git a/pkg/querysharding/analyzer.go b/pkg/querysharding/analyzer.go index c07b943a214..80cb8cb3a8a 100644 --- a/pkg/querysharding/analyzer.go +++ b/pkg/querysharding/analyzer.go @@ -30,10 +30,6 @@ var ( notShardableErr = fmt.Errorf("expressions are not shardable") ) -var ( - notShardableErr = fmt.Errorf("expressions are not shardable") -) - type Analyzer interface { Analyze(string) (QueryAnalysis, error) } diff --git a/pkg/receive/multitsdb.go b/pkg/receive/multitsdb.go index 30dc7fb2aba..a133c28bb02 100644 --- a/pkg/receive/multitsdb.go +++ b/pkg/receive/multitsdb.go @@ -272,7 +272,7 @@ func (t *tenant) store() *store.TSDBStore { return t.storeTSDB } -func (t *tenant) client(logger log.Logger) store.Client { +func (t *tenant) client() store.Client { t.mtx.RLock() defer t.mtx.RUnlock() diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 9f4ce5ae6b3..75a85dd9fbc 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -1072,11 +1072,6 @@ func newBlockSeriesClient( extLset = rmLabels(extLset.Copy(), extLsetToRemove) } - extLset := b.extLset - if extLsetToRemove != nil { - extLset = rmLabels(extLset.Copy(), extLsetToRemove) - } - return &blockSeriesClient{ ctx: ctx, logger: logger, @@ -2963,7 +2958,6 @@ func (r *bucketIndexReader) fetchPostings(ctx context.Context, keys []labels.Lab if err := bytesLimiter.ReserveWithType(uint64(len(dataFromCache)), PostingsTouched); err != nil { return nil, closeFns, httpgrpc.Errorf(int(codes.ResourceExhausted), "exceeded bytes limit while loading postings from index cache: %s", err) } - r.stats.DataDownloadedSizeSum += units.Base2Bytes(len(dataFromCache)) } // Iterate over all groups and fetch posting from cache. @@ -3019,7 +3013,6 @@ func (r *bucketIndexReader) fetchPostings(ctx context.Context, keys []labels.Lab if err := bytesLimiter.ReserveWithType(uint64(length), PostingsFetched); err != nil { return nil, closeFns, httpgrpc.Errorf(int(codes.ResourceExhausted), "exceeded bytes limit while fetching postings: %s", err) } - r.stats.DataDownloadedSizeSum += units.Base2Bytes(length) } g, ctx := errgroup.WithContext(ctx) @@ -3195,7 +3188,6 @@ func (r *bucketIndexReader) PreloadSeries(ctx context.Context, ids []storage.Ser if err := bytesLimiter.ReserveWithType(uint64(len(b)), SeriesTouched); err != nil { return httpgrpc.Errorf(int(codes.ResourceExhausted), "exceeded bytes limit while loading series from index cache: %s", err) } - r.stats.DataDownloadedSizeSum += units.Base2Bytes(len(b)) } parts := r.block.partitioner.Partition(len(ids), func(i int) (start, end uint64) { @@ -3526,7 +3518,6 @@ func (r *bucketChunkReader) load(ctx context.Context, res []seriesEntry, aggrs [ if err := bytesLimiter.ReserveWithType(uint64(p.End-p.Start), ChunksFetched); err != nil { return httpgrpc.Errorf(int(codes.ResourceExhausted), "exceeded bytes limit while fetching chunks: %s", err) } - r.stats.DataDownloadedSizeSum += units.Base2Bytes(p.End - p.Start) } for _, p := range parts { diff --git a/pkg/store/proxy_test.go b/pkg/store/proxy_test.go index c4571de9762..137383fa57a 100644 --- a/pkg/store/proxy_test.go +++ b/pkg/store/proxy_test.go @@ -1842,7 +1842,7 @@ func TestStoreMatches(t *testing.T) { }, } { t.Run("", func(t *testing.T) { - ok, reason := storeMatches(context.TODO(), c.s, true, c.mint, c.maxt, c.ms...) + ok, reason := storeMatches(context.TODO(), c.s, c.mint, c.maxt, c.ms...) testutil.Equals(t, c.expectedMatch, ok) testutil.Equals(t, c.expectedReason, reason)