mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Fix lint errors: dot at comment end
Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
This commit is contained in:
parent
d42e296516
commit
1149f7e9e1
|
@ -329,7 +329,7 @@ func isCaseSensitive(reg *syntax.Regexp) bool {
|
||||||
return !isCaseInsensitive(reg)
|
return !isCaseInsensitive(reg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// tooManyMatches guards against creating too many set matches
|
// tooManyMatches guards against creating too many set matches.
|
||||||
func tooManyMatches(matches []string, added ...string) bool {
|
func tooManyMatches(matches []string, added ...string) bool {
|
||||||
return len(matches)+len(added) > maxSetMatches
|
return len(matches)+len(added) > maxSetMatches
|
||||||
}
|
}
|
||||||
|
@ -351,7 +351,7 @@ func (m *FastRegexMatcher) GetRegexString() string {
|
||||||
// `literal1|literal2|literal3|...`
|
// `literal1|literal2|literal3|...`
|
||||||
//
|
//
|
||||||
// this function returns an optimized StringMatcher or nil if the regex
|
// this function returns an optimized StringMatcher or nil if the regex
|
||||||
// cannot be optimized in this way, and a list of setMatches up to maxSetMatches
|
// cannot be optimized in this way, and a list of setMatches up to maxSetMatches.
|
||||||
func optimizeAlternatingLiterals(s string) (StringMatcher, []string) {
|
func optimizeAlternatingLiterals(s string) (StringMatcher, []string) {
|
||||||
if len(s) == 0 {
|
if len(s) == 0 {
|
||||||
return emptyStringMatcher{}, nil
|
return emptyStringMatcher{}, nil
|
||||||
|
|
|
@ -754,6 +754,8 @@ func FuzzFastRegexMatcher_WithFuzzyRegularExpressions(f *testing.F) {
|
||||||
// running the following command:
|
// running the following command:
|
||||||
//
|
//
|
||||||
// logcli --addr=XXX --username=YYY --password=ZZZ query '{namespace=~"(cortex|mimir).*",name="query-frontend"} |= "query stats" |= "=~" --limit=100000 > logs.txt
|
// logcli --addr=XXX --username=YYY --password=ZZZ query '{namespace=~"(cortex|mimir).*",name="query-frontend"} |= "query stats" |= "=~" --limit=100000 > logs.txt
|
||||||
|
//
|
||||||
|
// against Loki.
|
||||||
func TestAnalyzeRealQueries(t *testing.T) {
|
func TestAnalyzeRealQueries(t *testing.T) {
|
||||||
t.Skip("Decomment this test only to manually analyze real queries")
|
t.Skip("Decomment this test only to manually analyze real queries")
|
||||||
|
|
||||||
|
@ -1157,7 +1159,7 @@ func TestFindEqualStringMatchers(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This benchmark is used to find a good threshold to use to apply the optimization
|
// This benchmark is used to find a good threshold to use to apply the optimization
|
||||||
// done by optimizeEqualStringMatchers()
|
// done by optimizeEqualStringMatchers().
|
||||||
func BenchmarkOptimizeEqualStringMatchers(b *testing.B) {
|
func BenchmarkOptimizeEqualStringMatchers(b *testing.B) {
|
||||||
randGenerator := rand.New(rand.NewSource(time.Now().UnixNano()))
|
randGenerator := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ const (
|
||||||
DefaultPostingsForMatchersCacheForce = false
|
DefaultPostingsForMatchersCacheForce = false
|
||||||
)
|
)
|
||||||
|
|
||||||
// IndexPostingsReader is a subset of IndexReader methods, the minimum required to evaluate PostingsForMatchers
|
// IndexPostingsReader is a subset of IndexReader methods, the minimum required to evaluate PostingsForMatchers.
|
||||||
type IndexPostingsReader interface {
|
type IndexPostingsReader interface {
|
||||||
// LabelValues returns possible label values which may not be sorted.
|
// LabelValues returns possible label values which may not be sorted.
|
||||||
LabelValues(ctx context.Context, name string, matchers ...*labels.Matcher) ([]string, error)
|
LabelValues(ctx context.Context, name string, matchers ...*labels.Matcher) ([]string, error)
|
||||||
|
@ -166,7 +166,7 @@ func (c *PostingsForMatchersCache) expire() {
|
||||||
|
|
||||||
// shouldEvictHead returns true if cache head should be evicted, either because it's too old,
|
// shouldEvictHead returns true if cache head should be evicted, either because it's too old,
|
||||||
// or because the cache has too many elements
|
// or because the cache has too many elements
|
||||||
// should be called while read lock is held on cachedMtx
|
// should be called while read lock is held on cachedMtx.
|
||||||
func (c *PostingsForMatchersCache) shouldEvictHead() bool {
|
func (c *PostingsForMatchersCache) shouldEvictHead() bool {
|
||||||
// The cache should be evicted for sure if the max size (either items or bytes) is reached.
|
// The cache should be evicted for sure if the max size (either items or bytes) is reached.
|
||||||
if c.cached.Len() > c.maxItems || c.cachedBytes > c.maxBytes {
|
if c.cached.Len() > c.maxItems || c.cachedBytes > c.maxBytes {
|
||||||
|
@ -208,9 +208,9 @@ func (c *PostingsForMatchersCache) created(key string, ts time.Time, sizeBytes i
|
||||||
c.cachedBytes += sizeBytes
|
c.cachedBytes += sizeBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
// matchersKey provides a unique string key for the given matchers slice
|
// matchersKey provides a unique string key for the given matchers slice.
|
||||||
// NOTE: different orders of matchers will produce different keys,
|
// NOTE: different orders of matchers will produce different keys,
|
||||||
// but it's unlikely that we'll receive same matchers in different orders at the same time
|
// but it's unlikely that we'll receive same matchers in different orders at the same time.
|
||||||
func matchersKey(ms []*labels.Matcher) string {
|
func matchersKey(ms []*labels.Matcher) string {
|
||||||
const (
|
const (
|
||||||
typeLen = 2
|
typeLen = 2
|
||||||
|
@ -232,7 +232,7 @@ func matchersKey(ms []*labels.Matcher) string {
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
// indexReaderWithPostingsForMatchers adapts an index.Reader to be an IndexReader by adding the PostingsForMatchers method
|
// indexReaderWithPostingsForMatchers adapts an index.Reader to be an IndexReader by adding the PostingsForMatchers method.
|
||||||
type indexReaderWithPostingsForMatchers struct {
|
type indexReaderWithPostingsForMatchers struct {
|
||||||
*index.Reader
|
*index.Reader
|
||||||
pfmc *PostingsForMatchersCache
|
pfmc *PostingsForMatchersCache
|
||||||
|
|
|
@ -430,13 +430,13 @@ func (idx indexForPostingsMock) Postings(context.Context, string, ...string) (in
|
||||||
}
|
}
|
||||||
|
|
||||||
// timeNowMock offers a mockable time.Now() implementation
|
// timeNowMock offers a mockable time.Now() implementation
|
||||||
// empty value is ready to be used, and it should not be copied (use a reference)
|
// empty value is ready to be used, and it should not be copied (use a reference).
|
||||||
type timeNowMock struct {
|
type timeNowMock struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
now time.Time
|
now time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// timeNow can be used as a mocked replacement for time.Now()
|
// timeNow can be used as a mocked replacement for time.Now().
|
||||||
func (t *timeNowMock) timeNow() time.Time {
|
func (t *timeNowMock) timeNow() time.Time {
|
||||||
t.Lock()
|
t.Lock()
|
||||||
defer t.Unlock()
|
defer t.Unlock()
|
||||||
|
@ -446,7 +446,7 @@ func (t *timeNowMock) timeNow() time.Time {
|
||||||
return t.now
|
return t.now
|
||||||
}
|
}
|
||||||
|
|
||||||
// advance advances the mocked time.Now() value
|
// advance advances the mocked time.Now() value.
|
||||||
func (t *timeNowMock) advance(d time.Duration) {
|
func (t *timeNowMock) advance(d time.Duration) {
|
||||||
t.Lock()
|
t.Lock()
|
||||||
defer t.Unlock()
|
defer t.Unlock()
|
||||||
|
|
Loading…
Reference in a new issue