MCPcopy Create free account
hub / github.com/cortexproject/cortex / QueryStream

Method QueryStream

pkg/querier/testutils.go:71–93  ·  view source on GitHub ↗
(ctx context.Context, from, to model.Time, partialDataEnabled bool, matchers ...*labels.Matcher)

Source from the content-addressed store, hash-verified

69}
70
71func (m *MockLimitingDistributor) QueryStream(ctx context.Context, from, to model.Time, partialDataEnabled bool, matchers ...*labels.Matcher) (*client.QueryStreamResponse, error) {
72 var (
73 queryLimiter = limiter.QueryLimiterFromContextWithFallback(ctx)
74 )
75 s := make([][]cortexpb.LabelAdapter, 0, len(m.response.Chunkseries))
76
77 response := &client.QueryStreamResponse{}
78 for _, series := range m.response.Chunkseries {
79 for _, label := range series.Labels {
80 for _, matcher := range matchers {
81 if matcher.Matches(label.Value) {
82 s = append(s, series.Labels)
83 response.Chunkseries = append(response.Chunkseries, series)
84 }
85 }
86 }
87 }
88
89 if limitErr := queryLimiter.AddSeries(s...); limitErr != nil {
90 return nil, validation.LimitError(limitErr.Error())
91 }
92 return response, nil
93}
94
95type TestConfig struct {
96 Cfg Config

Callers

nothing calls this directly

Calls 4

LimitErrorTypeAlias · 0.92
AddSeriesMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected