Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added LocalStore and realistic data for querier counter reset bug. #2538

Merged
merged 1 commit into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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