diff --git a/cmd/thanos/receive.go b/cmd/thanos/receive.go index 5204f17986..75c5e6ad01 100644 --- a/cmd/thanos/receive.go +++ b/cmd/thanos/receive.go @@ -21,6 +21,7 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/tsdb" + "github.com/thanos-io/thanos/pkg/extkingpin" "github.com/thanos-io/thanos/pkg/component" @@ -85,6 +86,7 @@ func registerReceive(app *extkingpin.App) { tsdbMinBlockDuration := extkingpin.ModelDuration(cmd.Flag("tsdb.min-block-duration", "Min duration for local TSDB blocks").Default("2h").Hidden()) tsdbMaxBlockDuration := extkingpin.ModelDuration(cmd.Flag("tsdb.max-block-duration", "Max duration for local TSDB blocks").Default("2h").Hidden()) + walCompression := cmd.Flag("tsdb.wal-compression", "Compress the tsdb WAL.").Default("true").Bool() noLockFile := cmd.Flag("tsdb.no-lockfile", "Do not create lockfile in TSDB data directory. In any case, the lockfiles will be deleted on next startup.").Default("false").Bool() diff --git a/pkg/receive/handler.go b/pkg/receive/handler.go index 4a51b5213f..b456d204b2 100644 --- a/pkg/receive/handler.go +++ b/pkg/receive/handler.go @@ -50,6 +50,7 @@ const ( DefaultTenantLabel = "tenant_id" // DefaultReplicaHeader is the default header used to designate the replica count of a write request. DefaultReplicaHeader = "THANOS-REPLICA" + // Labels for metrics. labelSuccess = "success" labelError = "error" @@ -94,9 +95,10 @@ type Handler struct { expBackoff backoff.Backoff peerStates map[string]*retryState - forwardRequests *prometheus.CounterVec - replications *prometheus.CounterVec - replicationFactor prometheus.Gauge + forwardRequests *prometheus.CounterVec + forwardRequestConfigurationMismatch prometheus.Counter + replications *prometheus.CounterVec + replicationFactor prometheus.Gauge } func NewHandler(logger log.Logger, o *Options) *Handler { @@ -122,6 +124,12 @@ func NewHandler(logger log.Logger, o *Options) *Handler { Help: "The number of forward requests.", }, []string{"result"}, ), + forwardRequestConfigurationMismatch: promauto.With(o.Registry).NewCounter( + prometheus.CounterOpts{ + Name: "thanos_receive_forward_request_config_mismatches_total", + Help: "The number of forward requests that have mismatching configurations.", + }, + ), replications: promauto.With(o.Registry).NewCounterVec( prometheus.CounterOpts{ Name: "thanos_receive_replications_total", @@ -250,12 +258,17 @@ type replica struct { replicated bool } -func (h *Handler) handleRequest(ctx context.Context, rep uint64, tenant string, wreq *prompb.WriteRequest) error { +func (h *Handler) handleRequest(ctx context.Context, rep uint64, tenant string, config string, wreq *prompb.WriteRequest) error { // The replica value in the header is one-indexed, thus we need >. if rep > h.options.ReplicationFactor { return errBadReplica } + if h.hashring.ConfigHash() != config { + h.forwardRequestConfigurationMismatch.Inc() + level.Warn(h.logger).Log("msg", "hasring configuration mismatch", "current", h.hashring.ConfigHash(), "received", config) + } + r := replica{ n: rep, replicated: rep != 0, @@ -315,7 +328,7 @@ func (h *Handler) receiveHTTP(w http.ResponseWriter, r *http.Request) { tenant = h.options.DefaultTenantID } - err = h.handleRequest(ctx, rep, tenant, &wreq) + err = h.handleRequest(ctx, rep, tenant, h.hashring.ConfigHash(), &wreq) switch err { case nil: return @@ -513,6 +526,7 @@ func (h *Handler) fanoutForward(pctx context.Context, tenant string, replicas ma Tenant: tenant, // Increment replica since on-the-wire format is 1-indexed and 0 indicates un-replicated. Replica: int64(replicas[endpoint].n + 1), + Config: h.hashring.ConfigHash(), }) }) if err != nil { @@ -634,7 +648,7 @@ func (h *Handler) RemoteWrite(ctx context.Context, r *storepb.WriteRequest) (*st span, ctx := tracing.StartSpan(ctx, "receive_grpc") defer span.Finish() - err := h.handleRequest(ctx, uint64(r.Replica), r.Tenant, &prompb.WriteRequest{Timeseries: r.Timeseries}) + err := h.handleRequest(ctx, uint64(r.Replica), r.Tenant, r.Config, &prompb.WriteRequest{Timeseries: r.Timeseries}) switch err { case nil: return &storepb.WriteResponse{}, nil diff --git a/pkg/receive/hashring.go b/pkg/receive/hashring.go index ef6c94390a..78b793ffc8 100644 --- a/pkg/receive/hashring.go +++ b/pkg/receive/hashring.go @@ -5,12 +5,14 @@ package receive import ( "context" + "crypto/sha256" "fmt" "sort" "sync" "github.com/cespare/xxhash" "github.com/pkg/errors" + "github.com/thanos-io/thanos/pkg/store/storepb/prompb" ) @@ -36,6 +38,8 @@ type Hashring interface { Get(tenant string, timeSeries *prompb.TimeSeries) (string, error) // GetN returns the nth node that should handle the given tenant and time series. GetN(tenant string, timeSeries *prompb.TimeSeries, n uint64) (string, error) + // ConfigHash string returns the hash of the loaded configuration. + ConfigHash() string } // hash returns a hash for the given tenant and time series. @@ -71,6 +75,11 @@ func (s SingleNodeHashring) GetN(_ string, _ *prompb.TimeSeries, n uint64) (stri return string(s), nil } +// ConfigHash implements the Hashring interface. +func (s SingleNodeHashring) ConfigHash() string { + return string(s) +} + // simpleHashring represents a group of nodes handling write requests. type simpleHashring []string @@ -87,6 +96,15 @@ func (s simpleHashring) GetN(tenant string, ts *prompb.TimeSeries, n uint64) (st return s[(hash(tenant, ts)+n)%uint64(len(s))], nil } +// ConfigHash string returns the hash of the loaded configuration. +func (s simpleHashring) ConfigHash() string { + h := sha256.New() + for _, v := range s { + _, _ = h.Write([]byte(v)) + } + return string(h.Sum(nil)) +} + // multiHashring represents a set of hashrings. // Which hashring to use for a tenant is determined // by the tenants field of the hashring configuration. @@ -135,6 +153,15 @@ func (m *multiHashring) GetN(tenant string, ts *prompb.TimeSeries, n uint64) (st return "", errors.New("no matching hashring to handle tenant") } +// ConfigHash string returns the hash of the loaded configuration. +func (m *multiHashring) ConfigHash() string { + h := sha256.New() + for _, v := range m.hashrings { + _, _ = h.Write([]byte(v.ConfigHash())) + } + return string(h.Sum(nil)) +} + // newMultiHashring creates a multi-tenant hashring for a given slice of // groups. // Which hashring to use for a tenant is determined diff --git a/pkg/store/storepb/rpc.pb.go b/pkg/store/storepb/rpc.pb.go index 3eec6a4720..de69dd4475 100644 --- a/pkg/store/storepb/rpc.pb.go +++ b/pkg/store/storepb/rpc.pb.go @@ -150,6 +150,7 @@ type WriteRequest struct { Timeseries []prompb.TimeSeries `protobuf:"bytes,1,rep,name=timeseries,proto3" json:"timeseries"` Tenant string `protobuf:"bytes,2,opt,name=tenant,proto3" json:"tenant,omitempty"` Replica int64 `protobuf:"varint,3,opt,name=replica,proto3" json:"replica,omitempty"` + Config string `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` } func (m *WriteRequest) Reset() { *m = WriteRequest{} } @@ -606,73 +607,74 @@ func init() { func init() { proto.RegisterFile("store/storepb/rpc.proto", fileDescriptor_a938d55a388af629) } var fileDescriptor_a938d55a388af629 = []byte{ - // 1045 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0x7a, 0xfd, 0xf9, 0x9c, 0x84, 0xed, 0xc4, 0x49, 0x37, 0xae, 0xe4, 0x58, 0x96, 0x90, - 0xac, 0xa8, 0xd8, 0x60, 0x50, 0x25, 0x50, 0x2f, 0x76, 0x62, 0x48, 0x44, 0xe3, 0xc0, 0x38, 0x6e, - 0xa0, 0x08, 0x59, 0x6b, 0x67, 0xba, 0x5e, 0xc5, 0xfb, 0xc1, 0xce, 0x98, 0xc4, 0x37, 0x04, 0x77, - 0x84, 0xb8, 0xf0, 0x17, 0x21, 0xe5, 0xd8, 0x23, 0xe2, 0x50, 0x41, 0xf2, 0x8f, 0xa0, 0xf9, 0x58, - 0xdb, 0x1b, 0xd2, 0xe6, 0x90, 0x5e, 0xac, 0x79, 0xef, 0xf7, 0x3e, 0x7e, 0xf3, 0x7e, 0x33, 0xe3, - 0x85, 0x87, 0x94, 0xf9, 0x21, 0x69, 0x88, 0xdf, 0x60, 0xd8, 0x08, 0x83, 0x51, 0x3d, 0x08, 0x7d, - 0xe6, 0xa3, 0x0c, 0x1b, 0x5b, 0x9e, 0x4f, 0x4b, 0x5b, 0xf1, 0x00, 0x36, 0x0b, 0x08, 0x95, 0x21, - 0xa5, 0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, 0x03, 0xc7, 0x57, 0xab, 0x46, 0x70, 0x66, 0x37, 0x62, - 0x33, 0xab, 0xbf, 0x10, 0xd9, 0x58, 0x95, 0x46, 0x5b, 0x90, 0x73, 0x1d, 0x6f, 0xc0, 0x37, 0x22, - 0x88, 0xeb, 0x38, 0xeb, 0x3a, 0x1e, 0xdf, 0xa9, 0x80, 0xac, 0x0b, 0x09, 0x29, 0xea, 0xae, 0x75, - 0x21, 0xa0, 0x06, 0xe4, 0x45, 0xd5, 0xe3, 0x59, 0x40, 0xcc, 0x54, 0x45, 0xab, 0xad, 0x35, 0x1f, - 0x44, 0xec, 0x7a, 0x11, 0x80, 0x17, 0x31, 0xe8, 0x09, 0x80, 0x68, 0x38, 0xa0, 0x84, 0x51, 0x33, - 0x2d, 0xf6, 0x33, 0xcf, 0x90, 0x94, 0x7a, 0x84, 0xa9, 0xb1, 0xe6, 0x27, 0xca, 0xa6, 0xd5, 0x3f, - 0x75, 0x58, 0x95, 0x23, 0x8f, 0xa4, 0x5a, 0x26, 0xac, 0xbd, 0x99, 0x70, 0x32, 0x4e, 0xf8, 0x09, - 0x87, 0xd8, 0x68, 0x4c, 0x42, 0x6a, 0xea, 0xa2, 0x7b, 0x31, 0x36, 0xcd, 0x43, 0x09, 0x2a, 0x02, - 0xf3, 0x58, 0xd4, 0x84, 0x0d, 0x5e, 0x32, 0x24, 0xd4, 0x9f, 0x4c, 0x99, 0xe3, 0x7b, 0x83, 0x73, - 0xc7, 0x3b, 0xf5, 0xcf, 0xc5, 0xa6, 0x75, 0xbc, 0xee, 0x5a, 0x17, 0x78, 0x8e, 0x9d, 0x08, 0x08, - 0x3d, 0x06, 0xb0, 0x6c, 0x3b, 0x24, 0xb6, 0xc5, 0x88, 0xdc, 0xeb, 0x5a, 0x73, 0x25, 0xea, 0xd6, - 0xb2, 0xed, 0x10, 0x2f, 0xe1, 0xe8, 0x33, 0xd8, 0x0a, 0xac, 0x90, 0x39, 0xd6, 0x84, 0x77, 0x11, - 0xca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, 0x00, 0x00, + // 1057 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xf6, 0x7a, 0xed, 0xb5, 0xfd, 0xba, 0x09, 0xdb, 0xa9, 0x9b, 0x6e, 0x5c, 0xc9, 0xb1, 0x2c, + 0x21, 0x45, 0x51, 0xb1, 0xc1, 0xa0, 0x4a, 0xa0, 0x5e, 0xec, 0xc4, 0x90, 0x88, 0xc6, 0x81, 0x71, + 0xdc, 0x40, 0x11, 0xb2, 0xd6, 0xce, 0x64, 0xbd, 0x8a, 0xf7, 0x83, 0x9d, 0x31, 0x89, 0x6f, 0x88, + 0x1f, 0x80, 0x10, 0x17, 0x0e, 0xfc, 0x1e, 0xa4, 0x1c, 0x7b, 0x44, 0x1c, 0x2a, 0x48, 0xfe, 0x08, + 0x9a, 0x8f, 0xb5, 0xbd, 0x21, 0x6d, 0x0e, 0xe9, 0xc5, 0x9a, 0xf7, 0x79, 0xde, 0xaf, 0x79, 0x9f, + 0x99, 0xf1, 0xc2, 0x23, 0xca, 0x82, 0x88, 0x34, 0xc4, 0x6f, 0x38, 0x6c, 0x44, 0xe1, 0xa8, 0x1e, + 0x46, 0x01, 0x0b, 0x90, 0xc1, 0xc6, 0xb6, 0x1f, 0xd0, 0xf2, 0x7a, 0xd2, 0x81, 0xcd, 0x42, 0x42, + 0xa5, 0x4b, 0xb9, 0xe4, 0x04, 0x4e, 0x20, 0x96, 0x0d, 0xbe, 0x52, 0x68, 0x35, 0x19, 0x10, 0x46, + 0x81, 0x77, 0x2d, 0x4e, 0xa5, 0x9c, 0xd8, 0x43, 0x32, 0xb9, 0x4e, 0x39, 0x41, 0xe0, 0x4c, 0x48, + 0x43, 0x58, 0xc3, 0xe9, 0x49, 0xc3, 0xf6, 0x67, 0x92, 0xaa, 0xbd, 0x07, 0x2b, 0x47, 0x91, 0xcb, +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 0x15, 0x3d, 0xa2, 0x8f, 0x20, 0xc3, 0xff, 0x21, 0xd1, 0x83, 0x58, + 0xb9, 0xa5, 0xff, 0xcf, 0x72, 0x29, 0x09, 0xaa, 0xf9, 0x7d, 0x0a, 0x86, 0x7c, 0x4f, 0xd0, 0xc3, + 0xe4, 0xfb, 0x12, 0x87, 0xad, 0x5d, 0x87, 0x65, 0xe0, 0x87, 0x1a, 0xda, 0x06, 0x58, 0xdc, 0x0f, + 0xb4, 0x9e, 0xf8, 0xbf, 0x58, 0x7e, 0x35, 0xca, 0xe5, 0x9b, 0x28, 0x55, 0xff, 0x73, 0x28, 0x2e, + 0xc9, 0x8a, 0x92, 0xae, 0x89, 0x4b, 0x50, 0x7e, 0x7c, 0x23, 0x27, 0xf3, 0x34, 0xbb, 0xb0, 0x2a, + 0xbe, 0x64, 0xf8, 0xe9, 0x96, 0xc3, 0x78, 0x06, 0x45, 0x4c, 0xbc, 0x80, 0x11, 0x81, 0xa3, 0xf9, + 0xf6, 0x97, 0x3f, 0x78, 0xca, 0x0f, 0xaf, 0xa1, 0xea, 0xc3, 0x28, 0xd5, 0x7e, 0xff, 0xe2, 0xdf, + 0x4a, 0xea, 0xe2, 0xb2, 0xa2, 0xbd, 0xba, 0xac, 0x68, 0xff, 0x5c, 0x56, 0xb4, 0x5f, 0xaf, 0x2a, + 0xa9, 0x57, 0x57, 0x95, 0xd4, 0x5f, 0x57, 0x95, 0xd4, 0xcb, 0x9c, 0xfa, 0x36, 0x1b, 0x1a, 0xe2, + 0xcc, 0x7c, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x17, 0xd5, 0x80, 0x05, 0x0a, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1036,6 +1038,13 @@ func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Config) > 0 { + i -= len(m.Config) + copy(dAtA[i:], m.Config) + i = encodeVarintRpc(dAtA, i, uint64(len(m.Config))) + i-- + dAtA[i] = 0x22 + } if m.Replica != 0 { i = encodeVarintRpc(dAtA, i, uint64(m.Replica)) i-- @@ -1621,6 +1630,10 @@ func (m *WriteRequest) Size() (n int) { if m.Replica != 0 { n += 1 + sovRpc(uint64(m.Replica)) } + l = len(m.Config) + if l > 0 { + n += 1 + l + sovRpc(uint64(l)) + } return n } @@ -2030,6 +2043,38 @@ func (m *WriteRequest) Unmarshal(dAtA []byte) error { break } } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRpc + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRpc + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRpc + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Config = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRpc(dAtA[iNdEx:]) diff --git a/pkg/store/storepb/rpc.proto b/pkg/store/storepb/rpc.proto index f1d2f181b7..8fc104fc01 100644 --- a/pkg/store/storepb/rpc.proto +++ b/pkg/store/storepb/rpc.proto @@ -27,7 +27,7 @@ option (gogoproto.goproto_sizecache_all) = false; service Store { /// Info returns meta information about a store e.g labels that makes that store unique as well as time range that is /// available. - rpc Info(InfoRequest) returns (InfoResponse); + rpc Info (InfoRequest) returns (InfoResponse); /// Series streams each Series (Labels and chunk/downsampling chunk) for given label matchers and time range. /// @@ -38,20 +38,21 @@ service Store { /// /// There is no requirements on chunk sorting, however it is recommended to have chunk sorted by chunk min time. /// This heavily optimizes the resource usage on Querier / Federated Queries. - rpc Series(SeriesRequest) returns (stream SeriesResponse); + rpc Series (SeriesRequest) returns (stream SeriesResponse); /// LabelNames returns all label names that is available. /// Currently unimplemented in all Thanos implementations, because Query API does not implement this either. - rpc LabelNames(LabelNamesRequest) returns (LabelNamesResponse); + rpc LabelNames (LabelNamesRequest) returns (LabelNamesResponse); /// LabelValues returns all label values for given label name. - rpc LabelValues(LabelValuesRequest) returns (LabelValuesResponse); + rpc LabelValues (LabelValuesRequest) returns (LabelValuesResponse); } /// WriteableStore represents API against instance that stores XOR encoded values with label set metadata (e.g Prometheus metrics). service WriteableStore { // WriteRequest allows you to write metrics to this store via remote write - rpc RemoteWrite(WriteRequest) returns (WriteResponse) {} + rpc RemoteWrite (WriteRequest) returns (WriteResponse) { + } } message WriteResponse { @@ -61,9 +62,11 @@ message WriteRequest { repeated prometheus_copy.TimeSeries timeseries = 1 [(gogoproto.nullable) = false]; string tenant = 2; int64 replica = 3; + string config = 4; } -message InfoRequest {} +message InfoRequest { +} enum StoreType { UNKNOWN = 0; @@ -87,12 +90,12 @@ message InfoResponse { } message SeriesRequest { - int64 min_time = 1; - int64 max_time = 2; + int64 min_time = 1; + int64 max_time = 2; repeated LabelMatcher matchers = 3 [(gogoproto.nullable) = false]; int64 max_resolution_window = 4; - repeated Aggr aggregates = 5; + repeated Aggr aggregates = 5; // Deprecated. Use partial_response_strategy instead. bool partial_response_disabled = 6; @@ -110,11 +113,11 @@ message SeriesRequest { } enum Aggr { - RAW = 0; - COUNT = 1; - SUM = 2; - MIN = 3; - MAX = 4; + RAW = 0; + COUNT = 1; + SUM = 2; + MIN = 3; + MAX = 4; COUNTER = 5; } @@ -153,7 +156,7 @@ message LabelNamesRequest { } message LabelNamesResponse { - repeated string names = 1; + repeated string names = 1; repeated string warnings = 2; /// hints is an opaque data structure that can be used to carry additional information from @@ -181,7 +184,7 @@ message LabelValuesRequest { } message LabelValuesResponse { - repeated string values = 1; + repeated string values = 1; repeated string warnings = 2; /// hints is an opaque data structure that can be used to carry additional information from