Merge pull request #487 from grafana/sync-upstream-28-apr-2023

Sync upstream 28 apr 2023
This commit is contained in:
George Krajcsovits 2023-04-28 18:21:30 +02:00 committed by GitHub
commit 99e591e7f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 7 deletions

View file

@ -85,7 +85,7 @@ The PromQL parser grammar is located in `promql/parser/generated_parser.y` and i
The parser is built using [goyacc](https://pkg.go.dev/golang.org/x/tools/cmd/goyacc) The parser is built using [goyacc](https://pkg.go.dev/golang.org/x/tools/cmd/goyacc)
If doing some sort of debugging, then it is possible to add some verbose output. After generating the parser, then you If doing some sort of debugging, then it is possible to add some verbose output. After generating the parser, then you
can modify the the `./promql/parser/generated_parser.y.go` manually. can modify the `./promql/parser/generated_parser.y.go` manually.
```golang ```golang
// As of writing this was somewhere around line 600. // As of writing this was somewhere around line 600.

View file

@ -209,7 +209,7 @@ func (n *Node) buildNode(node *apiv1.Node) *targetgroup.Group {
return tg return tg
} }
// nodeAddresses returns the provided node's address, based on the priority: // nodeAddress returns the provided node's address, based on the priority:
// 1. NodeInternalIP // 1. NodeInternalIP
// 2. NodeInternalDNS // 2. NodeInternalDNS
// 3. NodeExternalIP // 3. NodeExternalIP

View file

@ -622,7 +622,7 @@ func (b *ScratchBuilder) Sort() {
slices.SortFunc(b.add, func(a, b Label) bool { return a.Name < b.Name }) slices.SortFunc(b.add, func(a, b Label) bool { return a.Name < b.Name })
} }
// Asssign is for when you already have a Labels which you want this ScratchBuilder to return. // Assign is for when you already have a Labels which you want this ScratchBuilder to return.
func (b *ScratchBuilder) Assign(ls Labels) { func (b *ScratchBuilder) Assign(ls Labels) {
b.add = append(b.add[:0], ls...) // Copy on top of our slice, so we don't retain the input slice. b.add = append(b.add[:0], ls...) // Copy on top of our slice, so we don't retain the input slice.
} }

View file

@ -799,7 +799,7 @@ func (b *ScratchBuilder) Sort() {
slices.SortFunc(b.add, func(a, b Label) bool { return a.Name < b.Name }) slices.SortFunc(b.add, func(a, b Label) bool { return a.Name < b.Name })
} }
// Asssign is for when you already have a Labels which you want this ScratchBuilder to return. // Assign is for when you already have a Labels which you want this ScratchBuilder to return.
func (b *ScratchBuilder) Assign(l Labels) { func (b *ScratchBuilder) Assign(l Labels) {
b.output = l b.output = l
} }

View file

@ -190,8 +190,9 @@ func TestScrapePoolStop(t *testing.T) {
labels: labels.FromStrings(model.AddressLabel, fmt.Sprintf("example.com:%d", i)), labels: labels.FromStrings(model.AddressLabel, fmt.Sprintf("example.com:%d", i)),
} }
l := &testLoop{} l := &testLoop{}
d := time.Duration((i+1)*20) * time.Millisecond
l.stopFunc = func() { l.stopFunc = func() {
time.Sleep(time.Duration(i*20) * time.Millisecond) time.Sleep(d)
mtx.Lock() mtx.Lock()
stopped[t.hash()] = true stopped[t.hash()] = true
@ -273,8 +274,9 @@ func TestScrapePoolReload(t *testing.T) {
discoveredLabels: labels, discoveredLabels: labels,
} }
l := &testLoop{} l := &testLoop{}
d := time.Duration((i+1)*20) * time.Millisecond
l.stopFunc = func() { l.stopFunc = func() {
time.Sleep(time.Duration(i*20) * time.Millisecond) time.Sleep(d)
mtx.Lock() mtx.Lock()
stopped[t.hash()] = true stopped[t.hash()] = true

View file

@ -1894,7 +1894,7 @@ func (db *DB) Querier(_ context.Context, mint, maxt int64) (storage.Querier, err
return storage.NewMergeQuerier(blockQueriers, nil, storage.ChainedSeriesMerge), nil return storage.NewMergeQuerier(blockQueriers, nil, storage.ChainedSeriesMerge), nil
} }
// blockQueriersForRange returns individual block chunk queriers from the persistent blocks, in-order head block, and the // blockChunkQuerierForRange returns individual block chunk queriers from the persistent blocks, in-order head block, and the
// out-of-order head block, overlapping with the given time range. // out-of-order head block, overlapping with the given time range.
func (db *DB) blockChunkQuerierForRange(mint, maxt int64) ([]storage.ChunkQuerier, error) { func (db *DB) blockChunkQuerierForRange(mint, maxt int64) ([]storage.ChunkQuerier, error) {
var blocks []BlockReader var blocks []BlockReader