Skip to content

Commit

Permalink
Added LocalStore and realistic data for querier counter reset bug. (#…
Browse files Browse the repository at this point in the history
…2522) (#2538)

* Added LocalStore and realistic data for querier counter reset bug.

Tries to reproduces: #2401

I would still merge as it is a great test, and allows us to quickly
check data provided by Ben.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Fixed tsdbstore required component type.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Fixed ineffectual set.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Fixed liche.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Fixed unknown store issue.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
  • Loading branch information
bwplotka authored Apr 29, 2020
1 parent 5d7bb2b commit 416024c
Show file tree
Hide file tree
Showing 10 changed files with 2,069 additions and 124 deletions.
24 changes: 14 additions & 10 deletions pkg/component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,23 @@ func FromProto(storeType storepb.StoreType) StoreAPI {
return Store
case storepb.StoreType_RECEIVE:
return Receive
case storepb.StoreType_DEBUG:
return Debug
default:
return nil
return UnknownStoreAPI
}
}

var (
Bucket = source{component: component{name: "bucket"}}
Compact = source{component: component{name: "compact"}}
Downsample = source{component: component{name: "downsample"}}
Query = sourceStoreAPI{component: component{name: "query"}}
Rule = sourceStoreAPI{component: component{name: "rule"}}
Sidecar = sourceStoreAPI{component: component{name: "sidecar"}}
Store = sourceStoreAPI{component: component{name: "store"}}
Receive = sourceStoreAPI{component: component{name: "receive"}}
Replicate = sourceStoreAPI{component: component{name: "replicate"}}
Bucket = source{component: component{name: "bucket"}}
Compact = source{component: component{name: "compact"}}
Downsample = source{component: component{name: "downsample"}}
Replicate = source{component: component{name: "replicate"}}
Debug = sourceStoreAPI{component: component{name: "debug"}}
Receive = sourceStoreAPI{component: component{name: "receive"}}
Rule = sourceStoreAPI{component: component{name: "rule"}}
Sidecar = sourceStoreAPI{component: component{name: "sidecar"}}
Store = storeAPI{component: component{name: "store"}}
UnknownStoreAPI = storeAPI{component: component{name: "unknown-store-api"}}
Query = storeAPI{component: component{name: "query"}}
)
218 changes: 171 additions & 47 deletions pkg/query/querier_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/query/storeset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func TestStoreSet_Update(t *testing.T) {

// Check stats.
expected = newStoreAPIStats()
expected[component.StoreAPI(nil)] = map[string]int{
expected[component.UnknownStoreAPI] = map[string]int{
"{l1=\"no-store-type\", l2=\"v3\"}": 1,
}
expected[component.Query] = map[string]int{
Expand Down
1,488 changes: 1,488 additions & 0 deletions pkg/query/testdata/issue2401-seriesresponses.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions pkg/server/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ type Server struct {

// New creates a new Server.
func New(logger log.Logger, reg prometheus.Registerer, tracer opentracing.Tracer, comp component.Component, probe *prober.GRPCProbe, storeSrv storepb.StoreServer, opts ...Option) *Server {
options := options{}
options := options{
network: "tcp",
}
for _, o := range opts {
o.apply(&options)
}
Expand Down Expand Up @@ -97,7 +99,7 @@ func New(logger log.Logger, reg prometheus.Registerer, tracer opentracing.Tracer

// ListenAndServe listens on the TCP network address and handles requests on incoming connections.
func (s *Server) ListenAndServe() error {
l, err := net.Listen("tcp", s.opts.listen)
l, err := net.Listen(s.opts.network, s.opts.listen)
if err != nil {
return errors.Wrapf(err, "listen gRPC on address %s", s.opts.listen)
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/server/grpc/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import (
"time"
)

const UnixSocket = "/tmp/test.sock"

type options struct {
gracePeriod time.Duration
listen string
network string

tlsConfig *tls.Config
}
Expand Down Expand Up @@ -42,6 +45,13 @@ func WithListen(s string) Option {
})
}

// WithNetwork sets network to listen for gRPC server e.g tcp, udp or unix.
func WithNetwork(s string) Option {
return optionFunc(func(o *options) {
o.network = s
})
}

// WithTLSConfig sets TLS configuration for gRPC server.
func WithTLSConfig(cfg *tls.Config) Option {
return optionFunc(func(o *options) {
Expand Down
Loading

0 comments on commit 416024c

Please sign in to comment.