mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Merge pull request #486 from grafana/sync-upstream-26-apr-2023
Sync upstream 26 apr 2023
From d4bf47766e
This commit is contained in:
commit
8094a8ea34
4
.github/workflows/golangci-lint.yml
vendored
4
.github/workflows/golangci-lint.yml
vendored
|
@ -20,11 +20,11 @@ jobs:
|
|||
- name: install Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '<1.19'
|
||||
go-version: '>=1.20 <1.21'
|
||||
- name: Install snmp_exporter/generator dependencies
|
||||
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
|
||||
if: github.repository == 'prometheus/snmp_exporter'
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v3.3.1
|
||||
with:
|
||||
version: v1.50.1
|
||||
version: v1.52.2
|
||||
|
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -11,8 +11,8 @@ jobs:
|
|||
- name: Upgrade golang
|
||||
run: |
|
||||
cd /tmp
|
||||
wget https://dl.google.com/go/go1.18.7.linux-amd64.tar.gz
|
||||
tar -zxvf go1.18.7.linux-amd64.tar.gz
|
||||
wget https://dl.google.com/go/go1.20.3.linux-amd64.tar.gz
|
||||
tar -zxvf go1.20.3.linux-amd64.tar.gz
|
||||
sudo rm -fr /usr/local/go
|
||||
sudo mv /tmp/go /usr/local/go
|
||||
cd -
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
run:
|
||||
deadline: 5m
|
||||
timeout: 15m
|
||||
skip-files:
|
||||
# Skip autogenerated files.
|
||||
- ^.*\.(pb|y)\.go$
|
||||
|
@ -10,14 +10,20 @@ output:
|
|||
linters:
|
||||
enable:
|
||||
- depguard
|
||||
- gocritic
|
||||
- gofumpt
|
||||
- goimports
|
||||
- revive
|
||||
- misspell
|
||||
- unconvert
|
||||
- unused
|
||||
|
||||
issues:
|
||||
max-same-issues: 0
|
||||
exclude-rules:
|
||||
- linters:
|
||||
- gocritic
|
||||
text: "appendAssign"
|
||||
- path: _test.go
|
||||
linters:
|
||||
- errcheck
|
||||
|
|
|
@ -49,7 +49,8 @@ Release cadence of first pre-releases being cut is 6 weeks.
|
|||
| v2.42 | 2023-01-25 | Kemal Akkoyun (GitHub: @kakkoyun) |
|
||||
| v2.43 | 2023-03-08 | Julien Pivotto (GitHub: @roidelapluie) |
|
||||
| v2.44 | 2023-04-19 | Bryan Boreham (GitHub: @bboreham) |
|
||||
| v2.45 | 2023-05-31 | **searching for volunteer** |
|
||||
| v2.45 | 2023-05-31 | Jesus Vazquez (Github: @jesusvazquez) |
|
||||
| v2.46 | 2023-07-12 | **searching for volunteer** |
|
||||
|
||||
If you are interested in volunteering please create a pull request against the [prometheus/prometheus](https://github.com/prometheus/prometheus) repository and propose yourself for the release series of your choice.
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ func main() {
|
|||
|
||||
c, err := tsdb.NewLeveledCompactorWithChunkSize(ctx, nil, logger, []int64{0}, nil, segmentSizeMB*1024*1024, nil, true)
|
||||
if err != nil {
|
||||
log.Fatalln("creating compator", err)
|
||||
log.Panicln("creating compactor", err)
|
||||
}
|
||||
|
||||
opts := tsdb.DefaultLeveledCompactorConcurrencyOptions()
|
||||
|
@ -84,6 +84,6 @@ func main() {
|
|||
|
||||
_, err = c.CompactWithSplitting(outputDir, blockDirs, nil, uint64(shardCount))
|
||||
if err != nil {
|
||||
log.Fatalln("compacting", err)
|
||||
log.Panicln("compacting", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
// limitations under the License.
|
||||
|
||||
// The main package for the Prometheus server executable.
|
||||
// nolint:revive // Many unsued function arguments in this file by design.
|
||||
package main
|
||||
|
||||
import (
|
||||
|
@ -490,7 +491,7 @@ func main() {
|
|||
if cfgFile.StorageConfig.ExemplarsConfig == nil {
|
||||
cfgFile.StorageConfig.ExemplarsConfig = &config.DefaultExemplarsConfig
|
||||
}
|
||||
cfg.tsdb.MaxExemplars = int64(cfgFile.StorageConfig.ExemplarsConfig.MaxExemplars)
|
||||
cfg.tsdb.MaxExemplars = cfgFile.StorageConfig.ExemplarsConfig.MaxExemplars
|
||||
}
|
||||
if cfgFile.StorageConfig.TSDBConfig != nil {
|
||||
cfg.tsdb.OutOfOrderTimeWindow = cfgFile.StorageConfig.TSDBConfig.OutOfOrderTimeWindow
|
||||
|
|
|
@ -72,9 +72,11 @@ Loop:
|
|||
if !startedOk {
|
||||
t.Fatal("prometheus didn't start in the specified timeout")
|
||||
}
|
||||
if err := prom.Process.Kill(); err == nil {
|
||||
switch err := prom.Process.Kill(); {
|
||||
case err == nil:
|
||||
t.Errorf("prometheus didn't shutdown gracefully after sending the Interrupt signal")
|
||||
} else if stoppedErr != nil && stoppedErr.Error() != "signal: interrupt" { // TODO - find a better way to detect when the process didn't exit as expected!
|
||||
case stoppedErr != nil && stoppedErr.Error() != "signal: interrupt":
|
||||
// TODO: find a better way to detect when the process didn't exit as expected!
|
||||
t.Errorf("prometheus exited with an unexpected error: %v", stoppedErr)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ func (p *queryLogTest) String() string {
|
|||
}
|
||||
name = name + ", " + p.host + ":" + strconv.Itoa(p.port)
|
||||
if p.enabledAtStart {
|
||||
name = name + ", enabled at start"
|
||||
name += ", enabled at start"
|
||||
}
|
||||
if p.prefix != "" {
|
||||
name = name + ", with prefix " + p.prefix
|
||||
|
|
|
@ -101,7 +101,7 @@ func createBlocks(input []byte, mint, maxt, maxBlockDuration int64, maxSamplesIn
|
|||
nextSampleTs int64 = math.MaxInt64
|
||||
)
|
||||
|
||||
for t := mint; t <= maxt; t = t + blockDuration {
|
||||
for t := mint; t <= maxt; t += blockDuration {
|
||||
tsUpper := t + blockDuration
|
||||
if nextSampleTs != math.MaxInt64 && nextSampleTs >= tsUpper {
|
||||
// The next sample is not in this timerange, we can avoid parsing
|
||||
|
|
|
@ -44,7 +44,7 @@ func sortSamples(samples []backfillSample) {
|
|||
})
|
||||
}
|
||||
|
||||
func queryAllSeries(t testing.TB, q storage.Querier, expectedMinTime, expectedMaxTime int64) []backfillSample {
|
||||
func queryAllSeries(t testing.TB, q storage.Querier, expectedMinTime, expectedMaxTime int64) []backfillSample { // nolint:revive
|
||||
ss := q.Select(false, nil, labels.MustNewMatcher(labels.MatchRegexp, "", ".*"))
|
||||
samples := []backfillSample{}
|
||||
for ss.Next() {
|
||||
|
|
|
@ -68,7 +68,7 @@ func newRuleImporter(logger log.Logger, config ruleImporterConfig, apiClient que
|
|||
}
|
||||
|
||||
// loadGroups parses groups from a list of recording rule files.
|
||||
func (importer *ruleImporter) loadGroups(ctx context.Context, filenames []string) (errs []error) {
|
||||
func (importer *ruleImporter) loadGroups(_ context.Context, filenames []string) (errs []error) {
|
||||
groups, errs := importer.ruleManager.LoadGroups(importer.config.evalInterval, labels.Labels{}, "", nil, filenames...)
|
||||
if errs != nil {
|
||||
return errs
|
||||
|
@ -100,7 +100,7 @@ func (importer *ruleImporter) importRule(ctx context.Context, ruleExpr, ruleName
|
|||
startInMs := start.Unix() * int64(time.Second/time.Millisecond)
|
||||
endInMs := end.Unix() * int64(time.Second/time.Millisecond)
|
||||
|
||||
for startOfBlock := blockDuration * (startInMs / blockDuration); startOfBlock <= endInMs; startOfBlock = startOfBlock + blockDuration {
|
||||
for startOfBlock := blockDuration * (startInMs / blockDuration); startOfBlock <= endInMs; startOfBlock += blockDuration {
|
||||
endOfBlock := startOfBlock + blockDuration - 1
|
||||
|
||||
currStart := max(startOfBlock/int64(time.Second/time.Millisecond), start.Unix())
|
||||
|
|
|
@ -35,7 +35,7 @@ type mockQueryRangeAPI struct {
|
|||
samples model.Matrix
|
||||
}
|
||||
|
||||
func (mockAPI mockQueryRangeAPI) QueryRange(ctx context.Context, query string, r v1.Range, opts ...v1.Option) (model.Value, v1.Warnings, error) {
|
||||
func (mockAPI mockQueryRangeAPI) QueryRange(_ context.Context, query string, r v1.Range, opts ...v1.Option) (model.Value, v1.Warnings, error) { // nolint:revive
|
||||
return mockAPI.samples, v1.Warnings{}, nil
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ func TestBackfillRuleIntegration(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func newTestRuleImporter(ctx context.Context, start time.Time, tmpDir string, testSamples model.Matrix, maxBlockDuration time.Duration) (*ruleImporter, error) {
|
||||
func newTestRuleImporter(_ context.Context, start time.Time, tmpDir string, testSamples model.Matrix, maxBlockDuration time.Duration) (*ruleImporter, error) {
|
||||
logger := log.NewNopLogger()
|
||||
cfg := ruleImporterConfig{
|
||||
outputDir: tmpDir,
|
||||
|
|
|
@ -403,14 +403,15 @@ func openBlock(path, blockID string) (*tsdb.DBReadOnly, tsdb.BlockReader, error)
|
|||
return nil, nil, err
|
||||
}
|
||||
var block tsdb.BlockReader
|
||||
if blockID != "" {
|
||||
switch {
|
||||
case blockID != "":
|
||||
for _, b := range blocks {
|
||||
if b.Meta().ULID.String() == blockID {
|
||||
block = b
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if len(blocks) > 0 {
|
||||
case len(blocks) > 0:
|
||||
block = blocks[len(blocks)-1]
|
||||
}
|
||||
if block == nil {
|
||||
|
|
|
@ -130,7 +130,7 @@ func resolveAndGlobFilepaths(baseDir string, utf *unitTestFile) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(m) <= 0 {
|
||||
if len(m) == 0 {
|
||||
fmt.Fprintln(os.Stderr, " WARNING: no file match pattern", rf)
|
||||
}
|
||||
globbedFiles = append(globbedFiles, m...)
|
||||
|
|
|
@ -164,7 +164,7 @@ func NewEC2Discovery(conf *EC2SDConfig, logger log.Logger) *EC2Discovery {
|
|||
return d
|
||||
}
|
||||
|
||||
func (d *EC2Discovery) ec2Client(ctx context.Context) (*ec2.EC2, error) {
|
||||
func (d *EC2Discovery) ec2Client(context.Context) (*ec2.EC2, error) {
|
||||
if d.ec2 != nil {
|
||||
return d.ec2, nil
|
||||
}
|
||||
|
|
|
@ -285,21 +285,22 @@ func lookupWithSearchPath(name string, qtype uint16, logger log.Logger) (*dns.Ms
|
|||
for _, lname := range conf.NameList(name) {
|
||||
response, err := lookupFromAnyServer(lname, qtype, conf, logger)
|
||||
|
||||
if err != nil {
|
||||
switch {
|
||||
case err != nil:
|
||||
// We can't go home yet, because a later name
|
||||
// may give us a valid, successful answer. However
|
||||
// we can no longer say "this name definitely doesn't
|
||||
// exist", because we did not get that answer for
|
||||
// at least one name.
|
||||
allResponsesValid = false
|
||||
} else if response.Rcode == dns.RcodeSuccess {
|
||||
case response.Rcode == dns.RcodeSuccess:
|
||||
// Outcome 1: GOLD!
|
||||
return response, nil
|
||||
}
|
||||
}
|
||||
|
||||
if allResponsesValid {
|
||||
// Outcome 2: everyone says NXDOMAIN, that's good enough for me
|
||||
// Outcome 2: everyone says NXDOMAIN, that's good enough for me.
|
||||
return &dns.Msg{}, nil
|
||||
}
|
||||
// Outcome 3: boned.
|
||||
|
|
|
@ -59,7 +59,7 @@ type hcloudDiscovery struct {
|
|||
}
|
||||
|
||||
// newHcloudDiscovery returns a new hcloudDiscovery which periodically refreshes its targets.
|
||||
func newHcloudDiscovery(conf *SDConfig, logger log.Logger) (*hcloudDiscovery, error) {
|
||||
func newHcloudDiscovery(conf *SDConfig, _ log.Logger) (*hcloudDiscovery, error) {
|
||||
d := &hcloudDiscovery{
|
||||
port: conf.Port,
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ type robotDiscovery struct {
|
|||
}
|
||||
|
||||
// newRobotDiscovery returns a new robotDiscovery which periodically refreshes its targets.
|
||||
func newRobotDiscovery(conf *SDConfig, logger log.Logger) (*robotDiscovery, error) {
|
||||
func newRobotDiscovery(conf *SDConfig, _ log.Logger) (*robotDiscovery, error) {
|
||||
d := &robotDiscovery{
|
||||
port: conf.Port,
|
||||
endpoint: conf.robotEndpoint,
|
||||
|
@ -69,7 +69,7 @@ func newRobotDiscovery(conf *SDConfig, logger log.Logger) (*robotDiscovery, erro
|
|||
return d, nil
|
||||
}
|
||||
|
||||
func (d *robotDiscovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||
func (d *robotDiscovery) refresh(context.Context) ([]*targetgroup.Group, error) {
|
||||
req, err := http.NewRequest("GET", d.endpoint+"/server", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -60,7 +60,7 @@ type serverDiscovery struct {
|
|||
datacenterID string
|
||||
}
|
||||
|
||||
func newServerDiscovery(conf *SDConfig, logger log.Logger) (*serverDiscovery, error) {
|
||||
func newServerDiscovery(conf *SDConfig, _ log.Logger) (*serverDiscovery, error) {
|
||||
d := &serverDiscovery{
|
||||
port: conf.Port,
|
||||
datacenterID: conf.DatacenterID,
|
||||
|
|
|
@ -122,11 +122,11 @@ func (f *clientGoRequestMetricAdapter) Register(registerer prometheus.Registerer
|
|||
)
|
||||
}
|
||||
|
||||
func (clientGoRequestMetricAdapter) Increment(ctx context.Context, code, method, host string) {
|
||||
func (clientGoRequestMetricAdapter) Increment(_ context.Context, code, _, _ string) {
|
||||
clientGoRequestResultMetricVec.WithLabelValues(code).Inc()
|
||||
}
|
||||
|
||||
func (clientGoRequestMetricAdapter) Observe(ctx context.Context, verb string, u url.URL, latency time.Duration) {
|
||||
func (clientGoRequestMetricAdapter) Observe(_ context.Context, _ string, u url.URL, latency time.Duration) {
|
||||
clientGoRequestLatencyMetricVec.WithLabelValues(u.EscapedPath()).Observe(latency.Seconds())
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ func (f *clientGoWorkqueueMetricsProvider) NewLongestRunningProcessorSecondsMetr
|
|||
return clientGoWorkqueueLongestRunningProcessorMetricVec.WithLabelValues(name)
|
||||
}
|
||||
|
||||
func (clientGoWorkqueueMetricsProvider) NewRetriesMetric(name string) workqueue.CounterMetric {
|
||||
func (clientGoWorkqueueMetricsProvider) NewRetriesMetric(string) workqueue.CounterMetric {
|
||||
// Retries are not used so the metric is omitted.
|
||||
return noopMetric{}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint:revive // Many legitimately empty blocks in this file.
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
|
|
|
@ -190,7 +190,7 @@ func (e *EndpointSlice) Run(ctx context.Context, ch chan<- []*targetgroup.Group)
|
|||
}
|
||||
|
||||
go func() {
|
||||
for e.process(ctx, ch) {
|
||||
for e.process(ctx, ch) { // nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -300,7 +300,7 @@ func (e *EndpointSlice) buildEndpointSlice(eps endpointSliceAdaptor) *targetgrou
|
|||
}
|
||||
|
||||
if port.protocol() != nil {
|
||||
target[endpointSlicePortProtocolLabel] = lv(string(*port.protocol()))
|
||||
target[endpointSlicePortProtocolLabel] = lv(*port.protocol())
|
||||
}
|
||||
|
||||
if port.port() != nil {
|
||||
|
|
|
@ -89,7 +89,7 @@ func (i *Ingress) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
|||
}
|
||||
|
||||
go func() {
|
||||
for i.process(ctx, ch) {
|
||||
for i.process(ctx, ch) { // nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -299,12 +299,13 @@ func New(l log.Logger, conf *SDConfig) (*Discovery, error) {
|
|||
err error
|
||||
ownNamespace string
|
||||
)
|
||||
if conf.KubeConfig != "" {
|
||||
switch {
|
||||
case conf.KubeConfig != "":
|
||||
kcfg, err = clientcmd.BuildConfigFromFlags("", conf.KubeConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if conf.APIServer.URL == nil {
|
||||
case conf.APIServer.URL == nil:
|
||||
// Use the Kubernetes provided pod service account
|
||||
// as described in https://kubernetes.io/docs/admin/service-accounts-admin/
|
||||
kcfg, err = rest.InClusterConfig()
|
||||
|
@ -324,7 +325,7 @@ func New(l log.Logger, conf *SDConfig) (*Discovery, error) {
|
|||
}
|
||||
|
||||
level.Info(l).Log("msg", "Using pod service account via in-cluster config")
|
||||
} else {
|
||||
default:
|
||||
rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "kubernetes_sd")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -96,7 +96,7 @@ func (n *Node) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
|||
}
|
||||
|
||||
go func() {
|
||||
for n.process(ctx, ch) {
|
||||
for n.process(ctx, ch) { // nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ func (p *Pod) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
|||
}
|
||||
|
||||
go func() {
|
||||
for p.process(ctx, ch) {
|
||||
for p.process(ctx, ch) { // nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ func (s *Service) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
|||
}
|
||||
|
||||
go func() {
|
||||
for s.process(ctx, ch) {
|
||||
for s.process(ctx, ch) { // nolint:revive
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -686,12 +686,7 @@ func TestTargetUpdatesOrder(t *testing.T) {
|
|||
case tgs := <-provUpdates:
|
||||
discoveryManager.updateGroup(poolKey{setName: strconv.Itoa(i), provider: tc.title}, tgs)
|
||||
for _, got := range discoveryManager.allGroups() {
|
||||
assertEqualGroups(t, got, tc.expectedTargets[x], func(got, expected string) string {
|
||||
return fmt.Sprintf("%d: \ntargets mismatch \ngot: %v \nexpected: %v",
|
||||
x,
|
||||
got,
|
||||
expected)
|
||||
})
|
||||
assertEqualGroups(t, got, tc.expectedTargets[x])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -699,7 +694,7 @@ func TestTargetUpdatesOrder(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func assertEqualGroups(t *testing.T, got, expected []*targetgroup.Group, msg func(got, expected string) string) {
|
||||
func assertEqualGroups(t *testing.T, got, expected []*targetgroup.Group) {
|
||||
t.Helper()
|
||||
|
||||
// Need to sort by the groups's source as the received order is not guaranteed.
|
||||
|
@ -1079,9 +1074,7 @@ func TestCoordinationWithReceiver(t *testing.T) {
|
|||
if _, ok := tgs[k]; !ok {
|
||||
t.Fatalf("step %d: target group not found: %s\ngot: %#v", i, k, tgs)
|
||||
}
|
||||
assertEqualGroups(t, tgs[k], expected.tgs[k], func(got, expected string) string {
|
||||
return fmt.Sprintf("step %d: targets mismatch \ngot: %q \nexpected: %q", i, got, expected)
|
||||
})
|
||||
assertEqualGroups(t, tgs[k], expected.tgs[k])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ func replaceYAMLTypeError(err error, oldTyp, newTyp reflect.Type) error {
|
|||
oldStr := oldTyp.String()
|
||||
newStr := newTyp.String()
|
||||
for i, s := range e.Errors {
|
||||
e.Errors[i] = strings.Replace(s, oldStr, newStr, -1)
|
||||
e.Errors[i] = strings.ReplaceAll(s, oldStr, newStr)
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
|
|
@ -249,20 +249,20 @@ func (d *Discovery) refreshData(ctx context.Context) ([]*targetgroup.Group, erro
|
|||
if detailedIP.Address != ip.String() {
|
||||
continue
|
||||
}
|
||||
|
||||
if detailedIP.Public && publicIPv4 == "" {
|
||||
switch {
|
||||
case detailedIP.Public && publicIPv4 == "":
|
||||
publicIPv4 = detailedIP.Address
|
||||
|
||||
if detailedIP.RDNS != "" && detailedIP.RDNS != "null" {
|
||||
publicIPv4RDNS = detailedIP.RDNS
|
||||
}
|
||||
} else if !detailedIP.Public && privateIPv4 == "" {
|
||||
case !detailedIP.Public && privateIPv4 == "":
|
||||
privateIPv4 = detailedIP.Address
|
||||
|
||||
if detailedIP.RDNS != "" && detailedIP.RDNS != "null" {
|
||||
privateIPv4RDNS = detailedIP.RDNS
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
extraIPs = append(extraIPs, detailedIP.Address)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -686,12 +686,7 @@ func TestTargetUpdatesOrder(t *testing.T) {
|
|||
case tgs := <-provUpdates:
|
||||
discoveryManager.updateGroup(poolKey{setName: strconv.Itoa(i), provider: tc.title}, tgs)
|
||||
for _, got := range discoveryManager.allGroups() {
|
||||
assertEqualGroups(t, got, tc.expectedTargets[x], func(got, expected string) string {
|
||||
return fmt.Sprintf("%d: \ntargets mismatch \ngot: %v \nexpected: %v",
|
||||
x,
|
||||
got,
|
||||
expected)
|
||||
})
|
||||
assertEqualGroups(t, got, tc.expectedTargets[x])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -699,7 +694,7 @@ func TestTargetUpdatesOrder(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func assertEqualGroups(t *testing.T, got, expected []*targetgroup.Group, msg func(got, expected string) string) {
|
||||
func assertEqualGroups(t *testing.T, got, expected []*targetgroup.Group) {
|
||||
t.Helper()
|
||||
|
||||
// Need to sort by the groups's source as the received order is not guaranteed.
|
||||
|
@ -1129,7 +1124,7 @@ type lockStaticConfig struct {
|
|||
}
|
||||
|
||||
func (s lockStaticConfig) Name() string { return "lockstatic" }
|
||||
func (s lockStaticConfig) NewDiscoverer(options DiscovererOptions) (Discoverer, error) {
|
||||
func (s lockStaticConfig) NewDiscoverer(DiscovererOptions) (Discoverer, error) {
|
||||
return (lockStaticDiscoverer)(s), nil
|
||||
}
|
||||
|
||||
|
@ -1330,9 +1325,7 @@ func TestCoordinationWithReceiver(t *testing.T) {
|
|||
if _, ok := tgs[k]; !ok {
|
||||
t.Fatalf("step %d: target group not found: %s\ngot: %#v", i, k, tgs)
|
||||
}
|
||||
assertEqualGroups(t, tgs[k], expected.tgs[k], func(got, expected string) string {
|
||||
return fmt.Sprintf("step %d: targets mismatch \ngot: %q \nexpected: %q", i, got, expected)
|
||||
})
|
||||
assertEqualGroups(t, tgs[k], expected.tgs[k])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1399,7 +1392,7 @@ func (o onceProvider) Run(_ context.Context, ch chan<- []*targetgroup.Group) {
|
|||
|
||||
// TestTargetSetTargetGroupsUpdateDuringApplyConfig is used to detect races when
|
||||
// ApplyConfig happens at the same time as targets update.
|
||||
func TestTargetSetTargetGroupsUpdateDuringApplyConfig(t *testing.T) {
|
||||
func TestTargetSetTargetGroupsUpdateDuringApplyConfig(*testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
discoveryManager := NewManager(ctx, log.NewNopLogger())
|
||||
|
|
|
@ -136,9 +136,10 @@ func NewDiscovery(conf SDConfig, logger log.Logger) (*Discovery, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if len(conf.AuthToken) > 0 {
|
||||
switch {
|
||||
case len(conf.AuthToken) > 0:
|
||||
rt, err = newAuthTokenRoundTripper(conf.AuthToken, rt)
|
||||
} else if len(conf.AuthTokenFile) > 0 {
|
||||
case len(conf.AuthTokenFile) > 0:
|
||||
rt, err = newAuthTokenFileRoundTripper(conf.AuthTokenFile, rt)
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -400,19 +401,20 @@ func targetsForApp(app *app) []model.LabelSet {
|
|||
var labels []map[string]string
|
||||
var prefix string
|
||||
|
||||
if len(app.Container.PortMappings) != 0 {
|
||||
switch {
|
||||
case len(app.Container.PortMappings) != 0:
|
||||
// In Marathon 1.5.x the "container.docker.portMappings" object was moved
|
||||
// to "container.portMappings".
|
||||
ports, labels = extractPortMapping(app.Container.PortMappings, app.isContainerNet())
|
||||
prefix = portMappingLabelPrefix
|
||||
|
||||
} else if len(app.Container.Docker.PortMappings) != 0 {
|
||||
case len(app.Container.Docker.PortMappings) != 0:
|
||||
// Prior to Marathon 1.5 the port mappings could be found at the path
|
||||
// "container.docker.portMappings".
|
||||
ports, labels = extractPortMapping(app.Container.Docker.PortMappings, app.isContainerNet())
|
||||
prefix = portMappingLabelPrefix
|
||||
|
||||
} else if len(app.PortDefinitions) != 0 {
|
||||
case len(app.PortDefinitions) != 0:
|
||||
// PortDefinitions deprecates the "ports" array and can be used to specify
|
||||
// a list of ports with metadata in case a mapping is not required.
|
||||
ports = make([]uint32, len(app.PortDefinitions))
|
||||
|
|
|
@ -161,7 +161,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) {
|
|||
return d, nil
|
||||
}
|
||||
|
||||
func (d *Discovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||
func (d *Discovery) refresh(context.Context) ([]*targetgroup.Group, error) {
|
||||
opts := &nomad.QueryOptions{
|
||||
AllowStale: d.allowStale,
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ func (d *dedicatedServerDiscovery) getSource() string {
|
|||
return fmt.Sprintf("%s_%s", d.config.Name(), d.getService())
|
||||
}
|
||||
|
||||
func (d *dedicatedServerDiscovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||
func (d *dedicatedServerDiscovery) refresh(context.Context) ([]*targetgroup.Group, error) {
|
||||
client, err := createClient(d.config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -84,7 +84,7 @@ func MockDedicatedAPI(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if string(r.URL.Path) == "/dedicated/server" {
|
||||
if r.URL.Path == "/dedicated/server" {
|
||||
dedicatedServersList, err := os.ReadFile("testdata/dedicated_server/dedicated_servers.json")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
@ -96,7 +96,7 @@ func MockDedicatedAPI(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
}
|
||||
if string(r.URL.Path) == "/dedicated/server/abcde" {
|
||||
if r.URL.Path == "/dedicated/server/abcde" {
|
||||
dedicatedServer, err := os.ReadFile("testdata/dedicated_server/dedicated_servers_details.json")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
@ -108,7 +108,7 @@ func MockDedicatedAPI(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
}
|
||||
if string(r.URL.Path) == "/dedicated/server/abcde/ips" {
|
||||
if r.URL.Path == "/dedicated/server/abcde/ips" {
|
||||
dedicatedServerIPs, err := os.ReadFile("testdata/dedicated_server/dedicated_servers_abcde_ips.json")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
|
|
@ -117,7 +117,7 @@ func (d *vpsDiscovery) getSource() string {
|
|||
return fmt.Sprintf("%s_%s", d.config.Name(), d.getService())
|
||||
}
|
||||
|
||||
func (d *vpsDiscovery) refresh(ctx context.Context) ([]*targetgroup.Group, error) {
|
||||
func (d *vpsDiscovery) refresh(context.Context) ([]*targetgroup.Group, error) {
|
||||
client, err := createClient(d.config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -91,7 +91,7 @@ func MockVpsAPI(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if string(r.URL.Path) == "/vps" {
|
||||
if r.URL.Path == "/vps" {
|
||||
dedicatedServersList, err := os.ReadFile("testdata/vps/vps.json")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
@ -103,7 +103,7 @@ func MockVpsAPI(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
}
|
||||
if string(r.URL.Path) == "/vps/abc" {
|
||||
if r.URL.Path == "/vps/abc" {
|
||||
dedicatedServer, err := os.ReadFile("testdata/vps/vps_details.json")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
@ -115,7 +115,7 @@ func MockVpsAPI(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
}
|
||||
if string(r.URL.Path) == "/vps/abc/ips" {
|
||||
if r.URL.Path == "/vps/abc/ips" {
|
||||
dedicatedServerIPs, err := os.ReadFile("testdata/vps/vps_abc_ips.json")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
|
|
@ -253,7 +253,7 @@ func replaceYAMLTypeError(err error, oldTyp, newTyp reflect.Type) error {
|
|||
oldStr := oldTyp.String()
|
||||
newStr := newTyp.String()
|
||||
for i, s := range e.Errors {
|
||||
e.Errors[i] = strings.Replace(s, oldStr, newStr, -1)
|
||||
e.Errors[i] = strings.ReplaceAll(s, oldStr, newStr)
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
|
|
@ -202,10 +202,8 @@ func (d *Discovery) listInstances(ctx context.Context) ([]govultr.Instance, erro
|
|||
|
||||
if meta.Links.Next == "" {
|
||||
break
|
||||
} else {
|
||||
listOptions.Cursor = meta.Links.Next
|
||||
continue
|
||||
}
|
||||
listOptions.Cursor = meta.Links.Next
|
||||
}
|
||||
|
||||
return instances, nil
|
||||
|
|
|
@ -132,13 +132,13 @@ type MonitoringAssignment_Target struct {
|
|||
// E.g., `backend-01`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
// Scheme on which to scrape the target.
|
||||
//E.g., `http`
|
||||
// E.g., `http`
|
||||
Scheme string `protobuf:"bytes,2,opt,name=scheme,proto3" json:"scheme,omitempty"`
|
||||
// Address (preferably IP) for the service
|
||||
// E.g., `backend.svc` or `10.1.4.32:9090`
|
||||
Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
|
||||
// Optional path to append to the address for scraping
|
||||
//E.g., `/metrics`
|
||||
// E.g., `/metrics`
|
||||
MetricsPath string `protobuf:"bytes,4,opt,name=metrics_path,json=metricsPath,proto3" json:"metrics_path,omitempty"`
|
||||
// Arbitrary labels associated with that particular target.
|
||||
//
|
||||
|
|
|
@ -193,7 +193,7 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
|
|||
}
|
||||
for _, pathUpdate := range d.pathUpdates {
|
||||
// Drain event channel in case the treecache leaks goroutines otherwise.
|
||||
for range pathUpdate {
|
||||
for range pathUpdate { // nolint:revive
|
||||
}
|
||||
}
|
||||
d.conn.Close()
|
||||
|
|
|
@ -673,7 +673,11 @@ GET /api/v1/rules
|
|||
```
|
||||
|
||||
URL query parameters:
|
||||
|
||||
- `type=alert|record`: return only the alerting rules (e.g. `type=alert`) or the recording rules (e.g. `type=record`). When the parameter is absent or empty, no filtering is done.
|
||||
- `rule_name[]=<string>`: only return rules with the given rule name. If the parameter is repeated, rules with any of the provided names are returned. If we've filtered out all the rules of a group, the group is not returned. When the parameter is absent or empty, no filtering is done.
|
||||
- `rule_group[]=<string>`: only return rules with the given rule group name. If the parameter is repeated, rules with any of the provided rule group names are returned. When the parameter is absent or empty, no filtering is done.
|
||||
- `file[]=<string>`: only return rules with the given filepath. If the parameter is repeated, rules with any of the provided filepaths are returned. When the parameter is absent or empty, no filtering is done.
|
||||
|
||||
```json
|
||||
$ curl http://localhost:9090/api/v1/rules
|
||||
|
|
|
@ -184,11 +184,11 @@ func (c *Client) buildCommand(q *prompb.Query) (string, error) {
|
|||
}
|
||||
|
||||
func escapeSingleQuotes(str string) string {
|
||||
return strings.Replace(str, `'`, `\'`, -1)
|
||||
return strings.ReplaceAll(str, `'`, `\'`)
|
||||
}
|
||||
|
||||
func escapeSlashes(str string) string {
|
||||
return strings.Replace(str, `/`, `\/`, -1)
|
||||
return strings.ReplaceAll(str, `/`, `\/`)
|
||||
}
|
||||
|
||||
func mergeResult(labelsToSeries map[string]*prompb.TimeSeries, results []influx.Result) error {
|
||||
|
@ -290,13 +290,14 @@ func mergeSamples(a, b []prompb.Sample) []prompb.Sample {
|
|||
result := make([]prompb.Sample, 0, len(a)+len(b))
|
||||
i, j := 0, 0
|
||||
for i < len(a) && j < len(b) {
|
||||
if a[i].Timestamp < b[j].Timestamp {
|
||||
switch {
|
||||
case a[i].Timestamp < b[j].Timestamp:
|
||||
result = append(result, a[i])
|
||||
i++
|
||||
} else if a[i].Timestamp > b[j].Timestamp {
|
||||
case a[i].Timestamp > b[j].Timestamp:
|
||||
result = append(result, b[j])
|
||||
j++
|
||||
} else {
|
||||
default:
|
||||
result = append(result, a[i])
|
||||
i++
|
||||
j++
|
||||
|
|
50
go.mod
50
go.mod
|
@ -9,47 +9,47 @@ require (
|
|||
github.com/DmitriyVTitov/size v1.5.0
|
||||
github.com/alecthomas/kingpin/v2 v2.3.2
|
||||
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137
|
||||
github.com/aws/aws-sdk-go v1.44.217
|
||||
github.com/aws/aws-sdk-go v1.44.245
|
||||
github.com/cespare/xxhash/v2 v2.2.0
|
||||
github.com/dennwc/varint v1.0.0
|
||||
github.com/dgraph-io/ristretto v0.1.1
|
||||
github.com/digitalocean/godo v1.98.0
|
||||
github.com/docker/docker v23.0.1+incompatible
|
||||
github.com/docker/docker v23.0.4+incompatible
|
||||
github.com/edsrzf/mmap-go v1.1.0
|
||||
github.com/envoyproxy/go-control-plane v0.11.0
|
||||
github.com/envoyproxy/protoc-gen-validate v0.9.1
|
||||
github.com/envoyproxy/protoc-gen-validate v0.10.1
|
||||
github.com/fsnotify/fsnotify v1.6.0
|
||||
github.com/go-kit/log v0.2.1
|
||||
github.com/go-logfmt/logfmt v0.6.0
|
||||
github.com/go-openapi/strfmt v0.21.3
|
||||
github.com/go-openapi/strfmt v0.21.7
|
||||
github.com/go-zookeeper/zk v1.0.3
|
||||
github.com/gogo/protobuf v1.3.2
|
||||
github.com/golang/snappy v0.0.4
|
||||
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10
|
||||
github.com/gophercloud/gophercloud v1.2.0
|
||||
github.com/google/pprof v0.0.0-20230406165453-00490a63f317
|
||||
github.com/gophercloud/gophercloud v1.3.0
|
||||
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||
github.com/hashicorp/consul/api v1.20.0
|
||||
github.com/hashicorp/nomad/api v0.0.0-20230308192510-48e7d70fcd4b
|
||||
github.com/hetznercloud/hcloud-go v1.41.0
|
||||
github.com/ionos-cloud/sdk-go/v6 v6.1.5
|
||||
github.com/hashicorp/nomad/api v0.0.0-20230418003350-3067191c5197
|
||||
github.com/hetznercloud/hcloud-go v1.42.0
|
||||
github.com/ionos-cloud/sdk-go/v6 v6.1.6
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b
|
||||
github.com/linode/linodego v1.14.1
|
||||
github.com/linode/linodego v1.16.1
|
||||
github.com/miekg/dns v1.1.53
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
|
||||
github.com/oklog/run v1.1.0
|
||||
github.com/oklog/ulid v1.3.1
|
||||
github.com/ovh/go-ovh v1.3.0
|
||||
github.com/ovh/go-ovh v1.4.1
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/alertmanager v0.25.0
|
||||
github.com/prometheus/client_golang v1.14.0
|
||||
github.com/prometheus/client_golang v1.15.0
|
||||
github.com/prometheus/client_model v0.3.0
|
||||
github.com/prometheus/common v0.42.0
|
||||
github.com/prometheus/common/assets v0.2.0
|
||||
github.com/prometheus/common/sigv4 v0.1.0
|
||||
github.com/prometheus/exporter-toolkit v0.9.1
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749
|
||||
github.com/stretchr/testify v1.8.2
|
||||
github.com/vultr/govultr/v2 v2.17.2
|
||||
|
@ -61,18 +61,18 @@ require (
|
|||
go.opentelemetry.io/otel/sdk v1.14.0
|
||||
go.opentelemetry.io/otel/trace v1.14.0
|
||||
go.uber.org/atomic v1.10.0
|
||||
go.uber.org/automaxprocs v1.5.1
|
||||
go.uber.org/automaxprocs v1.5.2
|
||||
go.uber.org/goleak v1.2.1
|
||||
golang.org/x/net v0.8.0
|
||||
golang.org/x/oauth2 v0.6.0
|
||||
golang.org/x/net v0.9.0
|
||||
golang.org/x/oauth2 v0.7.0
|
||||
golang.org/x/sync v0.1.0
|
||||
golang.org/x/sys v0.6.0
|
||||
golang.org/x/sys v0.7.0
|
||||
golang.org/x/time v0.3.0
|
||||
golang.org/x/tools v0.7.0
|
||||
golang.org/x/tools v0.8.0
|
||||
google.golang.org/api v0.114.0
|
||||
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4
|
||||
google.golang.org/grpc v1.53.0
|
||||
google.golang.org/protobuf v1.29.1
|
||||
google.golang.org/protobuf v1.30.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
k8s.io/api v0.26.2
|
||||
|
@ -88,7 +88,7 @@ require (
|
|||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.10.0 // indirect
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
|
||||
)
|
||||
|
||||
|
@ -169,16 +169,16 @@ require (
|
|||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/procfs v0.9.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
go.mongodb.org/mongo-driver v1.11.2 // indirect
|
||||
go.mongodb.org/mongo-driver v1.11.3 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v0.37.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
|
||||
golang.org/x/crypto v0.7.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230307190834-24139beb5833
|
||||
golang.org/x/mod v0.9.0 // indirect
|
||||
golang.org/x/term v0.6.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
|
||||
golang.org/x/mod v0.10.0 // indirect
|
||||
golang.org/x/term v0.7.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
|
|
104
go.sum
104
go.sum
|
@ -100,8 +100,8 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:W
|
|||
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
|
||||
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
|
||||
github.com/aws/aws-sdk-go v1.44.217 h1:FcWC56MRl+k756aH3qeMQTylSdeJ58WN0iFz3fkyRz0=
|
||||
github.com/aws/aws-sdk-go v1.44.217/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/aws/aws-sdk-go v1.44.245 h1:KtY2s4q31/kn33AdV63R5t77mdxsI7rq3YT7Mgo805M=
|
||||
github.com/aws/aws-sdk-go v1.44.245/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
|
@ -160,8 +160,8 @@ github.com/digitalocean/godo v1.98.0/go.mod h1:NRpFznZFvhHjBoqZAaOD3khVzsJ3EibzK
|
|||
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
|
||||
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
|
||||
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v23.0.1+incompatible h1:vjgvJZxprTTE1A37nm+CLNAdwu6xZekyoiVlUZEINcY=
|
||||
github.com/docker/docker v23.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker v23.0.4+incompatible h1:Kd3Bh9V/rO+XpTP/BLqM+gx8z7+Yb0AA2Ibj+nNo4ek=
|
||||
github.com/docker/docker v23.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
|
||||
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
|
||||
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
||||
|
@ -188,8 +188,8 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.
|
|||
github.com/envoyproxy/go-control-plane v0.11.0 h1:jtLewhRR2vMRNnq2ZZUoCjUlgut+Y0+sDDWPOfwOi1o=
|
||||
github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.9.1 h1:PS7VIOgmSVhWUEeZwTe7z7zouA22Cr590PzXKbZHOVY=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss=
|
||||
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
|
||||
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
|
@ -253,8 +253,9 @@ github.com/go-openapi/spec v0.20.8 h1:ubHmXNY3FCIOinT8RNrrPfGc9t7I1qhPtdOGoG2AxR
|
|||
github.com/go-openapi/spec v0.20.8/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
|
||||
github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg=
|
||||
github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k=
|
||||
github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o=
|
||||
github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg=
|
||||
github.com/go-openapi/strfmt v0.21.7 h1:rspiXgNWgeUzhjo1YU01do6qsahtJNByjLVbPLNHb8k=
|
||||
github.com/go-openapi/strfmt v0.21.7/go.mod h1:adeGTkxE44sPyLk0JV235VQAO/ZXUr8KAzYjclFs3ew=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||
github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||
|
@ -374,8 +375,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf
|
|||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 h1:CqYfpuYIjnlNxM3msdyPRKabhXZWbKjf3Q8BWROFBso=
|
||||
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk=
|
||||
github.com/google/pprof v0.0.0-20230406165453-00490a63f317 h1:hFhpt7CTmR3DX+b4R19ydQFtofxT0Sv3QsKNMVQYTMQ=
|
||||
github.com/google/pprof v0.0.0-20230406165453-00490a63f317/go.mod h1:79YE0hCXdHag9sBkw2o+N/YnZtTkXi0UT9Nnixa5eYk=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
|
@ -388,8 +389,8 @@ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+
|
|||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gax-go/v2 v2.7.1 h1:gF4c0zjUP2H/s/hEGyLA3I0fA2ZWjzYiONAD6cvPr8A=
|
||||
github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI=
|
||||
github.com/gophercloud/gophercloud v1.2.0 h1:1oXyj4g54KBg/kFtCdMM6jtxSzeIyg8wv4z1HoGPp1E=
|
||||
github.com/gophercloud/gophercloud v1.2.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
|
||||
github.com/gophercloud/gophercloud v1.3.0 h1:RUKyCMiZoQR3VlVR5E3K7PK1AC3/qppsWYo6dtBiqs8=
|
||||
github.com/gophercloud/gophercloud v1.3.0/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
|
@ -458,13 +459,13 @@ github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/
|
|||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM=
|
||||
github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0=
|
||||
github.com/hashicorp/nomad/api v0.0.0-20230308192510-48e7d70fcd4b h1:EkuSTU8c/63q4LMayj8ilgg/4I5PXDFVcnqKfs9qcwI=
|
||||
github.com/hashicorp/nomad/api v0.0.0-20230308192510-48e7d70fcd4b/go.mod h1:bKUb1ytds5KwUioHdvdq9jmrDqCThv95si0Ub7iNeBg=
|
||||
github.com/hashicorp/nomad/api v0.0.0-20230418003350-3067191c5197 h1:I5xhKLePXpXgM6pZ4xZNTiurLLS3sGuZrZFFzAbM67A=
|
||||
github.com/hashicorp/nomad/api v0.0.0-20230418003350-3067191c5197/go.mod h1:2TCrNvonL09r7EiQ6M2rNt+Cmjbn1QbzchFoTWJFpj4=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY=
|
||||
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
|
||||
github.com/hetznercloud/hcloud-go v1.41.0 h1:KJGFRRc68QiVu4PrEP5BmCQVveCP2CM26UGQUKGpIUs=
|
||||
github.com/hetznercloud/hcloud-go v1.41.0/go.mod h1:NaHg47L6C77mngZhwBG652dTAztYrsZ2/iITJKhQkHA=
|
||||
github.com/hetznercloud/hcloud-go v1.42.0 h1:Es/CDOForQN3nOOP5Vxh1N/YHjpCg386iYEX5zCgi+A=
|
||||
github.com/hetznercloud/hcloud-go v1.42.0/go.mod h1:YADL8AbmQYH0Eo+1lkuyoc8LutT0UeMvaKP47nNUb+Y=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
|
@ -472,8 +473,9 @@ github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
|
|||
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/ionos-cloud/sdk-go/v6 v6.1.5 h1:BFqThLOgrGJWeo7w6UDyYuNxyi/GqEmNPl7C/YcQ8Fw=
|
||||
github.com/ionos-cloud/sdk-go/v6 v6.1.5/go.mod h1:EzEgRIDxBELvfoa/uBN0kOQaqovLjUWEB7iW4/Q+t4k=
|
||||
github.com/ionos-cloud/sdk-go/v6 v6.1.6 h1:0n4irdqNska+1s3YMCRhrAqKbibEgQ7SwwhAlHzYT5A=
|
||||
github.com/ionos-cloud/sdk-go/v6 v6.1.6/go.mod h1:EzEgRIDxBELvfoa/uBN0kOQaqovLjUWEB7iW4/Q+t4k=
|
||||
github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
|
@ -521,8 +523,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
|
||||
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
|
||||
github.com/linode/linodego v1.14.1 h1:uGxQyy0BidoEpLGdvfi4cPgEW+0YUFsEGrLEhcTfjNc=
|
||||
github.com/linode/linodego v1.14.1/go.mod h1:NJlzvlNtdMRRkXb0oN6UWzUkj6t+IBsyveHgZ5Ppjyk=
|
||||
github.com/linode/linodego v1.16.1 h1:5otq57M4PdHycPERRfSFZ0s1yz1ETVWGjCp3hh7+F9w=
|
||||
github.com/linode/linodego v1.16.1/go.mod h1:aESRAbpLY9R6IA1WGAWHikRI9DU9Lhesapv1MhKmPHM=
|
||||
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
|
@ -551,6 +553,7 @@ github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
|
|||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||
github.com/maxatome/go-testdeep v1.12.0 h1:Ql7Go8Tg0C1D/uMMX59LAoYK7LffeJQ6X2T04nTH68g=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
|
||||
github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
|
||||
|
@ -622,8 +625,8 @@ github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxS
|
|||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
|
||||
github.com/ovh/go-ovh v1.3.0 h1:mvZaddk4E4kLcXhzb+cxBsMPYp2pHqiQpWYkInsuZPQ=
|
||||
github.com/ovh/go-ovh v1.3.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA=
|
||||
github.com/ovh/go-ovh v1.4.1 h1:VBGa5wMyQtTP7Zb+w97zRCh9sLtM/2YKRyy+MEJmWaM=
|
||||
github.com/ovh/go-ovh v1.4.1/go.mod h1:6bL6pPyUT7tBfI0pqOegJgRjgjuO+mOo+MyXd1EEC0M=
|
||||
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
|
||||
|
@ -652,8 +655,8 @@ github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeD
|
|||
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
||||
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
|
||||
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
|
||||
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
|
||||
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
|
||||
github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM=
|
||||
github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
|
@ -691,16 +694,16 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L
|
|||
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14 h1:yFl3jyaSVLNYXlnNYM5z2pagEk1dYQhfr1p20T1NyKY=
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.14/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15 h1:Y7xOFbD+3jaPw+VN7lkakNJ/pa+ZSQVFp1ONtJaBxns=
|
||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/shoenig/test v0.6.2 h1:tdq+WGnznwE5xcOMXkqqXuudK75RkSGBazBGcP1lX6w=
|
||||
github.com/shoenig/test v0.6.3 h1:GVXWJFk9PiOjN0KoJ7VrJGH6uLPnqxR7/fe3HUPfE0c=
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 h1:bUGsEnyNbVPw06Bs80sCeARAlK8lhwqGyi6UT8ymuGk=
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
|
@ -774,8 +777,8 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI
|
|||
go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg=
|
||||
go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng=
|
||||
go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8=
|
||||
go.mongodb.org/mongo-driver v1.11.2 h1:+1v2rDQUWNcGW7/7E0Jvdz51V38XXxJfhzbV17aNHCw=
|
||||
go.mongodb.org/mongo-driver v1.11.2/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8=
|
||||
go.mongodb.org/mongo-driver v1.11.3 h1:Ql6K6qYHEzB6xvu4+AU0BoRoqf9vFPcc4o7MUIdPW8Y=
|
||||
go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
|
@ -810,8 +813,8 @@ go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
|||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
|
||||
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
go.uber.org/automaxprocs v1.5.1 h1:e1YG66Lrk73dn4qhg8WFSvhF0JuFQF0ERIp4rpuV8Qk=
|
||||
go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU=
|
||||
go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME=
|
||||
go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
|
||||
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
|
||||
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
|
@ -847,8 +850,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
|||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20230307190834-24139beb5833 h1:SChBja7BCQewoTAU7IgvucQKMIXrEpFxNMs0spT3/5s=
|
||||
golang.org/x/exp v0.0.0-20230307190834-24139beb5833/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
|
@ -870,8 +873,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
|
|||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
|
||||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
|
||||
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
|
@ -919,8 +922,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
|
@ -928,8 +931,8 @@ golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4Iltr
|
|||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.6.0 h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw=
|
||||
golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw=
|
||||
golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g=
|
||||
golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
|
@ -1012,14 +1015,14 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
|
||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
|
||||
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
@ -1030,8 +1033,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
@ -1091,8 +1094,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
|
|||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
|
||||
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y=
|
||||
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
@ -1192,8 +1195,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
|
|||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.29.1 h1:7QBf+IK2gx70Ap/hDsOmam3GE0v9HicjfEdAxE62UoM=
|
||||
google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -1207,7 +1210,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy
|
|||
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
|
|
|
@ -824,10 +824,11 @@ mergeLoop: // Merge together all buckets from the original schema that fall into
|
|||
origIdx += span.Offset
|
||||
}
|
||||
currIdx := i.targetIdx(origIdx)
|
||||
if firstPass {
|
||||
switch {
|
||||
case firstPass:
|
||||
i.currIdx = currIdx
|
||||
firstPass = false
|
||||
} else if currIdx != i.currIdx {
|
||||
case currIdx != i.currIdx:
|
||||
// Reached next bucket in targetSchema.
|
||||
// Do not actually forward to the next bucket, but break out.
|
||||
break mergeLoop
|
||||
|
|
|
@ -169,11 +169,12 @@ func (ls Labels) HashForLabels(b []byte, names ...string) (uint64, []byte) {
|
|||
b = b[:0]
|
||||
i, j := 0, 0
|
||||
for i < len(ls) && j < len(names) {
|
||||
if names[j] < ls[i].Name {
|
||||
switch {
|
||||
case names[j] < ls[i].Name:
|
||||
j++
|
||||
} else if ls[i].Name < names[j] {
|
||||
case ls[i].Name < names[j]:
|
||||
i++
|
||||
} else {
|
||||
default:
|
||||
b = append(b, ls[i].Name...)
|
||||
b = append(b, seps[0])
|
||||
b = append(b, ls[i].Value...)
|
||||
|
@ -213,11 +214,12 @@ func (ls Labels) BytesWithLabels(buf []byte, names ...string) []byte {
|
|||
b.WriteByte(labelSep)
|
||||
i, j := 0, 0
|
||||
for i < len(ls) && j < len(names) {
|
||||
if names[j] < ls[i].Name {
|
||||
switch {
|
||||
case names[j] < ls[i].Name:
|
||||
j++
|
||||
} else if ls[i].Name < names[j] {
|
||||
case ls[i].Name < names[j]:
|
||||
i++
|
||||
} else {
|
||||
default:
|
||||
if b.Len() > 1 {
|
||||
b.WriteByte(seps[0])
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ func findSetMatchesInternal(re *syntax.Regexp, base string) (matches []string, c
|
|||
}
|
||||
var matches []string
|
||||
var totalSet int
|
||||
for i := 0; i+1 < len(re.Rune); i = i + 2 {
|
||||
for i := 0; i+1 < len(re.Rune); i += 2 {
|
||||
totalSet += int(re.Rune[i+1]-re.Rune[i]) + 1
|
||||
}
|
||||
// limits the total characters that can be used to create matches.
|
||||
|
@ -204,7 +204,7 @@ func findSetMatchesInternal(re *syntax.Regexp, base string) (matches []string, c
|
|||
if totalSet > maxSetMatches {
|
||||
return nil, false
|
||||
}
|
||||
for i := 0; i+1 < len(re.Rune); i = i + 2 {
|
||||
for i := 0; i+1 < len(re.Rune); i += 2 {
|
||||
lo, hi := re.Rune[i], re.Rune[i+1]
|
||||
for c := lo; c <= hi; c++ {
|
||||
matches = append(matches, base+string(c))
|
||||
|
@ -566,7 +566,8 @@ type containsStringMatcher struct {
|
|||
|
||||
func (m *containsStringMatcher) Matches(s string) bool {
|
||||
for _, substr := range m.substrings {
|
||||
if m.right != nil && m.left != nil {
|
||||
switch {
|
||||
case m.right != nil && m.left != nil:
|
||||
searchStartPos := 0
|
||||
|
||||
for {
|
||||
|
@ -588,12 +589,12 @@ func (m *containsStringMatcher) Matches(s string) bool {
|
|||
// Continue searching for another occurrence of the substring inside the text.
|
||||
searchStartPos = pos + 1
|
||||
}
|
||||
} else if m.left != nil {
|
||||
case m.left != nil:
|
||||
// If we have to check for characters on the left then we need to match a suffix.
|
||||
if strings.HasSuffix(s, substr) && m.left.Matches(s[:len(s)-len(substr)]) {
|
||||
return true
|
||||
}
|
||||
} else if m.right != nil {
|
||||
case m.right != nil:
|
||||
if strings.HasPrefix(s, substr) && m.right.Matches(s[len(substr):]) {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -238,9 +238,10 @@ func (p *PromParser) Metric(l *labels.Labels) string {
|
|||
return s
|
||||
}
|
||||
|
||||
// Exemplar writes the exemplar of the current sample into the passed
|
||||
// exemplar. It returns if an exemplar exists.
|
||||
func (p *PromParser) Exemplar(e *exemplar.Exemplar) bool {
|
||||
// Exemplar implements the Parser interface. However, since the classic
|
||||
// Prometheus text format does not support exemplars, this implementation simply
|
||||
// returns false and does nothing else.
|
||||
func (p *PromParser) Exemplar(*exemplar.Exemplar) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ func BenchmarkGzip(b *testing.B) {
|
|||
k := b.N / promtestdataSampleCount
|
||||
|
||||
b.ReportAllocs()
|
||||
b.SetBytes(int64(n) / promtestdataSampleCount)
|
||||
b.SetBytes(n / promtestdataSampleCount)
|
||||
b.ResetTimer()
|
||||
|
||||
total := 0
|
||||
|
|
|
@ -4,6 +4,6 @@ re-compile them when building Prometheus.
|
|||
If however you have modified the defs and do need to re-compile, run
|
||||
`make proto` from the parent dir.
|
||||
|
||||
In order for the script to run, you'll need `protoc` (version 3.12.3) in your
|
||||
PATH.
|
||||
In order for the [script](../scripts/genproto.sh) to run, you'll need `protoc` (version 3.15.8) in
|
||||
your PATH.
|
||||
|
||||
|
|
|
@ -20,6 +20,11 @@ import (
|
|||
func (m Sample) T() int64 { return m.Timestamp }
|
||||
func (m Sample) V() float64 { return m.Value }
|
||||
|
||||
func (h Histogram) IsFloatHistogram() bool {
|
||||
_, ok := h.GetCount().(*Histogram_CountFloat)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (r *ChunkedReadResponse) PooledMarshal(p *sync.Pool) ([]byte, error) {
|
||||
size := r.Size()
|
||||
data, ok := p.Get().(*[]byte)
|
||||
|
|
|
@ -27,7 +27,7 @@ import (
|
|||
"github.com/prometheus/prometheus/util/teststorage"
|
||||
)
|
||||
|
||||
func setupRangeQueryTestData(stor *teststorage.TestStorage, engine *Engine, interval, numIntervals int) error {
|
||||
func setupRangeQueryTestData(stor *teststorage.TestStorage, _ *Engine, interval, numIntervals int) error {
|
||||
metrics := []labels.Labels{}
|
||||
metrics = append(metrics, labels.FromStrings("__name__", "a_one"))
|
||||
metrics = append(metrics, labels.FromStrings("__name__", "b_one"))
|
||||
|
@ -194,9 +194,9 @@ func rangeQueryCases() []benchCase {
|
|||
if !strings.Contains(c.expr, "X") {
|
||||
tmp = append(tmp, c)
|
||||
} else {
|
||||
tmp = append(tmp, benchCase{expr: strings.Replace(c.expr, "X", "one", -1), steps: c.steps})
|
||||
tmp = append(tmp, benchCase{expr: strings.Replace(c.expr, "X", "ten", -1), steps: c.steps})
|
||||
tmp = append(tmp, benchCase{expr: strings.Replace(c.expr, "X", "hundred", -1), steps: c.steps})
|
||||
tmp = append(tmp, benchCase{expr: strings.ReplaceAll(c.expr, "X", "one"), steps: c.steps})
|
||||
tmp = append(tmp, benchCase{expr: strings.ReplaceAll(c.expr, "X", "ten"), steps: c.steps})
|
||||
tmp = append(tmp, benchCase{expr: strings.ReplaceAll(c.expr, "X", "hundred"), steps: c.steps})
|
||||
}
|
||||
}
|
||||
cases = tmp
|
||||
|
|
|
@ -70,6 +70,7 @@ type engineMetrics struct {
|
|||
queryPrepareTime prometheus.Observer
|
||||
queryInnerEval prometheus.Observer
|
||||
queryResultSort prometheus.Observer
|
||||
querySamples prometheus.Counter
|
||||
}
|
||||
|
||||
// convertibleToInt64 returns true if v does not over-/underflow an int64.
|
||||
|
@ -333,6 +334,12 @@ func NewEngine(opts EngineOpts) *Engine {
|
|||
Name: "queries_concurrent_max",
|
||||
Help: "The max number of concurrent queries.",
|
||||
}),
|
||||
querySamples: prometheus.NewCounter(prometheus.CounterOpts{
|
||||
Namespace: namespace,
|
||||
Subsystem: subsystem,
|
||||
Name: "query_samples_total",
|
||||
Help: "The total number of samples loaded by all queries.",
|
||||
}),
|
||||
queryQueueTime: queryResultSummary.WithLabelValues("queue_time"),
|
||||
queryPrepareTime: queryResultSummary.WithLabelValues("prepare_time"),
|
||||
queryInnerEval: queryResultSummary.WithLabelValues("inner_eval"),
|
||||
|
@ -358,6 +365,7 @@ func NewEngine(opts EngineOpts) *Engine {
|
|||
metrics.maxConcurrentQueries,
|
||||
metrics.queryLogEnabled,
|
||||
metrics.queryLogFailures,
|
||||
metrics.querySamples,
|
||||
queryResultSummary,
|
||||
)
|
||||
}
|
||||
|
@ -400,7 +408,7 @@ func (ng *Engine) SetQueryLogger(l QueryLogger) {
|
|||
}
|
||||
|
||||
// NewInstantQuery returns an evaluation query for the given expression at the given time.
|
||||
func (ng *Engine) NewInstantQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, ts time.Time) (Query, error) {
|
||||
func (ng *Engine) NewInstantQuery(_ context.Context, q storage.Queryable, opts *QueryOpts, qs string, ts time.Time) (Query, error) {
|
||||
expr, err := parser.ParseExpr(qs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -416,7 +424,7 @@ func (ng *Engine) NewInstantQuery(ctx context.Context, q storage.Queryable, opts
|
|||
|
||||
// NewRangeQuery returns an evaluation query for the given time range and with
|
||||
// the resolution set by the interval.
|
||||
func (ng *Engine) NewRangeQuery(ctx context.Context, q storage.Queryable, opts *QueryOpts, qs string, start, end time.Time, interval time.Duration) (Query, error) {
|
||||
func (ng *Engine) NewRangeQuery(_ context.Context, q storage.Queryable, opts *QueryOpts, qs string, start, end time.Time, interval time.Duration) (Query, error) {
|
||||
expr, err := parser.ParseExpr(qs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -538,7 +546,10 @@ func (ng *Engine) newTestQuery(f func(context.Context) error) Query {
|
|||
// statements are not handled by the Engine.
|
||||
func (ng *Engine) exec(ctx context.Context, q *query) (v parser.Value, ws storage.Warnings, err error) {
|
||||
ng.metrics.currentQueries.Inc()
|
||||
defer ng.metrics.currentQueries.Dec()
|
||||
defer func() {
|
||||
ng.metrics.currentQueries.Dec()
|
||||
ng.metrics.querySamples.Add(float64(q.sampleStats.TotalSamples))
|
||||
}()
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, ng.timeout)
|
||||
q.cancel = cancel
|
||||
|
@ -746,8 +757,7 @@ func subqueryTimes(path []parser.Node) (time.Duration, time.Duration, *int64) {
|
|||
ts int64 = math.MaxInt64
|
||||
)
|
||||
for _, node := range path {
|
||||
switch n := node.(type) {
|
||||
case *parser.SubqueryExpr:
|
||||
if n, ok := node.(*parser.SubqueryExpr); ok {
|
||||
subqOffset += n.OriginalOffset
|
||||
subqRange += n.Range
|
||||
if n.Timestamp != nil {
|
||||
|
@ -783,7 +793,6 @@ func (ng *Engine) findMinMaxTime(s *parser.EvalStmt) (int64, int64) {
|
|||
maxTimestamp = end
|
||||
}
|
||||
evalRange = 0
|
||||
|
||||
case *parser.MatrixSelector:
|
||||
evalRange = n.Range
|
||||
}
|
||||
|
@ -816,20 +825,20 @@ func (ng *Engine) getTimeRangesForSelector(s *parser.EvalStmt, n *parser.VectorS
|
|||
} else {
|
||||
offsetMilliseconds := durationMilliseconds(subqOffset)
|
||||
start = start - offsetMilliseconds - durationMilliseconds(subqRange)
|
||||
end = end - offsetMilliseconds
|
||||
end -= offsetMilliseconds
|
||||
}
|
||||
|
||||
if evalRange == 0 {
|
||||
start = start - durationMilliseconds(s.LookbackDelta)
|
||||
start -= durationMilliseconds(s.LookbackDelta)
|
||||
} else {
|
||||
// For all matrix queries we want to ensure that we have (end-start) + range selected
|
||||
// this way we have `range` data before the start time
|
||||
start = start - durationMilliseconds(evalRange)
|
||||
start -= durationMilliseconds(evalRange)
|
||||
}
|
||||
|
||||
offsetMilliseconds := durationMilliseconds(n.OriginalOffset)
|
||||
start = start - offsetMilliseconds
|
||||
end = end - offsetMilliseconds
|
||||
start -= offsetMilliseconds
|
||||
end -= offsetMilliseconds
|
||||
|
||||
return start, end
|
||||
}
|
||||
|
@ -837,8 +846,7 @@ func (ng *Engine) getTimeRangesForSelector(s *parser.EvalStmt, n *parser.VectorS
|
|||
func (ng *Engine) getLastSubqueryInterval(path []parser.Node) time.Duration {
|
||||
var interval time.Duration
|
||||
for _, node := range path {
|
||||
switch n := node.(type) {
|
||||
case *parser.SubqueryExpr:
|
||||
if n, ok := node.(*parser.SubqueryExpr); ok {
|
||||
interval = n.Step
|
||||
if n.Step == 0 {
|
||||
interval = time.Duration(ng.noStepSubqueryIntervalFn(durationMilliseconds(n.Range))) * time.Millisecond
|
||||
|
@ -904,8 +912,7 @@ func extractGroupsFromPath(p []parser.Node) (bool, []string) {
|
|||
if len(p) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
switch n := p[len(p)-1].(type) {
|
||||
case *parser.AggregateExpr:
|
||||
if n, ok := p[len(p)-1].(*parser.AggregateExpr); ok {
|
||||
return !n.Without, n.Grouping
|
||||
}
|
||||
return false, nil
|
||||
|
@ -1745,7 +1752,7 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, storage.Warnings) {
|
|||
res, ws := newEv.eval(e.Expr)
|
||||
ev.currentSamples = newEv.currentSamples
|
||||
ev.samplesStats.UpdatePeakFromSubquery(newEv.samplesStats)
|
||||
for ts, step := ev.startTimestamp, -1; ts <= ev.endTimestamp; ts = ts + ev.interval {
|
||||
for ts, step := ev.startTimestamp, -1; ts <= ev.endTimestamp; ts += ev.interval {
|
||||
step++
|
||||
ev.samplesStats.IncrementSamplesAtStep(step, newEv.samplesStats.TotalSamples)
|
||||
}
|
||||
|
@ -1767,7 +1774,7 @@ func (ev *evaluator) eval(expr parser.Expr) (parser.Value, storage.Warnings) {
|
|||
if len(mat[i].Floats)+len(mat[i].Histograms) != 1 {
|
||||
panic(fmt.Errorf("unexpected number of samples"))
|
||||
}
|
||||
for ts := ev.startTimestamp + ev.interval; ts <= ev.endTimestamp; ts = ts + ev.interval {
|
||||
for ts := ev.startTimestamp + ev.interval; ts <= ev.endTimestamp; ts += ev.interval {
|
||||
if len(mat[i].Floats) > 0 {
|
||||
mat[i].Floats = append(mat[i].Floats, FPoint{
|
||||
T: ts,
|
||||
|
@ -1957,7 +1964,7 @@ func (ev *evaluator) matrixIterSlice(
|
|||
// (b) the number of samples is relatively small.
|
||||
// so a linear search will be as fast as a binary search.
|
||||
var drop int
|
||||
for drop = 0; floats[drop].T < mint; drop++ {
|
||||
for drop = 0; floats[drop].T < mint; drop++ { // nolint:revive
|
||||
}
|
||||
ev.currentSamples -= drop
|
||||
copy(floats, floats[drop:])
|
||||
|
@ -1979,7 +1986,7 @@ func (ev *evaluator) matrixIterSlice(
|
|||
// (b) the number of samples is relatively small.
|
||||
// so a linear search will be as fast as a binary search.
|
||||
var drop int
|
||||
for drop = 0; histograms[drop].T < mint; drop++ {
|
||||
for drop = 0; histograms[drop].T < mint; drop++ { // nolint:revive
|
||||
}
|
||||
ev.currentSamples -= drop
|
||||
copy(histograms, histograms[drop:])
|
||||
|
@ -2096,13 +2103,13 @@ func (ev *evaluator) VectorAnd(lhs, rhs Vector, matching *parser.VectorMatching,
|
|||
}
|
||||
|
||||
func (ev *evaluator) VectorOr(lhs, rhs Vector, matching *parser.VectorMatching, lhsh, rhsh []EvalSeriesHelper, enh *EvalNodeHelper) Vector {
|
||||
if matching.Card != parser.CardManyToMany {
|
||||
switch {
|
||||
case matching.Card != parser.CardManyToMany:
|
||||
panic("set operations must only use many-to-many matching")
|
||||
}
|
||||
if len(lhs) == 0 { // Short-circuit.
|
||||
case len(lhs) == 0: // Short-circuit.
|
||||
enh.Out = append(enh.Out, rhs...)
|
||||
return enh.Out
|
||||
} else if len(rhs) == 0 {
|
||||
case len(rhs) == 0:
|
||||
enh.Out = append(enh.Out, lhs...)
|
||||
return enh.Out
|
||||
}
|
||||
|
@ -2221,13 +2228,14 @@ func (ev *evaluator) VectorBinop(op parser.ItemType, lhs, rhs Vector, matching *
|
|||
hl, hr = hr, hl
|
||||
}
|
||||
floatValue, histogramValue, keep := vectorElemBinop(op, fl, fr, hl, hr)
|
||||
if returnBool {
|
||||
switch {
|
||||
case returnBool:
|
||||
if keep {
|
||||
floatValue = 1.0
|
||||
} else {
|
||||
floatValue = 0.0
|
||||
}
|
||||
} else if !keep {
|
||||
case !keep:
|
||||
continue
|
||||
}
|
||||
metric := resultMetric(ls.Metric, rs.Metric, op, matching, enh)
|
||||
|
@ -2514,14 +2522,15 @@ func (ev *evaluator) aggregation(op parser.ItemType, grouping []string, without
|
|||
if !ok {
|
||||
var m labels.Labels
|
||||
enh.resetBuilder(metric)
|
||||
if without {
|
||||
switch {
|
||||
case without:
|
||||
enh.lb.Del(grouping...)
|
||||
enh.lb.Del(labels.MetricName)
|
||||
m = enh.lb.Labels()
|
||||
} else if len(grouping) > 0 {
|
||||
case len(grouping) > 0:
|
||||
enh.lb.Keep(grouping...)
|
||||
m = enh.lb.Labels()
|
||||
} else {
|
||||
default:
|
||||
m = labels.EmptyLabels()
|
||||
}
|
||||
newAgg := &groupedAggregation{
|
||||
|
@ -2530,9 +2539,10 @@ func (ev *evaluator) aggregation(op parser.ItemType, grouping []string, without
|
|||
mean: s.F,
|
||||
groupCount: 1,
|
||||
}
|
||||
if s.H == nil {
|
||||
switch {
|
||||
case s.H == nil:
|
||||
newAgg.hasFloat = true
|
||||
} else if op == parser.SUM {
|
||||
case op == parser.SUM:
|
||||
newAgg.histogramValue = s.H.Copy()
|
||||
newAgg.hasHistogram = true
|
||||
}
|
||||
|
@ -2542,9 +2552,10 @@ func (ev *evaluator) aggregation(op parser.ItemType, grouping []string, without
|
|||
|
||||
inputVecLen := int64(len(vec))
|
||||
resultSize := k
|
||||
if k > inputVecLen {
|
||||
switch {
|
||||
case k > inputVecLen:
|
||||
resultSize = inputVecLen
|
||||
} else if k == 0 {
|
||||
case k == 0:
|
||||
resultSize = 1
|
||||
}
|
||||
switch op {
|
||||
|
@ -2637,12 +2648,13 @@ func (ev *evaluator) aggregation(op parser.ItemType, grouping []string, without
|
|||
|
||||
case parser.TOPK:
|
||||
// We build a heap of up to k elements, with the smallest element at heap[0].
|
||||
if int64(len(group.heap)) < k {
|
||||
switch {
|
||||
case int64(len(group.heap)) < k:
|
||||
heap.Push(&group.heap, &Sample{
|
||||
F: s.F,
|
||||
Metric: s.Metric,
|
||||
})
|
||||
} else if group.heap[0].F < s.F || (math.IsNaN(group.heap[0].F) && !math.IsNaN(s.F)) {
|
||||
case group.heap[0].F < s.F || (math.IsNaN(group.heap[0].F) && !math.IsNaN(s.F)):
|
||||
// This new element is bigger than the previous smallest element - overwrite that.
|
||||
group.heap[0] = Sample{
|
||||
F: s.F,
|
||||
|
@ -2655,12 +2667,13 @@ func (ev *evaluator) aggregation(op parser.ItemType, grouping []string, without
|
|||
|
||||
case parser.BOTTOMK:
|
||||
// We build a heap of up to k elements, with the biggest element at heap[0].
|
||||
if int64(len(group.reverseHeap)) < k {
|
||||
switch {
|
||||
case int64(len(group.reverseHeap)) < k:
|
||||
heap.Push(&group.reverseHeap, &Sample{
|
||||
F: s.F,
|
||||
Metric: s.Metric,
|
||||
})
|
||||
} else if group.reverseHeap[0].F > s.F || (math.IsNaN(group.reverseHeap[0].F) && !math.IsNaN(s.F)) {
|
||||
case group.reverseHeap[0].F > s.F || (math.IsNaN(group.reverseHeap[0].F) && !math.IsNaN(s.F)):
|
||||
// This new element is smaller than the previous biggest element - overwrite that.
|
||||
group.reverseHeap[0] = Sample{
|
||||
F: s.F,
|
||||
|
@ -2689,7 +2702,7 @@ func (ev *evaluator) aggregation(op parser.ItemType, grouping []string, without
|
|||
aggr.floatValue = float64(aggr.groupCount)
|
||||
|
||||
case parser.STDVAR:
|
||||
aggr.floatValue = aggr.floatValue / float64(aggr.groupCount)
|
||||
aggr.floatValue /= float64(aggr.groupCount)
|
||||
|
||||
case parser.STDDEV:
|
||||
aggr.floatValue = math.Sqrt(aggr.floatValue / float64(aggr.groupCount))
|
||||
|
@ -2819,9 +2832,10 @@ func PreprocessExpr(expr parser.Expr, start, end time.Time) parser.Expr {
|
|||
func preprocessExprHelper(expr parser.Expr, start, end time.Time) bool {
|
||||
switch n := expr.(type) {
|
||||
case *parser.VectorSelector:
|
||||
if n.StartOrEnd == parser.START {
|
||||
switch n.StartOrEnd {
|
||||
case parser.START:
|
||||
n.Timestamp = makeInt64Pointer(timestamp.FromTime(start))
|
||||
} else if n.StartOrEnd == parser.END {
|
||||
case parser.END:
|
||||
n.Timestamp = makeInt64Pointer(timestamp.FromTime(end))
|
||||
}
|
||||
return n.Timestamp != nil
|
||||
|
@ -2878,9 +2892,10 @@ func preprocessExprHelper(expr parser.Expr, start, end time.Time) bool {
|
|||
if isInvariant {
|
||||
n.Expr = newStepInvariantExpr(n.Expr)
|
||||
}
|
||||
if n.StartOrEnd == parser.START {
|
||||
switch n.StartOrEnd {
|
||||
case parser.START:
|
||||
n.Timestamp = makeInt64Pointer(timestamp.FromTime(start))
|
||||
} else if n.StartOrEnd == parser.END {
|
||||
case parser.END:
|
||||
n.Timestamp = makeInt64Pointer(timestamp.FromTime(end))
|
||||
}
|
||||
return n.Timestamp != nil
|
||||
|
|
|
@ -3289,7 +3289,7 @@ func TestNativeHistogram_HistogramCountAndSum(t *testing.T) {
|
|||
require.Len(t, vector, 1)
|
||||
require.Nil(t, vector[0].H)
|
||||
if floatHisto {
|
||||
require.Equal(t, float64(h.ToFloat().Count), vector[0].F)
|
||||
require.Equal(t, h.ToFloat().Count, vector[0].F)
|
||||
} else {
|
||||
require.Equal(t, float64(h.Count), vector[0].F)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint:revive // Many unsued function arguments in this file by design.
|
||||
package promql
|
||||
|
||||
import (
|
||||
|
@ -803,12 +804,14 @@ func funcPi(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) V
|
|||
// === sgn(Vector parser.ValueTypeVector) Vector ===
|
||||
func funcSgn(vals []parser.Value, args parser.Expressions, enh *EvalNodeHelper) Vector {
|
||||
return simpleFunc(vals, enh, func(v float64) float64 {
|
||||
if v < 0 {
|
||||
switch {
|
||||
case v < 0:
|
||||
return -1
|
||||
} else if v > 0 {
|
||||
case v > 0:
|
||||
return 1
|
||||
default:
|
||||
return v
|
||||
}
|
||||
return v
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -877,10 +880,10 @@ func linearRegression(samples []FPoint, interceptTime int64) (slope, intercept f
|
|||
}
|
||||
return 0, initY
|
||||
}
|
||||
sumX = sumX + cX
|
||||
sumY = sumY + cY
|
||||
sumXY = sumXY + cXY
|
||||
sumX2 = sumX2 + cX2
|
||||
sumX += cX
|
||||
sumY += cY
|
||||
sumXY += cXY
|
||||
sumX2 += cX2
|
||||
|
||||
covXY := sumXY - sumX*sumY/n
|
||||
varX := sumX2 - sumX*sumX/n
|
||||
|
|
|
@ -51,7 +51,7 @@ func TestDeriv(t *testing.T) {
|
|||
// https://github.com/prometheus/prometheus/issues/7180
|
||||
for i = 0; i < 15; i++ {
|
||||
jitter := 12 * i % 2
|
||||
a.Append(0, metric, int64(start+interval*i+jitter), 1)
|
||||
a.Append(0, metric, start+interval*i+jitter, 1)
|
||||
}
|
||||
|
||||
require.NoError(t, a.Commit())
|
||||
|
|
|
@ -349,7 +349,7 @@ func (f inspector) Visit(node Node, path []Node) (Visitor, error) {
|
|||
// for all the non-nil children of node, recursively.
|
||||
func Inspect(node Node, f inspector) {
|
||||
//nolint: errcheck
|
||||
Walk(inspector(f), node, nil)
|
||||
Walk(f, node, nil)
|
||||
}
|
||||
|
||||
// Children returns a list of all child nodes of a syntax tree node.
|
||||
|
@ -368,13 +368,14 @@ func Children(node Node) []Node {
|
|||
case *AggregateExpr:
|
||||
// While this does not look nice, it should avoid unnecessary allocations
|
||||
// caused by slice resizing
|
||||
if n.Expr == nil && n.Param == nil {
|
||||
switch {
|
||||
case n.Expr == nil && n.Param == nil:
|
||||
return nil
|
||||
} else if n.Expr == nil {
|
||||
case n.Expr == nil:
|
||||
return []Node{n.Param}
|
||||
} else if n.Param == nil {
|
||||
case n.Param == nil:
|
||||
return []Node{n.Expr}
|
||||
} else {
|
||||
default:
|
||||
return []Node{n.Expr, n.Param}
|
||||
}
|
||||
case *BinaryExpr:
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// nolint:revive // Many legitimately empty blocks in this file.
|
||||
package parser
|
||||
|
||||
import (
|
||||
|
@ -293,7 +294,7 @@ func (l *Lexer) accept(valid string) bool {
|
|||
// acceptRun consumes a run of runes from the valid set.
|
||||
func (l *Lexer) acceptRun(valid string) {
|
||||
for strings.ContainsRune(valid, l.next()) {
|
||||
// consume
|
||||
// Consume.
|
||||
}
|
||||
l.backup()
|
||||
}
|
||||
|
@ -346,9 +347,10 @@ func lexStatements(l *Lexer) stateFn {
|
|||
|
||||
switch r := l.next(); {
|
||||
case r == eof:
|
||||
if l.parenDepth != 0 {
|
||||
switch {
|
||||
case l.parenDepth != 0:
|
||||
return l.errorf("unclosed left parenthesis")
|
||||
} else if l.bracketOpen {
|
||||
case l.bracketOpen:
|
||||
return l.errorf("unclosed left bracket")
|
||||
}
|
||||
l.emit(EOF)
|
||||
|
@ -370,12 +372,13 @@ func lexStatements(l *Lexer) stateFn {
|
|||
case r == '^':
|
||||
l.emit(POW)
|
||||
case r == '=':
|
||||
if t := l.peek(); t == '=' {
|
||||
switch t := l.peek(); t {
|
||||
case '=':
|
||||
l.next()
|
||||
l.emit(EQLC)
|
||||
} else if t == '~' {
|
||||
case '~':
|
||||
return l.errorf("unexpected character after '=': %q", t)
|
||||
} else {
|
||||
default:
|
||||
l.emit(EQL)
|
||||
}
|
||||
case r == '!':
|
||||
|
@ -790,11 +793,12 @@ Loop:
|
|||
default:
|
||||
l.backup()
|
||||
word := l.input[l.start:l.pos]
|
||||
if kw, ok := key[strings.ToLower(word)]; ok {
|
||||
switch kw, ok := key[strings.ToLower(word)]; {
|
||||
case ok:
|
||||
l.emit(kw)
|
||||
} else if !strings.Contains(word, ":") {
|
||||
case !strings.Contains(word, ":"):
|
||||
l.emit(IDENTIFIER)
|
||||
} else {
|
||||
default:
|
||||
l.emit(METRIC_IDENTIFIER)
|
||||
}
|
||||
break Loop
|
||||
|
|
|
@ -270,14 +270,15 @@ var errUnexpected = errors.New("unexpected error")
|
|||
// recover is the handler that turns panics into returns from the top level of Parse.
|
||||
func (p *parser) recover(errp *error) {
|
||||
e := recover()
|
||||
if _, ok := e.(runtime.Error); ok {
|
||||
switch _, ok := e.(runtime.Error); {
|
||||
case ok:
|
||||
// Print the stack trace but do not inhibit the running application.
|
||||
buf := make([]byte, 64<<10)
|
||||
buf = buf[:runtime.Stack(buf, false)]
|
||||
|
||||
fmt.Fprintf(os.Stderr, "parser panic: %v\n%s", e, buf)
|
||||
*errp = errUnexpected
|
||||
} else if e != nil {
|
||||
case e != nil:
|
||||
*errp = e.(error)
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +333,7 @@ func (p *parser) Lex(lval *yySymType) int {
|
|||
// It is a no-op since the parsers error routines are triggered
|
||||
// by mechanisms that allow more fine-grained control
|
||||
// For more information, see https://pkg.go.dev/golang.org/x/tools/cmd/goyacc.
|
||||
func (p *parser) Error(e string) {
|
||||
func (p *parser) Error(string) {
|
||||
}
|
||||
|
||||
// InjectItem allows injecting a single Item at the beginning of the token stream
|
||||
|
@ -481,9 +482,9 @@ func (p *parser) checkAST(node Node) (typ ValueType) {
|
|||
// This is made a function instead of a variable, so it is lazily evaluated on demand.
|
||||
opRange := func() (r PositionRange) {
|
||||
// Remove whitespace at the beginning and end of the range.
|
||||
for r.Start = n.LHS.PositionRange().End; isSpace(rune(p.lex.input[r.Start])); r.Start++ {
|
||||
for r.Start = n.LHS.PositionRange().End; isSpace(rune(p.lex.input[r.Start])); r.Start++ { // nolint:revive
|
||||
}
|
||||
for r.End = n.RHS.PositionRange().Start - 1; isSpace(rune(p.lex.input[r.End])); r.End-- {
|
||||
for r.End = n.RHS.PositionRange().Start - 1; isSpace(rune(p.lex.input[r.End])); r.End-- { // nolint:revive
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -518,20 +519,18 @@ func (p *parser) checkAST(node Node) (typ ValueType) {
|
|||
p.addParseErrf(n.RHS.PositionRange(), "binary expression must contain only scalar and instant vector types")
|
||||
}
|
||||
|
||||
if (lt != ValueTypeVector || rt != ValueTypeVector) && n.VectorMatching != nil {
|
||||
switch {
|
||||
case (lt != ValueTypeVector || rt != ValueTypeVector) && n.VectorMatching != nil:
|
||||
if len(n.VectorMatching.MatchingLabels) > 0 {
|
||||
p.addParseErrf(n.PositionRange(), "vector matching only allowed between instant vectors")
|
||||
}
|
||||
n.VectorMatching = nil
|
||||
} else {
|
||||
// Both operands are Vectors.
|
||||
if n.Op.IsSetOperator() {
|
||||
if n.VectorMatching.Card == CardOneToMany || n.VectorMatching.Card == CardManyToOne {
|
||||
p.addParseErrf(n.PositionRange(), "no grouping allowed for %q operation", n.Op)
|
||||
}
|
||||
if n.VectorMatching.Card != CardManyToMany {
|
||||
p.addParseErrf(n.PositionRange(), "set operations must always be many-to-many")
|
||||
}
|
||||
case n.Op.IsSetOperator(): // Both operands are Vectors.
|
||||
if n.VectorMatching.Card == CardOneToMany || n.VectorMatching.Card == CardManyToOne {
|
||||
p.addParseErrf(n.PositionRange(), "no grouping allowed for %q operation", n.Op)
|
||||
}
|
||||
if n.VectorMatching.Card != CardManyToMany {
|
||||
p.addParseErrf(n.PositionRange(), "set operations must always be many-to-many")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,9 +707,10 @@ func (p *parser) addOffset(e Node, offset time.Duration) {
|
|||
}
|
||||
|
||||
// it is already ensured by parseDuration func that there never will be a zero offset modifier
|
||||
if *orgoffsetp != 0 {
|
||||
switch {
|
||||
case *orgoffsetp != 0:
|
||||
p.addParseErrf(e.PositionRange(), "offset may not be set multiple times")
|
||||
} else if orgoffsetp != nil {
|
||||
case orgoffsetp != nil:
|
||||
*orgoffsetp = offset
|
||||
}
|
||||
|
||||
|
|
|
@ -3617,7 +3617,7 @@ func TestNaNExpression(t *testing.T) {
|
|||
|
||||
nl, ok := expr.(*NumberLiteral)
|
||||
require.True(t, ok, "expected number literal but got %T", expr)
|
||||
require.True(t, math.IsNaN(float64(nl.Val)), "expected 'NaN' in number literal but got %v", nl.Val)
|
||||
require.True(t, math.IsNaN(nl.Val), "expected 'NaN' in number literal but got %v", nl.Val)
|
||||
}
|
||||
|
||||
var testSeries = []struct {
|
||||
|
|
|
@ -124,17 +124,19 @@ func (node *MatrixSelector) String() string {
|
|||
// Copy the Vector selector before changing the offset
|
||||
vecSelector := *node.VectorSelector.(*VectorSelector)
|
||||
offset := ""
|
||||
if vecSelector.OriginalOffset > time.Duration(0) {
|
||||
switch {
|
||||
case vecSelector.OriginalOffset > time.Duration(0):
|
||||
offset = fmt.Sprintf(" offset %s", model.Duration(vecSelector.OriginalOffset))
|
||||
} else if vecSelector.OriginalOffset < time.Duration(0) {
|
||||
case vecSelector.OriginalOffset < time.Duration(0):
|
||||
offset = fmt.Sprintf(" offset -%s", model.Duration(-vecSelector.OriginalOffset))
|
||||
}
|
||||
at := ""
|
||||
if vecSelector.Timestamp != nil {
|
||||
switch {
|
||||
case vecSelector.Timestamp != nil:
|
||||
at = fmt.Sprintf(" @ %.3f", float64(*vecSelector.Timestamp)/1000.0)
|
||||
} else if vecSelector.StartOrEnd == START {
|
||||
case vecSelector.StartOrEnd == START:
|
||||
at = " @ start()"
|
||||
} else if vecSelector.StartOrEnd == END {
|
||||
case vecSelector.StartOrEnd == END:
|
||||
at = " @ end()"
|
||||
}
|
||||
|
||||
|
@ -162,17 +164,19 @@ func (node *SubqueryExpr) getSubqueryTimeSuffix() string {
|
|||
step = model.Duration(node.Step).String()
|
||||
}
|
||||
offset := ""
|
||||
if node.OriginalOffset > time.Duration(0) {
|
||||
switch {
|
||||
case node.OriginalOffset > time.Duration(0):
|
||||
offset = fmt.Sprintf(" offset %s", model.Duration(node.OriginalOffset))
|
||||
} else if node.OriginalOffset < time.Duration(0) {
|
||||
case node.OriginalOffset < time.Duration(0):
|
||||
offset = fmt.Sprintf(" offset -%s", model.Duration(-node.OriginalOffset))
|
||||
}
|
||||
at := ""
|
||||
if node.Timestamp != nil {
|
||||
switch {
|
||||
case node.Timestamp != nil:
|
||||
at = fmt.Sprintf(" @ %.3f", float64(*node.Timestamp)/1000.0)
|
||||
} else if node.StartOrEnd == START {
|
||||
case node.StartOrEnd == START:
|
||||
at = " @ start()"
|
||||
} else if node.StartOrEnd == END {
|
||||
case node.StartOrEnd == END:
|
||||
at = " @ end()"
|
||||
}
|
||||
return fmt.Sprintf("[%s:%s]%s%s", model.Duration(node.Range), step, at, offset)
|
||||
|
@ -207,17 +211,19 @@ func (node *VectorSelector) String() string {
|
|||
labelStrings = append(labelStrings, matcher.String())
|
||||
}
|
||||
offset := ""
|
||||
if node.OriginalOffset > time.Duration(0) {
|
||||
switch {
|
||||
case node.OriginalOffset > time.Duration(0):
|
||||
offset = fmt.Sprintf(" offset %s", model.Duration(node.OriginalOffset))
|
||||
} else if node.OriginalOffset < time.Duration(0) {
|
||||
case node.OriginalOffset < time.Duration(0):
|
||||
offset = fmt.Sprintf(" offset -%s", model.Duration(-node.OriginalOffset))
|
||||
}
|
||||
at := ""
|
||||
if node.Timestamp != nil {
|
||||
switch {
|
||||
case node.Timestamp != nil:
|
||||
at = fmt.Sprintf(" @ %.3f", float64(*node.Timestamp)/1000.0)
|
||||
} else if node.StartOrEnd == START {
|
||||
case node.StartOrEnd == START:
|
||||
at = " @ start()"
|
||||
} else if node.StartOrEnd == END {
|
||||
case node.StartOrEnd == END:
|
||||
at = " @ end()"
|
||||
}
|
||||
|
||||
|
|
|
@ -169,11 +169,12 @@ func histogramQuantile(q float64, h *histogram.FloatHistogram) float64 {
|
|||
}
|
||||
}
|
||||
if bucket.Lower < 0 && bucket.Upper > 0 {
|
||||
if len(h.NegativeBuckets) == 0 && len(h.PositiveBuckets) > 0 {
|
||||
switch {
|
||||
case len(h.NegativeBuckets) == 0 && len(h.PositiveBuckets) > 0:
|
||||
// The result is in the zero bucket and the histogram has only
|
||||
// positive buckets. So we consider 0 to be the lower bound.
|
||||
bucket.Lower = 0
|
||||
} else if len(h.PositiveBuckets) == 0 && len(h.NegativeBuckets) > 0 {
|
||||
case len(h.PositiveBuckets) == 0 && len(h.NegativeBuckets) > 0:
|
||||
// The result is in the zero bucket and the histogram has only
|
||||
// negative buckets. So we consider 0 to be the upper bound.
|
||||
bucket.Upper = 0
|
||||
|
@ -244,12 +245,13 @@ func histogramFraction(lower, upper float64, h *histogram.FloatHistogram) float6
|
|||
for it.Next() {
|
||||
b := it.At()
|
||||
if b.Lower < 0 && b.Upper > 0 {
|
||||
if len(h.NegativeBuckets) == 0 && len(h.PositiveBuckets) > 0 {
|
||||
switch {
|
||||
case len(h.NegativeBuckets) == 0 && len(h.PositiveBuckets) > 0:
|
||||
// This is the zero bucket and the histogram has only
|
||||
// positive buckets. So we consider 0 to be the lower
|
||||
// bound.
|
||||
b.Lower = 0
|
||||
} else if len(h.PositiveBuckets) == 0 && len(h.NegativeBuckets) > 0 {
|
||||
case len(h.PositiveBuckets) == 0 && len(h.NegativeBuckets) > 0:
|
||||
// This is in the zero bucket and the histogram has only
|
||||
// negative buckets. So we consider 0 to be the upper
|
||||
// bound.
|
||||
|
|
|
@ -588,10 +588,10 @@ func TestAlertingRuleLimit(t *testing.T) {
|
|||
evalTime := time.Unix(0, 0)
|
||||
|
||||
for _, test := range tests {
|
||||
_, err := rule.Eval(suite.Context(), 0, evalTime, EngineQueryFunc(suite.QueryEngine(), suite.Storage()), nil, test.limit)
|
||||
if err != nil {
|
||||
switch _, err := rule.Eval(suite.Context(), 0, evalTime, EngineQueryFunc(suite.QueryEngine(), suite.Storage()), nil, test.limit); {
|
||||
case err != nil:
|
||||
require.EqualError(t, err, test.err)
|
||||
} else if test.err != "" {
|
||||
case test.err != "":
|
||||
t.Errorf("Expected errror %s, got none", test.err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -895,12 +895,13 @@ func (g *Group) RestoreForState(ts time.Time) {
|
|||
timeSpentPending := downAt.Sub(restoredActiveAt)
|
||||
timeRemainingPending := alertHoldDuration - timeSpentPending
|
||||
|
||||
if timeRemainingPending <= 0 {
|
||||
switch {
|
||||
case timeRemainingPending <= 0:
|
||||
// It means that alert was firing when prometheus went down.
|
||||
// In the next Eval, the state of this alert will be set back to
|
||||
// firing again if it's still firing in that Eval.
|
||||
// Nothing to be done in this case.
|
||||
} else if timeRemainingPending < g.opts.ForGracePeriod {
|
||||
case timeRemainingPending < g.opts.ForGracePeriod:
|
||||
// (new) restoredActiveAt = (ts + m.opts.ForGracePeriod) - alertHoldDuration
|
||||
// /* new firing time */ /* moving back by hold duration */
|
||||
//
|
||||
|
@ -913,7 +914,7 @@ func (g *Group) RestoreForState(ts time.Time) {
|
|||
// = (ts + m.opts.ForGracePeriod) - ts
|
||||
// = m.opts.ForGracePeriod
|
||||
restoredActiveAt = ts.Add(g.opts.ForGracePeriod).Add(-alertHoldDuration)
|
||||
} else {
|
||||
default:
|
||||
// By shifting ActiveAt to the future (ActiveAt + some_duration),
|
||||
// the total pending time from the original ActiveAt
|
||||
// would be `alertHoldDuration + some_duration`.
|
||||
|
|
|
@ -488,17 +488,18 @@ func TestForStateRestore(t *testing.T) {
|
|||
})
|
||||
|
||||
// Checking if we have restored it correctly.
|
||||
if tst.noRestore {
|
||||
switch {
|
||||
case tst.noRestore:
|
||||
require.Equal(t, tst.num, len(got))
|
||||
for _, e := range got {
|
||||
require.Equal(t, e.ActiveAt, restoreTime)
|
||||
}
|
||||
} else if tst.gracePeriod {
|
||||
case tst.gracePeriod:
|
||||
require.Equal(t, tst.num, len(got))
|
||||
for _, e := range got {
|
||||
require.Equal(t, opts.ForGracePeriod, e.ActiveAt.Add(alertForDuration).Sub(restoreTime))
|
||||
}
|
||||
} else {
|
||||
default:
|
||||
exp := tst.alerts
|
||||
require.Equal(t, len(exp), len(got))
|
||||
sortAlerts(exp)
|
||||
|
@ -794,13 +795,13 @@ func TestUpdate(t *testing.T) {
|
|||
rgs.Groups[i].Interval = model.Duration(10)
|
||||
}
|
||||
}
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, expected, ogs)
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, ogs)
|
||||
|
||||
// Update limit and reload.
|
||||
for i := range rgs.Groups {
|
||||
rgs.Groups[i].Limit = 1
|
||||
}
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, expected, ogs)
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, ogs)
|
||||
|
||||
// Change group rules and reload.
|
||||
for i, g := range rgs.Groups {
|
||||
|
@ -808,13 +809,13 @@ func TestUpdate(t *testing.T) {
|
|||
rgs.Groups[i].Rules[j].Expr.SetString(fmt.Sprintf("%s * 0", r.Expr.Value))
|
||||
}
|
||||
}
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, expected, ogs)
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, ogs)
|
||||
|
||||
// Change group source tenants and reload.
|
||||
for i := range rgs.Groups {
|
||||
rgs.Groups[i].SourceTenants = []string{"tenant-2"}
|
||||
}
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, expected, ogs)
|
||||
reloadAndValidate(rgs, t, tmpFile, ruleManager, ogs)
|
||||
}
|
||||
|
||||
func TestUpdate_AlwaysRestore(t *testing.T) {
|
||||
|
@ -1094,7 +1095,7 @@ func reloadRules(rgs *rulefmt.RuleGroups, t *testing.T, tmpFile *os.File, ruleMa
|
|||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func reloadAndValidate(rgs *rulefmt.RuleGroups, t *testing.T, tmpFile *os.File, ruleManager *Manager, expected map[string]labels.Labels, ogs map[string]*Group) {
|
||||
func reloadAndValidate(rgs *rulefmt.RuleGroups, t *testing.T, tmpFile *os.File, ruleManager *Manager, ogs map[string]*Group) {
|
||||
reloadRules(rgs, t, tmpFile, ruleManager, 0)
|
||||
for h, g := range ruleManager.groups {
|
||||
if ogs[h] == g {
|
||||
|
|
|
@ -30,19 +30,19 @@ type unknownRule struct{}
|
|||
|
||||
func (u unknownRule) Name() string { return "" }
|
||||
func (u unknownRule) Labels() labels.Labels { return labels.EmptyLabels() }
|
||||
func (u unknownRule) Eval(ctx context.Context, evalDelay time.Duration, time time.Time, queryFunc QueryFunc, url *url.URL, i int) (promql.Vector, error) {
|
||||
func (u unknownRule) Eval(context.Context, time.Duration, time.Time, QueryFunc, *url.URL, int) (promql.Vector, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (u unknownRule) String() string { return "" }
|
||||
func (u unknownRule) Query() parser.Expr { return nil }
|
||||
func (u unknownRule) SetLastError(err error) {}
|
||||
func (u unknownRule) LastError() error { return nil }
|
||||
func (u unknownRule) SetHealth(health RuleHealth) {}
|
||||
func (u unknownRule) Health() RuleHealth { return "" }
|
||||
func (u unknownRule) SetEvaluationDuration(duration time.Duration) {}
|
||||
func (u unknownRule) GetEvaluationDuration() time.Duration { return 0 }
|
||||
func (u unknownRule) SetEvaluationTimestamp(time time.Time) {}
|
||||
func (u unknownRule) GetEvaluationTimestamp() time.Time { return time.Time{} }
|
||||
func (u unknownRule) String() string { return "" }
|
||||
func (u unknownRule) Query() parser.Expr { return nil }
|
||||
func (u unknownRule) SetLastError(error) {}
|
||||
func (u unknownRule) LastError() error { return nil }
|
||||
func (u unknownRule) SetHealth(RuleHealth) {}
|
||||
func (u unknownRule) Health() RuleHealth { return "" }
|
||||
func (u unknownRule) SetEvaluationDuration(time.Duration) {}
|
||||
func (u unknownRule) GetEvaluationDuration() time.Duration { return 0 }
|
||||
func (u unknownRule) SetEvaluationTimestamp(time.Time) {}
|
||||
func (u unknownRule) GetEvaluationTimestamp() time.Time { return time.Time{} }
|
||||
|
||||
func TestNewRuleDetailPanics(t *testing.T) {
|
||||
require.PanicsWithValue(t, `unknown rule type "rules.unknownRule"`, func() {
|
||||
|
|
|
@ -223,10 +223,10 @@ func TestRecordingRuleLimit(t *testing.T) {
|
|||
evalTime := time.Unix(0, 0)
|
||||
|
||||
for _, test := range tests {
|
||||
_, err := rule.Eval(suite.Context(), 0, evalTime, EngineQueryFunc(suite.QueryEngine(), suite.Storage()), nil, test.limit)
|
||||
if err != nil {
|
||||
switch _, err := rule.Eval(suite.Context(), 0, evalTime, EngineQueryFunc(suite.QueryEngine(), suite.Storage()), nil, test.limit); {
|
||||
case err != nil:
|
||||
require.EqualError(t, err, test.err)
|
||||
} else if test.err != "" {
|
||||
case test.err != "":
|
||||
t.Errorf("Expected error %s, got none", test.err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,10 +288,11 @@ func (m *Manager) ApplyConfig(cfg *config.Config) error {
|
|||
// Cleanup and reload pool if the configuration has changed.
|
||||
var failed bool
|
||||
for name, sp := range m.scrapePools {
|
||||
if cfg, ok := m.scrapeConfigs[name]; !ok {
|
||||
switch cfg, ok := m.scrapeConfigs[name]; {
|
||||
case !ok:
|
||||
sp.stop()
|
||||
delete(m.scrapePools, name)
|
||||
} else if !reflect.DeepEqual(sp.config, cfg) {
|
||||
case !reflect.DeepEqual(sp.config, cfg):
|
||||
err := sp.reload(cfg)
|
||||
if err != nil {
|
||||
level.Error(m.logger).Log("msg", "error reloading scrape pool", "err", err, "scrape_pool", name)
|
||||
|
|
|
@ -503,9 +503,10 @@ func (sp *scrapePool) Sync(tgs []*targetgroup.Group) {
|
|||
// Replicate .Labels().IsEmpty() with a loop here to avoid generating garbage.
|
||||
nonEmpty := false
|
||||
t.LabelsRange(func(l labels.Label) { nonEmpty = true })
|
||||
if nonEmpty {
|
||||
switch {
|
||||
case nonEmpty:
|
||||
all = append(all, t)
|
||||
} else if !t.discoveredLabels.IsEmpty() {
|
||||
case !t.discoveredLabels.IsEmpty():
|
||||
sp.droppedTargets = append(sp.droppedTargets, t)
|
||||
}
|
||||
}
|
||||
|
@ -640,7 +641,7 @@ func verifyLabelLimits(lset labels.Labels, limits *labelLimits) error {
|
|||
met := lset.Get(labels.MetricName)
|
||||
if limits.labelLimit > 0 {
|
||||
nbLabels := lset.Len()
|
||||
if nbLabels > int(limits.labelLimit) {
|
||||
if nbLabels > limits.labelLimit {
|
||||
return fmt.Errorf("label_limit exceeded (metric: %.50s, number of labels: %d, limit: %d)", met, nbLabels, limits.labelLimit)
|
||||
}
|
||||
}
|
||||
|
@ -652,14 +653,14 @@ func verifyLabelLimits(lset labels.Labels, limits *labelLimits) error {
|
|||
return lset.Validate(func(l labels.Label) error {
|
||||
if limits.labelNameLengthLimit > 0 {
|
||||
nameLength := len(l.Name)
|
||||
if nameLength > int(limits.labelNameLengthLimit) {
|
||||
if nameLength > limits.labelNameLengthLimit {
|
||||
return fmt.Errorf("label_name_length_limit exceeded (metric: %.50s, label name: %.50s, length: %d, limit: %d)", met, l.Name, nameLength, limits.labelNameLengthLimit)
|
||||
}
|
||||
}
|
||||
|
||||
if limits.labelValueLengthLimit > 0 {
|
||||
valueLength := len(l.Value)
|
||||
if valueLength > int(limits.labelValueLengthLimit) {
|
||||
if valueLength > limits.labelValueLengthLimit {
|
||||
return fmt.Errorf("label_value_length_limit exceeded (metric: %.50s, label name: %.50s, value: %.50q, length: %d, limit: %d)", met, l.Name, l.Value, valueLength, limits.labelValueLengthLimit)
|
||||
}
|
||||
}
|
||||
|
@ -946,9 +947,10 @@ func (c *scrapeCache) iterDone(flushCache bool) {
|
|||
count := len(c.series) + len(c.droppedSeries) + len(c.metadata)
|
||||
c.metaMtx.Unlock()
|
||||
|
||||
if flushCache {
|
||||
switch {
|
||||
case flushCache:
|
||||
c.successfulCount = count
|
||||
} else if count > c.successfulCount*2+1000 {
|
||||
case count > c.successfulCount*2+1000:
|
||||
// If a target had varying labels in scrapes that ultimately failed,
|
||||
// the caches would grow indefinitely. Force a flush when this happens.
|
||||
// We use the heuristic that this is a doubling of the cache size
|
||||
|
|
|
@ -322,7 +322,7 @@ func TestScrapePoolReloadPreserveRelabeledIntervalTimeout(t *testing.T) {
|
|||
ScrapeTimeout: model.Duration(2 * time.Second),
|
||||
}
|
||||
newLoop := func(opts scrapeLoopOptions) loop {
|
||||
l := &testLoop{interval: time.Duration(opts.interval), timeout: time.Duration(opts.timeout)}
|
||||
l := &testLoop{interval: opts.interval, timeout: opts.timeout}
|
||||
l.startFunc = func(interval, timeout time.Duration, errc chan<- error) {
|
||||
require.Equal(t, 5*time.Second, interval, "Unexpected scrape interval")
|
||||
require.Equal(t, 3*time.Second, timeout, "Unexpected scrape timeout")
|
||||
|
@ -546,7 +546,7 @@ func TestScrapePoolRaces(t *testing.T) {
|
|||
require.Equal(t, expectedDropped, len(dropped), "Invalid number of dropped targets")
|
||||
|
||||
for i := 0; i < 20; i++ {
|
||||
time.Sleep(time.Duration(10 * time.Millisecond))
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
sp.reload(newConfig())
|
||||
}
|
||||
sp.stop()
|
||||
|
@ -724,9 +724,10 @@ func TestScrapeLoopStop(t *testing.T) {
|
|||
// All samples in a scrape must have the same timestamp.
|
||||
var ts int64
|
||||
for i, s := range appender.result {
|
||||
if i%6 == 0 {
|
||||
switch {
|
||||
case i%6 == 0:
|
||||
ts = s.t
|
||||
} else if s.t != ts {
|
||||
case s.t != ts:
|
||||
t.Fatalf("Unexpected multiple timestamps within single scrape")
|
||||
}
|
||||
}
|
||||
|
@ -1139,10 +1140,11 @@ func TestScrapeLoopRunCreatesStaleMarkersOnFailedScrape(t *testing.T) {
|
|||
scraper.scrapeFunc = func(ctx context.Context, w io.Writer) error {
|
||||
numScrapes++
|
||||
|
||||
if numScrapes == 1 {
|
||||
switch numScrapes {
|
||||
case 1:
|
||||
w.Write([]byte("metric_a 42\n"))
|
||||
return nil
|
||||
} else if numScrapes == 5 {
|
||||
case 5:
|
||||
cancel()
|
||||
}
|
||||
return errors.New("scrape failed")
|
||||
|
@ -1199,14 +1201,14 @@ func TestScrapeLoopRunCreatesStaleMarkersOnParseFailure(t *testing.T) {
|
|||
// Succeed once, several failures, then stop.
|
||||
scraper.scrapeFunc = func(ctx context.Context, w io.Writer) error {
|
||||
numScrapes++
|
||||
|
||||
if numScrapes == 1 {
|
||||
switch numScrapes {
|
||||
case 1:
|
||||
w.Write([]byte("metric_a 42\n"))
|
||||
return nil
|
||||
} else if numScrapes == 2 {
|
||||
case 2:
|
||||
w.Write([]byte("7&-\n"))
|
||||
return nil
|
||||
} else if numScrapes == 3 {
|
||||
case 3:
|
||||
cancel()
|
||||
}
|
||||
return errors.New("scrape failed")
|
||||
|
@ -1265,14 +1267,15 @@ func TestScrapeLoopCache(t *testing.T) {
|
|||
numScrapes := 0
|
||||
|
||||
scraper.scrapeFunc = func(ctx context.Context, w io.Writer) error {
|
||||
if numScrapes == 1 || numScrapes == 2 {
|
||||
switch numScrapes {
|
||||
case 1, 2:
|
||||
if _, ok := sl.cache.series["metric_a"]; !ok {
|
||||
t.Errorf("metric_a missing from cache after scrape %d", numScrapes)
|
||||
}
|
||||
if _, ok := sl.cache.series["metric_b"]; !ok {
|
||||
t.Errorf("metric_b missing from cache after scrape %d", numScrapes)
|
||||
}
|
||||
} else if numScrapes == 3 {
|
||||
case 3:
|
||||
if _, ok := sl.cache.series["metric_a"]; !ok {
|
||||
t.Errorf("metric_a missing from cache after scrape %d", numScrapes)
|
||||
}
|
||||
|
@ -1282,14 +1285,14 @@ func TestScrapeLoopCache(t *testing.T) {
|
|||
}
|
||||
|
||||
numScrapes++
|
||||
|
||||
if numScrapes == 1 {
|
||||
switch numScrapes {
|
||||
case 1:
|
||||
w.Write([]byte("metric_a 42\nmetric_b 43\n"))
|
||||
return nil
|
||||
} else if numScrapes == 3 {
|
||||
case 3:
|
||||
w.Write([]byte("metric_a 44\n"))
|
||||
return nil
|
||||
} else if numScrapes == 4 {
|
||||
case 4:
|
||||
cancel()
|
||||
}
|
||||
return fmt.Errorf("scrape failed")
|
||||
|
@ -2280,11 +2283,12 @@ func TestTargetScrapeScrapeCancel(t *testing.T) {
|
|||
|
||||
go func() {
|
||||
_, err := ts.scrape(ctx, io.Discard)
|
||||
if err == nil {
|
||||
switch {
|
||||
case err == nil:
|
||||
errc <- errors.New("Expected error but got nil")
|
||||
} else if ctx.Err() != context.Canceled {
|
||||
case ctx.Err() != context.Canceled:
|
||||
errc <- errors.Errorf("Expected context cancellation error but got: %s", ctx.Err())
|
||||
} else {
|
||||
default:
|
||||
close(errc)
|
||||
}
|
||||
}()
|
||||
|
@ -2405,7 +2409,7 @@ type testScraper struct {
|
|||
scrapeFunc func(context.Context, io.Writer) error
|
||||
}
|
||||
|
||||
func (ts *testScraper) offset(interval time.Duration, jitterSeed uint64) time.Duration {
|
||||
func (ts *testScraper) offset(time.Duration, uint64) time.Duration {
|
||||
return ts.offsetDur
|
||||
}
|
||||
|
||||
|
@ -2867,7 +2871,7 @@ func TestScrapeAddFast(t *testing.T) {
|
|||
require.NoError(t, slApp.Commit())
|
||||
}
|
||||
|
||||
func TestReuseCacheRace(t *testing.T) {
|
||||
func TestReuseCacheRace(*testing.T) {
|
||||
var (
|
||||
app = &nopAppendable{}
|
||||
cfg = &config.ScrapeConfig{
|
||||
|
|
|
@ -413,9 +413,9 @@ func PopulateLabels(lb *labels.Builder, cfg *config.ScrapeConfig, noDefaultPort
|
|||
// Addresses reaching this point are already wrapped in [] if necessary.
|
||||
switch scheme {
|
||||
case "http", "":
|
||||
addr = addr + ":80"
|
||||
addr += ":80"
|
||||
case "https":
|
||||
addr = addr + ":443"
|
||||
addr += ":443"
|
||||
default:
|
||||
return labels.EmptyLabels(), labels.EmptyLabels(), errors.Errorf("invalid scheme: %q", cfg.Scheme)
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ func TestTargetURL(t *testing.T) {
|
|||
require.Equal(t, expectedURL, target.URL())
|
||||
}
|
||||
|
||||
func newTestTarget(targetURL string, deadline time.Duration, lbls labels.Labels) *Target {
|
||||
func newTestTarget(targetURL string, _ time.Duration, lbls labels.Labels) *Target {
|
||||
lb := labels.NewBuilder(lbls)
|
||||
lb.Set(model.SchemeLabel, "http")
|
||||
lb.Set(model.AddressLabel, strings.TrimPrefix(targetURL, "http://"))
|
||||
|
|
|
@ -332,9 +332,11 @@ func (it *sampleRingIterator) Next() chunkenc.ValueType {
|
|||
switch s.Type() {
|
||||
case chunkenc.ValHistogram:
|
||||
it.h = s.H()
|
||||
it.fh = nil
|
||||
return chunkenc.ValHistogram
|
||||
case chunkenc.ValFloatHistogram:
|
||||
it.fh = s.FH()
|
||||
it.h = nil
|
||||
return chunkenc.ValFloatHistogram
|
||||
default:
|
||||
it.f = s.F()
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
|
||||
"github.com/prometheus/prometheus/model/histogram"
|
||||
"github.com/prometheus/prometheus/tsdb/chunkenc"
|
||||
"github.com/prometheus/prometheus/tsdb/tsdbutil"
|
||||
)
|
||||
|
||||
func TestSampleRing(t *testing.T) {
|
||||
|
@ -180,6 +181,28 @@ func TestBufferedSeriesIteratorNoBadAt(t *testing.T) {
|
|||
it.Next()
|
||||
}
|
||||
|
||||
func TestBufferedSeriesIteratorMixedHistograms(t *testing.T) {
|
||||
histograms := tsdbutil.GenerateTestHistograms(2)
|
||||
|
||||
it := NewBufferIterator(NewListSeriesIterator(samples{
|
||||
fhSample{t: 1, fh: histograms[0].ToFloat()},
|
||||
hSample{t: 2, h: histograms[1]},
|
||||
}), 2)
|
||||
|
||||
require.Equal(t, chunkenc.ValNone, it.Seek(3))
|
||||
require.NoError(t, it.Err())
|
||||
|
||||
buf := it.Buffer()
|
||||
|
||||
require.Equal(t, chunkenc.ValFloatHistogram, buf.Next())
|
||||
_, fh := buf.AtFloatHistogram()
|
||||
require.Equal(t, histograms[0].ToFloat(), fh)
|
||||
|
||||
require.Equal(t, chunkenc.ValHistogram, buf.Next())
|
||||
_, fh = buf.AtFloatHistogram()
|
||||
require.Equal(t, histograms[1].ToFloat(), fh)
|
||||
}
|
||||
|
||||
func BenchmarkBufferedSeriesIterator(b *testing.B) {
|
||||
// Simulate a 5 minute rate.
|
||||
it := NewBufferIterator(newFakeSeriesIterator(int64(b.N), 30), 5*60)
|
||||
|
@ -188,8 +211,8 @@ func BenchmarkBufferedSeriesIterator(b *testing.B) {
|
|||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
for it.Next() != chunkenc.ValNone {
|
||||
// scan everything
|
||||
for it.Next() != chunkenc.ValNone { // nolint:revive
|
||||
// Scan everything.
|
||||
}
|
||||
require.NoError(b, it.Err())
|
||||
}
|
||||
|
|
|
@ -222,9 +222,10 @@ func (f *fanoutAppender) Rollback() (err error) {
|
|||
|
||||
for _, appender := range f.secondaries {
|
||||
rollbackErr := appender.Rollback()
|
||||
if err == nil {
|
||||
switch {
|
||||
case err == nil:
|
||||
err = rollbackErr
|
||||
} else if rollbackErr != nil {
|
||||
case rollbackErr != nil:
|
||||
level.Error(f.logger).Log("msg", "Squashed rollback error on rollback", "err", rollbackErr)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ func (errQuerier) Select(bool, *storage.SelectHints, ...*labels.Matcher) storage
|
|||
return storage.ErrSeriesSet(errSelect)
|
||||
}
|
||||
|
||||
func (errQuerier) LabelValues(name string, matchers ...*labels.Matcher) ([]string, storage.Warnings, error) {
|
||||
func (errQuerier) LabelValues(string, ...*labels.Matcher) ([]string, storage.Warnings, error) {
|
||||
return nil, nil, errors.New("label values error")
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ type MockQueryable struct {
|
|||
MockQuerier Querier
|
||||
}
|
||||
|
||||
func (q *MockQueryable) Querier(ctx context.Context, mint, maxt int64) (Querier, error) {
|
||||
func (q *MockQueryable) Querier(context.Context, int64, int64) (Querier, error) {
|
||||
return q.MockQuerier, nil
|
||||
}
|
||||
|
||||
|
@ -118,11 +118,11 @@ type MockQuerier struct {
|
|||
SelectMockFunction func(sortSeries bool, hints *SelectHints, matchers ...*labels.Matcher) SeriesSet
|
||||
}
|
||||
|
||||
func (q *MockQuerier) LabelValues(name string, matchers ...*labels.Matcher) ([]string, Warnings, error) {
|
||||
func (q *MockQuerier) LabelValues(string, ...*labels.Matcher) ([]string, Warnings, error) {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
func (q *MockQuerier) LabelNames(matchers ...*labels.Matcher) ([]string, Warnings, error) {
|
||||
func (q *MockQuerier) LabelNames(...*labels.Matcher) ([]string, Warnings, error) {
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,8 @@ func BenchmarkMemoizedSeriesIterator(b *testing.B) {
|
|||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
for it.Next() != chunkenc.ValNone {
|
||||
// scan everything
|
||||
for it.Next() != chunkenc.ValNone { // nolint:revive
|
||||
// Scan everything.
|
||||
}
|
||||
require.NoError(b, it.Err())
|
||||
}
|
||||
|
|
|
@ -197,13 +197,14 @@ func mergeStrings(a, b []string) []string {
|
|||
res := make([]string, 0, maxl*10/9)
|
||||
|
||||
for len(a) > 0 && len(b) > 0 {
|
||||
if a[0] == b[0] {
|
||||
switch {
|
||||
case a[0] == b[0]:
|
||||
res = append(res, a[0])
|
||||
a, b = a[1:], b[1:]
|
||||
} else if a[0] < b[0] {
|
||||
case a[0] < b[0]:
|
||||
res = append(res, a[0])
|
||||
a = a[1:]
|
||||
} else {
|
||||
default:
|
||||
res = append(res, b[0])
|
||||
b = b[1:]
|
||||
}
|
||||
|
@ -722,12 +723,11 @@ func (c *compactChunkIterator) Next() bool {
|
|||
break
|
||||
}
|
||||
|
||||
if next.MinTime == prev.MinTime &&
|
||||
next.MaxTime == prev.MaxTime &&
|
||||
bytes.Equal(next.Chunk.Bytes(), prev.Chunk.Bytes()) {
|
||||
// 1:1 duplicates, skip it.
|
||||
} else {
|
||||
// We operate on same series, so labels does not matter here.
|
||||
// Only do something if it is not a perfect duplicate.
|
||||
if next.MinTime != prev.MinTime ||
|
||||
next.MaxTime != prev.MaxTime ||
|
||||
!bytes.Equal(next.Chunk.Bytes(), prev.Chunk.Bytes()) {
|
||||
// We operate on same series, so labels do not matter here.
|
||||
overlapping = append(overlapping, newChunkToSeriesDecoder(labels.EmptyLabels(), next))
|
||||
if next.MaxTime > oMaxTime {
|
||||
oMaxTime = next.MaxTime
|
||||
|
|
|
@ -291,13 +291,14 @@ func MergeLabels(primary, secondary []prompb.Label) []prompb.Label {
|
|||
result := make([]prompb.Label, 0, len(primary)+len(secondary))
|
||||
i, j := 0, 0
|
||||
for i < len(primary) && j < len(secondary) {
|
||||
if primary[i].Name < secondary[j].Name {
|
||||
switch {
|
||||
case primary[i].Name < secondary[j].Name:
|
||||
result = append(result, primary[i])
|
||||
i++
|
||||
} else if primary[i].Name > secondary[j].Name {
|
||||
case primary[i].Name > secondary[j].Name:
|
||||
result = append(result, secondary[j])
|
||||
j++
|
||||
} else {
|
||||
default:
|
||||
result = append(result, primary[i])
|
||||
i++
|
||||
j++
|
||||
|
@ -428,8 +429,8 @@ func (c *concreteSeriesIterator) Seek(t int64) chunkenc.ValueType {
|
|||
c.histogramsCur += sort.Search(len(c.series.histograms)-c.histogramsCur, func(n int) bool {
|
||||
return c.series.histograms[n+c.histogramsCur].Timestamp >= t
|
||||
})
|
||||
|
||||
if c.floatsCur < len(c.series.floats) && c.histogramsCur < len(c.series.histograms) {
|
||||
switch {
|
||||
case c.floatsCur < len(c.series.floats) && c.histogramsCur < len(c.series.histograms):
|
||||
// If float samples and histogram samples have overlapping timestamps prefer the float samples.
|
||||
if c.series.floats[c.floatsCur].Timestamp <= c.series.histograms[c.histogramsCur].Timestamp {
|
||||
c.curValType = chunkenc.ValFloat
|
||||
|
@ -445,20 +446,19 @@ func (c *concreteSeriesIterator) Seek(t int64) chunkenc.ValueType {
|
|||
c.floatsCur--
|
||||
}
|
||||
}
|
||||
} else if c.floatsCur < len(c.series.floats) {
|
||||
case c.floatsCur < len(c.series.floats):
|
||||
c.curValType = chunkenc.ValFloat
|
||||
} else if c.histogramsCur < len(c.series.histograms) {
|
||||
case c.histogramsCur < len(c.series.histograms):
|
||||
c.curValType = getHistogramValType(&c.series.histograms[c.histogramsCur])
|
||||
}
|
||||
|
||||
return c.curValType
|
||||
}
|
||||
|
||||
func getHistogramValType(h *prompb.Histogram) chunkenc.ValueType {
|
||||
if _, isInt := h.GetCount().(*prompb.Histogram_CountInt); isInt {
|
||||
return chunkenc.ValHistogram
|
||||
if h.IsFloatHistogram() {
|
||||
return chunkenc.ValFloatHistogram
|
||||
}
|
||||
return chunkenc.ValFloatHistogram
|
||||
return chunkenc.ValHistogram
|
||||
}
|
||||
|
||||
// At implements chunkenc.Iterator.
|
||||
|
@ -514,26 +514,25 @@ func (c *concreteSeriesIterator) Next() chunkenc.ValueType {
|
|||
peekHistTS = c.series.histograms[c.histogramsCur+1].Timestamp
|
||||
}
|
||||
c.curValType = chunkenc.ValNone
|
||||
|
||||
if peekFloatTS < peekHistTS {
|
||||
switch {
|
||||
case peekFloatTS < peekHistTS:
|
||||
c.floatsCur++
|
||||
c.curValType = chunkenc.ValFloat
|
||||
} else if peekHistTS < peekFloatTS {
|
||||
case peekHistTS < peekFloatTS:
|
||||
c.histogramsCur++
|
||||
c.curValType = chunkenc.ValHistogram
|
||||
} else if peekFloatTS == noTS && peekHistTS == noTS {
|
||||
case peekFloatTS == noTS && peekHistTS == noTS:
|
||||
// This only happens when the iterator is exhausted; we set the cursors off the end to prevent
|
||||
// Seek() from returning anything afterwards.
|
||||
c.floatsCur = len(c.series.floats)
|
||||
c.histogramsCur = len(c.series.histograms)
|
||||
} else {
|
||||
default:
|
||||
// Prefer float samples to histogram samples if there's a conflict. We advance the cursor for histograms
|
||||
// anyway otherwise the histogram sample will get selected on the next call to Next().
|
||||
c.floatsCur++
|
||||
c.histogramsCur++
|
||||
c.curValType = chunkenc.ValFloat
|
||||
}
|
||||
|
||||
return c.curValType
|
||||
}
|
||||
|
||||
|
@ -626,8 +625,11 @@ func exemplarProtoToExemplar(ep prompb.Exemplar) exemplar.Exemplar {
|
|||
|
||||
// HistogramProtoToHistogram extracts a (normal integer) Histogram from the
|
||||
// provided proto message. The caller has to make sure that the proto message
|
||||
// represents an integer histogram and not a float histogram.
|
||||
// represents an integer histogram and not a float histogram, or it panics.
|
||||
func HistogramProtoToHistogram(hp prompb.Histogram) *histogram.Histogram {
|
||||
if hp.IsFloatHistogram() {
|
||||
panic("HistogramProtoToHistogram called with a float histogram")
|
||||
}
|
||||
return &histogram.Histogram{
|
||||
CounterResetHint: histogram.CounterResetHint(hp.ResetHint),
|
||||
Schema: hp.Schema,
|
||||
|
@ -644,8 +646,12 @@ func HistogramProtoToHistogram(hp prompb.Histogram) *histogram.Histogram {
|
|||
|
||||
// FloatHistogramProtoToFloatHistogram extracts a float Histogram from the
|
||||
// provided proto message to a Float Histogram. The caller has to make sure that
|
||||
// the proto message represents a float histogram and not an integer histogram.
|
||||
// the proto message represents a float histogram and not an integer histogram,
|
||||
// or it panics.
|
||||
func FloatHistogramProtoToFloatHistogram(hp prompb.Histogram) *histogram.FloatHistogram {
|
||||
if !hp.IsFloatHistogram() {
|
||||
panic("FloatHistogramProtoToFloatHistogram called with an integer histogram")
|
||||
}
|
||||
return &histogram.FloatHistogram{
|
||||
CounterResetHint: histogram.CounterResetHint(hp.ResetHint),
|
||||
Schema: hp.Schema,
|
||||
|
@ -662,8 +668,11 @@ func FloatHistogramProtoToFloatHistogram(hp prompb.Histogram) *histogram.FloatHi
|
|||
|
||||
// HistogramProtoToFloatHistogram extracts and converts a (normal integer) histogram from the provided proto message
|
||||
// to a float histogram. The caller has to make sure that the proto message represents an integer histogram and not a
|
||||
// float histogram.
|
||||
// float histogram, or it panics.
|
||||
func HistogramProtoToFloatHistogram(hp prompb.Histogram) *histogram.FloatHistogram {
|
||||
if hp.IsFloatHistogram() {
|
||||
panic("HistogramProtoToFloatHistogram called with a float histogram")
|
||||
}
|
||||
return &histogram.FloatHistogram{
|
||||
CounterResetHint: histogram.CounterResetHint(hp.ResetHint),
|
||||
Schema: hp.Schema,
|
||||
|
|
|
@ -524,11 +524,11 @@ func TestDecodeWriteRequest(t *testing.T) {
|
|||
require.Equal(t, writeRequestFixture, actual)
|
||||
}
|
||||
|
||||
func TestNilHistogramProto(t *testing.T) {
|
||||
func TestNilHistogramProto(*testing.T) {
|
||||
// This function will panic if it impromperly handles nil
|
||||
// values, causing the test to fail.
|
||||
HistogramProtoToHistogram(prompb.Histogram{})
|
||||
FloatHistogramProtoToFloatHistogram(prompb.Histogram{})
|
||||
HistogramProtoToFloatHistogram(prompb.Histogram{})
|
||||
}
|
||||
|
||||
func exampleHistogram() histogram.Histogram {
|
||||
|
|
|
@ -55,9 +55,10 @@ func (r *ewmaRate) tick() {
|
|||
r.mutex.Lock()
|
||||
defer r.mutex.Unlock()
|
||||
|
||||
if r.init {
|
||||
switch {
|
||||
case r.init:
|
||||
r.lastRate += r.alpha * (instantRate - r.lastRate)
|
||||
} else if newEvents > 0 {
|
||||
case newEvents > 0:
|
||||
r.init = true
|
||||
r.lastRate = instantRate
|
||||
}
|
||||
|
|
|
@ -609,7 +609,7 @@ outer:
|
|||
|
||||
t.metrics.enqueueRetriesTotal.Inc()
|
||||
time.Sleep(time.Duration(backoff))
|
||||
backoff = backoff * 2
|
||||
backoff *= 2
|
||||
// It is reasonable to use t.cfg.MaxBackoff here, as if we have hit
|
||||
// the full backoff we are likely waiting for external resources.
|
||||
if backoff > t.cfg.MaxBackoff {
|
||||
|
@ -660,7 +660,7 @@ outer:
|
|||
|
||||
t.metrics.enqueueRetriesTotal.Inc()
|
||||
time.Sleep(time.Duration(backoff))
|
||||
backoff = backoff * 2
|
||||
backoff *= 2
|
||||
if backoff > t.cfg.MaxBackoff {
|
||||
backoff = t.cfg.MaxBackoff
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ outer:
|
|||
|
||||
t.metrics.enqueueRetriesTotal.Inc()
|
||||
time.Sleep(time.Duration(backoff))
|
||||
backoff = backoff * 2
|
||||
backoff *= 2
|
||||
if backoff > t.cfg.MaxBackoff {
|
||||
backoff = t.cfg.MaxBackoff
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ outer:
|
|||
|
||||
t.metrics.enqueueRetriesTotal.Inc()
|
||||
time.Sleep(time.Duration(backoff))
|
||||
backoff = backoff * 2
|
||||
backoff *= 2
|
||||
if backoff > t.cfg.MaxBackoff {
|
||||
backoff = t.cfg.MaxBackoff
|
||||
}
|
||||
|
@ -1030,9 +1030,10 @@ func (t *QueueManager) calculateDesiredShards() int {
|
|||
return t.numShards
|
||||
}
|
||||
|
||||
if numShards > t.cfg.MaxShards {
|
||||
switch {
|
||||
case numShards > t.cfg.MaxShards:
|
||||
numShards = t.cfg.MaxShards
|
||||
} else if numShards < t.cfg.MinShards {
|
||||
case numShards < t.cfg.MinShards:
|
||||
numShards = t.cfg.MinShards
|
||||
}
|
||||
return numShards
|
||||
|
@ -1575,10 +1576,11 @@ func sendWriteRequestWithBackoff(ctx context.Context, cfg config.QueueConfig, l
|
|||
}
|
||||
|
||||
sleepDuration = backoff
|
||||
if backoffErr.retryAfter > 0 {
|
||||
switch {
|
||||
case backoffErr.retryAfter > 0:
|
||||
sleepDuration = backoffErr.retryAfter
|
||||
level.Info(l).Log("msg", "Retrying after duration specified by Retry-After header", "duration", sleepDuration)
|
||||
} else if backoffErr.retryAfter < 0 {
|
||||
case backoffErr.retryAfter < 0:
|
||||
level.Debug(l).Log("msg", "retry-after cannot be in past, retrying using default backoff mechanism")
|
||||
}
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ func TestReshard(t *testing.T) {
|
|||
c.waitForExpectedData(t)
|
||||
}
|
||||
|
||||
func TestReshardRaceWithStop(t *testing.T) {
|
||||
func TestReshardRaceWithStop(*testing.T) {
|
||||
c := NewTestWriteClient()
|
||||
var m *QueueManager
|
||||
h := sync.Mutex{}
|
||||
|
@ -802,7 +802,7 @@ func (c *TestWriteClient) Store(_ context.Context, req []byte) error {
|
|||
|
||||
for _, histogram := range ts.Histograms {
|
||||
count++
|
||||
if histogram.GetCountFloat() > 0 || histogram.GetZeroCountFloat() > 0 {
|
||||
if histogram.IsFloatHistogram() {
|
||||
c.receivedFloatHistograms[seriesName] = append(c.receivedFloatHistograms[seriesName], histogram)
|
||||
} else {
|
||||
c.receivedHistograms[seriesName] = append(c.receivedHistograms[seriesName], histogram)
|
||||
|
@ -864,10 +864,10 @@ func (c *TestBlockingWriteClient) Endpoint() string {
|
|||
// For benchmarking the send and not the receive side.
|
||||
type NopWriteClient struct{}
|
||||
|
||||
func NewNopWriteClient() *NopWriteClient { return &NopWriteClient{} }
|
||||
func (c *NopWriteClient) Store(_ context.Context, req []byte) error { return nil }
|
||||
func (c *NopWriteClient) Name() string { return "nopwriteclient" }
|
||||
func (c *NopWriteClient) Endpoint() string { return "http://test-remote.com/1234" }
|
||||
func NewNopWriteClient() *NopWriteClient { return &NopWriteClient{} }
|
||||
func (c *NopWriteClient) Store(context.Context, []byte) error { return nil }
|
||||
func (c *NopWriteClient) Name() string { return "nopwriteclient" }
|
||||
func (c *NopWriteClient) Endpoint() string { return "http://test-remote.com/1234" }
|
||||
|
||||
func BenchmarkSampleSend(b *testing.B) {
|
||||
// Send one sample per series, which is the typical remote_write case
|
||||
|
|
|
@ -125,7 +125,7 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err
|
|||
}
|
||||
|
||||
for _, hp := range ts.Histograms {
|
||||
if hp.GetCountFloat() > 0 || hp.GetZeroCountFloat() > 0 { // It is a float histogram.
|
||||
if hp.IsFloatHistogram() {
|
||||
fhs := FloatHistogramProtoToFloatHistogram(hp)
|
||||
_, err = app.AppendHistogram(0, labels, hp.Timestamp, nil, fhs)
|
||||
} else {
|
||||
|
|
|
@ -68,7 +68,7 @@ func TestRemoteWriteHandler(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, hp := range ts.Histograms {
|
||||
if hp.GetCountFloat() > 0 || hp.GetZeroCountFloat() > 0 { // It is a float histogram.
|
||||
if hp.IsFloatHistogram() {
|
||||
fh := FloatHistogramProtoToFloatHistogram(hp)
|
||||
require.Equal(t, mockHistogram{labels, hp.Timestamp, nil, fh}, appendable.histograms[k])
|
||||
} else {
|
||||
|
@ -294,7 +294,7 @@ func (m *mockAppendable) AppendExemplar(_ storage.SeriesRef, l labels.Labels, e
|
|||
return 0, nil
|
||||
}
|
||||
|
||||
func (m *mockAppendable) AppendHistogram(ref storage.SeriesRef, l labels.Labels, t int64, h *histogram.Histogram, fh *histogram.FloatHistogram) (storage.SeriesRef, error) {
|
||||
func (m *mockAppendable) AppendHistogram(_ storage.SeriesRef, l labels.Labels, t int64, h *histogram.Histogram, fh *histogram.FloatHistogram) (storage.SeriesRef, error) {
|
||||
if t < m.latestHistogram {
|
||||
return 0, storage.ErrOutOfOrderSample
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ func (te Expander) ExpandHTML(templateFiles []string) (result string, resultErr
|
|||
}
|
||||
}
|
||||
}()
|
||||
|
||||
//nolint:unconvert // Before Go 1.19 conversion from text_template to html_template is mandatory
|
||||
tmpl := html_template.New(te.name).Funcs(html_template.FuncMap(te.funcMap))
|
||||
tmpl.Option(te.options...)
|
||||
tmpl.Funcs(html_template.FuncMap{
|
||||
|
|
|
@ -732,22 +732,22 @@ func (db *DB) StartTime() (int64, error) {
|
|||
}
|
||||
|
||||
// Querier implements the Storage interface.
|
||||
func (db *DB) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error) {
|
||||
func (db *DB) Querier(context.Context, int64, int64) (storage.Querier, error) {
|
||||
return nil, ErrUnsupported
|
||||
}
|
||||
|
||||
// ChunkQuerier implements the Storage interface.
|
||||
func (db *DB) ChunkQuerier(ctx context.Context, mint, maxt int64) (storage.ChunkQuerier, error) {
|
||||
func (db *DB) ChunkQuerier(context.Context, int64, int64) (storage.ChunkQuerier, error) {
|
||||
return nil, ErrUnsupported
|
||||
}
|
||||
|
||||
// ExemplarQuerier implements the Storage interface.
|
||||
func (db *DB) ExemplarQuerier(ctx context.Context) (storage.ExemplarQuerier, error) {
|
||||
func (db *DB) ExemplarQuerier(context.Context) (storage.ExemplarQuerier, error) {
|
||||
return nil, ErrUnsupported
|
||||
}
|
||||
|
||||
// Appender implements storage.Storage.
|
||||
func (db *DB) Appender(_ context.Context) storage.Appender {
|
||||
func (db *DB) Appender(context.Context) storage.Appender {
|
||||
return db.appenderPool.Get().(storage.Appender)
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,7 @@ func (a *appender) Append(ref storage.SeriesRef, l labels.Labels, t int64, v flo
|
|||
return 0, storage.ErrOutOfOrderSample
|
||||
}
|
||||
|
||||
// NOTE: always modify pendingSamples and sampleSeries together
|
||||
// NOTE: always modify pendingSamples and sampleSeries together.
|
||||
a.pendingSamples = append(a.pendingSamples, record.RefSample{
|
||||
Ref: series.ref,
|
||||
T: t,
|
||||
|
@ -849,8 +849,8 @@ func (a *appender) getOrCreate(l labels.Labels) (series *memSeries, created bool
|
|||
return series, true
|
||||
}
|
||||
|
||||
func (a *appender) AppendExemplar(ref storage.SeriesRef, l labels.Labels, e exemplar.Exemplar) (storage.SeriesRef, error) {
|
||||
// series references and chunk references are identical for agent mode.
|
||||
func (a *appender) AppendExemplar(ref storage.SeriesRef, _ labels.Labels, e exemplar.Exemplar) (storage.SeriesRef, error) {
|
||||
// Series references and chunk references are identical for agent mode.
|
||||
headRef := chunks.HeadSeriesRef(ref)
|
||||
|
||||
s := a.series.GetByID(headRef)
|
||||
|
@ -951,7 +951,8 @@ func (a *appender) AppendHistogram(ref storage.SeriesRef, l labels.Labels, t int
|
|||
return 0, storage.ErrOutOfOrderSample
|
||||
}
|
||||
|
||||
if h != nil {
|
||||
switch {
|
||||
case h != nil:
|
||||
// NOTE: always modify pendingHistograms and histogramSeries together
|
||||
a.pendingHistograms = append(a.pendingHistograms, record.RefHistogramSample{
|
||||
Ref: series.ref,
|
||||
|
@ -959,7 +960,7 @@ func (a *appender) AppendHistogram(ref storage.SeriesRef, l labels.Labels, t int
|
|||
H: h,
|
||||
})
|
||||
a.histogramSeries = append(a.histogramSeries, series)
|
||||
} else if fh != nil {
|
||||
case fh != nil:
|
||||
// NOTE: always modify pendingFloatHistograms and floatHistogramSeries together
|
||||
a.pendingFloatHistograms = append(a.pendingFloatHistograms, record.RefFloatHistogramSample{
|
||||
Ref: series.ref,
|
||||
|
@ -973,7 +974,7 @@ func (a *appender) AppendHistogram(ref storage.SeriesRef, l labels.Labels, t int
|
|||
return storage.SeriesRef(series.ref), nil
|
||||
}
|
||||
|
||||
func (a *appender) UpdateMetadata(ref storage.SeriesRef, l labels.Labels, m metadata.Metadata) (storage.SeriesRef, error) {
|
||||
func (a *appender) UpdateMetadata(storage.SeriesRef, labels.Labels, metadata.Metadata) (storage.SeriesRef, error) {
|
||||
// TODO: Wire metadata in the Agent's appender.
|
||||
return 0, nil
|
||||
}
|
||||
|
|
|
@ -739,8 +739,7 @@ func TestStorage_DuplicateExemplarsIgnored(t *testing.T) {
|
|||
var dec record.Decoder
|
||||
for r.Next() {
|
||||
rec := r.Record()
|
||||
switch dec.Type(rec) {
|
||||
case record.Exemplars:
|
||||
if dec.Type(rec) == record.Exemplars {
|
||||
var exemplars []record.RefExemplar
|
||||
exemplars, err = dec.Exemplars(rec, exemplars)
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -633,7 +633,7 @@ func genHistogramSeries(totalSeries, labelCount int, mint, maxt, step int64, flo
|
|||
{Offset: 0, Length: 2},
|
||||
{Offset: 1, Length: 2},
|
||||
},
|
||||
PositiveBuckets: []int64{int64(ts + 1), 1, -1, 0},
|
||||
PositiveBuckets: []int64{ts + 1, 1, -1, 0},
|
||||
}
|
||||
if ts != mint {
|
||||
// By setting the counter reset hint to "no counter
|
||||
|
@ -672,7 +672,7 @@ func genHistogramAndFloatSeries(totalSeries, labelCount int, mint, maxt, step in
|
|||
{Offset: 0, Length: 2},
|
||||
{Offset: 1, Length: 2},
|
||||
},
|
||||
PositiveBuckets: []int64{int64(ts + 1), 1, -1, 0},
|
||||
PositiveBuckets: []int64{ts + 1, 1, -1, 0},
|
||||
}
|
||||
if count > 1 && count%5 != 1 {
|
||||
// Same rationale for this as above in
|
||||
|
|
|
@ -182,7 +182,7 @@ func (b *bstreamReader) readBits(nbits uint8) (uint64, error) {
|
|||
}
|
||||
|
||||
bitmask = (uint64(1) << nbits) - 1
|
||||
v = v | ((b.buffer >> (b.valid - nbits)) & bitmask)
|
||||
v |= ((b.buffer >> (b.valid - nbits)) & bitmask)
|
||||
b.valid -= nbits
|
||||
|
||||
return v, nil
|
||||
|
@ -242,13 +242,13 @@ func (b *bstreamReader) loadNextBuffer(nbits uint8) bool {
|
|||
if b.streamOffset+nbytes == len(b.stream) {
|
||||
// There can be concurrent writes happening on the very last byte
|
||||
// of the stream, so use the copy we took at initialization time.
|
||||
buffer = buffer | uint64(b.last)
|
||||
buffer |= uint64(b.last)
|
||||
// Read up to the byte before
|
||||
skip = 1
|
||||
}
|
||||
|
||||
for i := 0; i < nbytes-skip; i++ {
|
||||
buffer = buffer | (uint64(b.stream[b.streamOffset+i]) << uint(8*(nbytes-i-1)))
|
||||
buffer |= (uint64(b.stream[b.streamOffset+i]) << uint(8*(nbytes-i-1)))
|
||||
}
|
||||
|
||||
b.buffer = buffer
|
||||
|
|
|
@ -107,7 +107,7 @@ func (c *FloatHistogramChunk) Appender() (Appender, error) {
|
|||
// To get an appender, we must know the state it would have if we had
|
||||
// appended all existing data from scratch. We iterate through the end
|
||||
// and populate via the iterator's state.
|
||||
for it.Next() == ValFloatHistogram {
|
||||
for it.Next() == ValFloatHistogram { // nolint:revive
|
||||
}
|
||||
if err := it.Err(); err != nil {
|
||||
return nil, err
|
||||
|
@ -785,7 +785,7 @@ func (it *floatHistogramIterator) Next() ValueType {
|
|||
it.err = err
|
||||
return ValNone
|
||||
}
|
||||
it.tDelta = it.tDelta + tDod
|
||||
it.tDelta += tDod
|
||||
it.t += it.tDelta
|
||||
|
||||
if ok := it.readXor(&it.cnt.value, &it.cnt.leading, &it.cnt.trailing); !ok {
|
||||
|
|
|
@ -111,7 +111,7 @@ func TestFloatHistogramChunkSameBuckets(t *testing.T) {
|
|||
|
||||
// 3. Now recycle an iterator that was never used to access anything.
|
||||
itX := c.Iterator(nil)
|
||||
for itX.Next() == ValFloatHistogram {
|
||||
for itX.Next() == ValFloatHistogram { // nolint:revive
|
||||
// Just iterate through without accessing anything.
|
||||
}
|
||||
it3 := c.iterator(itX)
|
||||
|
|
|
@ -126,7 +126,7 @@ func (c *HistogramChunk) Appender() (Appender, error) {
|
|||
// To get an appender, we must know the state it would have if we had
|
||||
// appended all existing data from scratch. We iterate through the end
|
||||
// and populate via the iterator's state.
|
||||
for it.Next() == ValHistogram {
|
||||
for it.Next() == ValHistogram { // nolint:revive
|
||||
}
|
||||
if err := it.Err(); err != nil {
|
||||
return nil, err
|
||||
|
@ -875,7 +875,7 @@ func (it *histogramIterator) Next() ValueType {
|
|||
it.err = err
|
||||
return ValNone
|
||||
}
|
||||
it.tDelta = it.tDelta + tDod
|
||||
it.tDelta += tDod
|
||||
it.t += it.tDelta
|
||||
|
||||
cntDod, err := readVarbitInt(&it.br)
|
||||
|
@ -883,7 +883,7 @@ func (it *histogramIterator) Next() ValueType {
|
|||
it.err = err
|
||||
return ValNone
|
||||
}
|
||||
it.cntDelta = it.cntDelta + cntDod
|
||||
it.cntDelta += cntDod
|
||||
it.cnt = uint64(int64(it.cnt) + it.cntDelta)
|
||||
|
||||
zcntDod, err := readVarbitInt(&it.br)
|
||||
|
@ -891,7 +891,7 @@ func (it *histogramIterator) Next() ValueType {
|
|||
it.err = err
|
||||
return ValNone
|
||||
}
|
||||
it.zCntDelta = it.zCntDelta + zcntDod
|
||||
it.zCntDelta += zcntDod
|
||||
it.zCnt = uint64(int64(it.zCnt) + it.zCntDelta)
|
||||
|
||||
ok := it.readSum()
|
||||
|
|
|
@ -116,7 +116,7 @@ func TestHistogramChunkSameBuckets(t *testing.T) {
|
|||
|
||||
// 3. Now recycle an iterator that was never used to access anything.
|
||||
itX := c.Iterator(nil)
|
||||
for itX.Next() == ValHistogram {
|
||||
for itX.Next() == ValHistogram { // nolint:revive
|
||||
// Just iterate through without accessing anything.
|
||||
}
|
||||
it3 := c.iterator(itX)
|
||||
|
|
|
@ -122,7 +122,7 @@ func readVarbitInt(b *bstreamReader) (int64, error) {
|
|||
}
|
||||
if bits > (1 << (sz - 1)) {
|
||||
// Or something.
|
||||
bits = bits - (1 << sz)
|
||||
bits -= (1 << sz)
|
||||
}
|
||||
val = int64(bits)
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ func (c *XORChunk) Appender() (Appender, error) {
|
|||
// To get an appender we must know the state it would have if we had
|
||||
// appended all existing data from scratch.
|
||||
// We iterate through the end and populate via the iterator's state.
|
||||
for it.Next() != ValNone {
|
||||
for it.Next() != ValNone { // nolint:revive
|
||||
}
|
||||
if err := it.Err(); err != nil {
|
||||
return nil, err
|
||||
|
@ -152,26 +152,25 @@ type xorAppender struct {
|
|||
trailing uint8
|
||||
}
|
||||
|
||||
func (a *xorAppender) AppendHistogram(t int64, h *histogram.Histogram) {
|
||||
func (a *xorAppender) AppendHistogram(int64, *histogram.Histogram) {
|
||||
panic("appended a histogram to an xor chunk")
|
||||
}
|
||||
|
||||
func (a *xorAppender) AppendFloatHistogram(t int64, h *histogram.FloatHistogram) {
|
||||
func (a *xorAppender) AppendFloatHistogram(int64, *histogram.FloatHistogram) {
|
||||
panic("appended a float histogram to an xor chunk")
|
||||
}
|
||||
|
||||
func (a *xorAppender) Append(t int64, v float64) {
|
||||
var tDelta uint64
|
||||
num := binary.BigEndian.Uint16(a.b.bytes())
|
||||
|
||||
if num == 0 {
|
||||
switch num {
|
||||
case 0:
|
||||
buf := make([]byte, binary.MaxVarintLen64)
|
||||
for _, b := range buf[:binary.PutVarint(buf, t)] {
|
||||
a.b.writeByte(b)
|
||||
}
|
||||
a.b.writeBits(math.Float64bits(v), 64)
|
||||
|
||||
} else if num == 1 {
|
||||
case 1:
|
||||
tDelta = uint64(t - a.t)
|
||||
|
||||
buf := make([]byte, binary.MaxVarintLen64)
|
||||
|
@ -181,7 +180,7 @@ func (a *xorAppender) Append(t int64, v float64) {
|
|||
|
||||
a.writeVDelta(v)
|
||||
|
||||
} else {
|
||||
default:
|
||||
tDelta = uint64(t - a.t)
|
||||
dod := int64(tDelta - a.tDelta)
|
||||
|
||||
|
@ -321,7 +320,7 @@ func (it *xorIterator) Next() ValueType {
|
|||
return ValNone
|
||||
}
|
||||
it.tDelta = tDelta
|
||||
it.t = it.t + int64(it.tDelta)
|
||||
it.t += int64(it.tDelta)
|
||||
|
||||
return it.readValue()
|
||||
}
|
||||
|
@ -384,7 +383,7 @@ func (it *xorIterator) Next() ValueType {
|
|||
}
|
||||
|
||||
it.tDelta = uint64(int64(it.tDelta) + dod)
|
||||
it.t = it.t + int64(it.tDelta)
|
||||
it.t += int64(it.tDelta)
|
||||
|
||||
return it.readValue()
|
||||
}
|
||||
|
|
|
@ -1000,9 +1000,10 @@ func (cdm *ChunkDiskMapper) DeleteCorrupted(originalErr error) error {
|
|||
cdm.readPathMtx.RLock()
|
||||
lastSeq := 0
|
||||
for seg := range cdm.mmappedChunkFiles {
|
||||
if seg >= cerr.FileIndex {
|
||||
switch {
|
||||
case seg >= cerr.FileIndex:
|
||||
segs = append(segs, seg)
|
||||
} else if seg > lastSeq {
|
||||
case seg > lastSeq:
|
||||
lastSeq = seg
|
||||
}
|
||||
}
|
||||
|
|
|
@ -541,10 +541,10 @@ func createChunkDiskMapper(t *testing.T, dir string) *ChunkDiskMapper {
|
|||
|
||||
func randomChunk(t *testing.T) chunkenc.Chunk {
|
||||
chunk := chunkenc.NewXORChunk()
|
||||
len := rand.Int() % 120
|
||||
length := rand.Int() % 120
|
||||
app, err := chunk.Appender()
|
||||
require.NoError(t, err)
|
||||
for i := 0; i < len; i++ {
|
||||
for i := 0; i < length; i++ {
|
||||
app.Append(rand.Int63(), rand.Float64())
|
||||
}
|
||||
return chunk
|
||||
|
@ -552,10 +552,10 @@ func randomChunk(t *testing.T) chunkenc.Chunk {
|
|||
|
||||
func randomUnsupportedChunk(t *testing.T) chunkenc.Chunk {
|
||||
chunk := newUnsupportedChunk()
|
||||
len := rand.Int() % 120
|
||||
length := rand.Int() % 120
|
||||
app, err := chunk.Appender()
|
||||
require.NoError(t, err)
|
||||
for i := 0; i < len; i++ {
|
||||
for i := 0; i < length; i++ {
|
||||
app.Append(rand.Int63(), rand.Float64())
|
||||
}
|
||||
return chunk
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue