chore: enable gci linter (#16245)

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
pull/16292/head
Matthieu MOREL 3 months ago committed by GitHub
parent 9a0e1354c2
commit 5fa1146e21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      .golangci.yml
  2. 3
      cmd/promtool/analyze_test.go
  3. 1
      cmd/promtool/backfill.go
  4. 5
      cmd/promtool/main.go
  5. 3
      cmd/promtool/sd_test.go
  6. 3
      cmd/promtool/tsdb.go
  7. 3
      cmd/promtool/unittest.go
  8. 3
      discovery/azure/azure.go
  9. 8
      discovery/kubernetes/kubernetes.go
  10. 3
      discovery/kubernetes/kubernetes_test.go
  11. 3
      discovery/ovhcloud/vps_test.go
  12. 3
      discovery/registry.go
  13. 3
      discovery/uyuni/uyuni_test.go
  14. 4
      internal/tools/go.mod
  15. 4
      internal/tools/go.sum
  16. 2
      internal/tools/tools.go
  17. 6
      model/textparse/benchmark_test.go
  18. 3
      model/textparse/nhcbparse_test.go
  19. 1
      model/textparse/protobufparse.go
  20. 3
      notifier/notifier_test.go
  21. 10
      plugins/generate.go
  22. 24
      plugins/plugins.go
  23. 5
      prompb/io/prometheus/write/v2/types.pb.go
  24. 3
      promql/engine_internal_test.go
  25. 3
      promql/parser/ast.go
  26. 3
      promql/parser/parse_test.go
  27. 10
      rules/group.go
  28. 3
      rules/origin_test.go
  29. 1
      scrape/clientprotobuf.go
  30. 6
      scrape/manager_test.go
  31. 5
      scripts/genproto.sh
  32. 3
      storage/remote/azuread/azuread.go
  33. 5
      storage/remote/otlptranslator/prometheusremotewrite/helper_test.go
  34. 3
      storage/remote/queue_manager_test.go
  35. 16
      storage/remote/write_handler.go
  36. 6
      storage/remote/write_handler_test.go
  37. 3
      template/template.go
  38. 1
      tsdb/block.go
  39. 3
      tsdb/blockwriter_test.go
  40. 3
      tsdb/head.go
  41. 3
      tsdb/head_test.go
  42. 3
      tsdb/head_wal.go
  43. 4
      tsdb/ooo_head_test.go
  44. 4
      tsdb/querier_bench_test.go
  45. 3
      tsdb/record/record_test.go
  46. 4
      tsdb/testutil.go
  47. 3
      tsdb/tombstones/tombstones_test.go
  48. 3
      tsdb/tsdbutil/dir_locker_test.go
  49. 7
      web/api/v1/api_test.go

@ -10,10 +10,10 @@ linters:
- depguard
- errorlint
- exptostd
- gci
- gocritic
- godot
- gofumpt
- goimports
- loggercheck
- misspell
- nilnesserr
@ -103,8 +103,11 @@ linters-settings:
- (*net/http.Server).Shutdown
# Never check for rollback errors as Rollback() is called when a previous error was detected.
- (github.com/prometheus/prometheus/storage.Appender).Rollback
goimports:
local-prefixes: github.com/prometheus/prometheus
gci:
sections:
- standard
- default
- prefix(github.com/prometheus/prometheus)
gofumpt:
extra-rules: true
perfsprint:

@ -17,9 +17,8 @@ import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
)
var (

@ -22,7 +22,6 @@ import (
"time"
"github.com/oklog/ulid/v2"
"github.com/prometheus/common/promslog"
"github.com/prometheus/prometheus/model/labels"

@ -36,6 +36,8 @@ import (
"github.com/prometheus/client_golang/api"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/testutil/promlint"
dto "github.com/prometheus/client_model/go"
promconfig "github.com/prometheus/common/config"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
@ -43,9 +45,6 @@ import (
"github.com/prometheus/exporter-toolkit/web"
"gopkg.in/yaml.v2"
dto "github.com/prometheus/client_model/go"
promconfig "github.com/prometheus/common/config"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/discovery"
"github.com/prometheus/prometheus/discovery/file"

@ -18,14 +18,13 @@ import (
"time"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/discovery/targetgroup"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"
"github.com/prometheus/prometheus/util/testutil"
"github.com/stretchr/testify/require"
)
func TestSDCheckResult(t *testing.T) {

@ -33,9 +33,8 @@ import (
"time"
"github.com/alecthomas/units"
"go.uber.org/atomic"
"github.com/prometheus/common/promslog"
"go.uber.org/atomic"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql/parser"

@ -29,10 +29,9 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/grafana/regexp"
"github.com/nsf/jsondiff"
"gopkg.in/yaml.v2"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
"gopkg.in/yaml.v2"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"

@ -38,9 +38,8 @@ import (
"github.com/Code-Hex/go-generics-cache/policy/lru"
"github.com/prometheus/client_golang/prometheus"
config_util "github.com/prometheus/common/config"
"github.com/prometheus/common/promslog"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
"github.com/prometheus/common/version"
"github.com/prometheus/prometheus/discovery"

@ -24,8 +24,6 @@ import (
"sync"
"time"
"github.com/prometheus/prometheus/util/strutil"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/config"
"github.com/prometheus/common/model"
@ -40,15 +38,15 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/kubernetes"
// Required to get the GCP auth provider working.
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/clientcmd"
// Required to get the GCP auth provider working.
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
"github.com/prometheus/prometheus/discovery"
"github.com/prometheus/prometheus/discovery/targetgroup"
"github.com/prometheus/prometheus/util/strutil"
)
const (

@ -20,6 +20,7 @@ import (
"testing"
"time"
"github.com/prometheus/client_golang/prometheus"
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
@ -35,8 +36,6 @@ import (
kubetesting "k8s.io/client-go/testing"
"k8s.io/client-go/tools/cache"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/prometheus/discovery"
"github.com/prometheus/prometheus/discovery/targetgroup"
"github.com/prometheus/prometheus/util/testutil"

@ -21,11 +21,10 @@ import (
"os"
"testing"
yaml "gopkg.in/yaml.v2"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
yaml "gopkg.in/yaml.v2"
)
func TestOvhCloudVpsRefresh(t *testing.T) {

@ -22,9 +22,8 @@ import (
"strings"
"sync"
"gopkg.in/yaml.v2"
"github.com/prometheus/client_golang/prometheus"
"gopkg.in/yaml.v2"
"github.com/prometheus/prometheus/discovery/targetgroup"
)

@ -21,9 +21,8 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/prometheus/client_golang/prometheus"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/discovery"
"github.com/prometheus/prometheus/discovery/targetgroup"

@ -6,9 +6,9 @@ toolchain go1.23.4
require (
github.com/bufbuild/buf v1.50.1
github.com/daixiang0/gci v0.13.5
github.com/gogo/protobuf v1.3.2
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3
golang.org/x/tools v0.31.0
)
require (
@ -50,6 +50,7 @@ require (
github.com/google/go-containerregistry v0.20.3 // indirect
github.com/google/pprof v0.0.0-20250302191652-9094ed2288e7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jdx/go-netrc v1.0.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
@ -106,6 +107,7 @@ require (
golang.org/x/sys v0.31.0 // indirect
golang.org/x/term v0.30.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/tools v0.31.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/grpc v1.70.0 // indirect

@ -57,6 +57,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/daixiang0/gci v0.13.5 h1:kThgmH1yBmZSBCh1EJVxQ7JsHpm5Oms0AMed/0LaH4c=
github.com/daixiang0/gci v0.13.5/go.mod h1:12etP2OniiIdP4q+kjUGrC/rUagga7ODbqsom5Eo5Yk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -112,6 +114,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=

@ -19,8 +19,8 @@ package tools
import (
_ "github.com/bufbuild/buf/cmd/buf"
_ "github.com/daixiang0/gci/cmd/gci"
_ "github.com/gogo/protobuf/protoc-gen-gogofast"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
_ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
_ "golang.org/x/tools/cmd/goimports"
)

@ -23,12 +23,12 @@ import (
"strings"
"testing"
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/labels"
)
// BenchmarkParse... set of benchmarks analyze efficiency of parsing various

@ -20,9 +20,8 @@ import (
"testing"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/require"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/histogram"

@ -30,7 +30,6 @@ import (
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
dto "github.com/prometheus/prometheus/prompb/io/prometheus/client"
)

@ -35,9 +35,8 @@ import (
"go.uber.org/atomic"
"gopkg.in/yaml.v2"
"github.com/prometheus/prometheus/discovery"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/discovery"
_ "github.com/prometheus/prometheus/discovery/file"
"github.com/prometheus/prometheus/discovery/targetgroup"
"github.com/prometheus/prometheus/model/labels"

@ -57,7 +57,7 @@ func main() {
// See the License for the specific language governing permissions and
// limitations under the License.
// This file is generated by "make plugins".
// Code generated by "make plugins". DO NOT EDIT.
package plugins
@ -75,7 +75,7 @@ package plugins
log.Fatal(err)
}
for i, plugin := range plugins {
for _, plugin := range plugins {
_, err = f.WriteString(fmt.Sprintf("\t// Register %s plugin.\n", path.Base(plugin)))
if err != nil {
log.Fatal(err)
@ -84,12 +84,6 @@ package plugins
if err != nil {
log.Fatal(err)
}
if i < len(plugins)-1 {
_, err = f.WriteString("\n")
if err != nil {
log.Fatal(err)
}
}
}
_, err = f.WriteString(")\n")

@ -11,77 +11,55 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// This file is generated by "make plugins".
// Code generated by "make plugins". DO NOT EDIT.
package plugins
import (
// Register aws plugin.
_ "github.com/prometheus/prometheus/discovery/aws"
// Register azure plugin.
_ "github.com/prometheus/prometheus/discovery/azure"
// Register consul plugin.
_ "github.com/prometheus/prometheus/discovery/consul"
// Register digitalocean plugin.
_ "github.com/prometheus/prometheus/discovery/digitalocean"
// Register dns plugin.
_ "github.com/prometheus/prometheus/discovery/dns"
// Register eureka plugin.
_ "github.com/prometheus/prometheus/discovery/eureka"
// Register gce plugin.
_ "github.com/prometheus/prometheus/discovery/gce"
// Register hetzner plugin.
_ "github.com/prometheus/prometheus/discovery/hetzner"
// Register ionos plugin.
_ "github.com/prometheus/prometheus/discovery/ionos"
// Register kubernetes plugin.
_ "github.com/prometheus/prometheus/discovery/kubernetes"
// Register linode plugin.
_ "github.com/prometheus/prometheus/discovery/linode"
// Register marathon plugin.
_ "github.com/prometheus/prometheus/discovery/marathon"
// Register moby plugin.
_ "github.com/prometheus/prometheus/discovery/moby"
// Register nomad plugin.
_ "github.com/prometheus/prometheus/discovery/nomad"
// Register openstack plugin.
_ "github.com/prometheus/prometheus/discovery/openstack"
// Register ovhcloud plugin.
_ "github.com/prometheus/prometheus/discovery/ovhcloud"
// Register puppetdb plugin.
_ "github.com/prometheus/prometheus/discovery/puppetdb"
// Register scaleway plugin.
_ "github.com/prometheus/prometheus/discovery/scaleway"
// Register triton plugin.
_ "github.com/prometheus/prometheus/discovery/triton"
// Register uyuni plugin.
_ "github.com/prometheus/prometheus/discovery/uyuni"
// Register vultr plugin.
_ "github.com/prometheus/prometheus/discovery/vultr"
// Register xds plugin.
_ "github.com/prometheus/prometheus/discovery/xds"
// Register zookeeper plugin.
_ "github.com/prometheus/prometheus/discovery/zookeeper"
)

@ -6,11 +6,12 @@ package writev2
import (
encoding_binary "encoding/binary"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
io "io"
math "math"
math_bits "math/bits"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
)
// Reference imports to suppress errors if they are not otherwise used.

@ -18,9 +18,8 @@ import (
"errors"
"testing"
"github.com/stretchr/testify/require"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/promql/parser"
"github.com/prometheus/prometheus/util/annotations"

@ -19,9 +19,8 @@ import (
"time"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/promql/parser/posrange"
"github.com/prometheus/prometheus/storage"
)
// Node is a generic interface for all nodes in an AST.

@ -26,9 +26,8 @@ import (
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/util/testutil"
"github.com/prometheus/prometheus/promql/parser/posrange"
"github.com/prometheus/prometheus/util/testutil"
)
var testExpr = []struct {

@ -23,21 +23,19 @@ import (
"sync"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/codes"
"go.uber.org/atomic"
"github.com/prometheus/prometheus/promql/parser"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/model"
"github.com/prometheus/common/promslog"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/timestamp"
"github.com/prometheus/prometheus/model/value"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/promql/parser"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"
)

@ -19,9 +19,8 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql"

@ -18,7 +18,6 @@ import (
"encoding/binary"
"github.com/gogo/protobuf/proto"
// Intentionally using client model to simulate client in tests.
dto "github.com/prometheus/client_model/go"
)

@ -40,10 +40,6 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
"gopkg.in/yaml.v2"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/model/timestamp"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/discovery"
_ "github.com/prometheus/prometheus/discovery/file"
@ -51,6 +47,8 @@ import (
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"
"github.com/prometheus/prometheus/model/timestamp"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/tsdbutil"
"github.com/prometheus/prometheus/util/runutil"
"github.com/prometheus/prometheus/util/testutil"

@ -11,7 +11,7 @@ if ! [[ "$0" =~ "scripts/genproto.sh" ]]; then
fi
pushd "internal/tools"
INSTALL_PKGS="github.com/bufbuild/buf/cmd/buf github.com/gogo/protobuf/protoc-gen-gogofast github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 golang.org/x/tools/cmd/goimports"
INSTALL_PKGS="github.com/bufbuild/buf/cmd/buf github.com/daixiang0/gci github.com/gogo/protobuf/protoc-gen-gogofast github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
for pkg in ${INSTALL_PKGS}; do
GO111MODULE=on go install "$pkg"
done
@ -29,6 +29,7 @@ for dir in ${DIRS}; do
sed -i.bak -E 's/golang\/protobuf\/descriptor/gogo\/protobuf\/protoc-gen-gogo\/descriptor/g' *.go
sed -i.bak -E 's/golang\/protobuf/gogo\/protobuf/g' *.go
rm -f -- *.bak
goimports -w ./*.go ./io/prometheus/client/*.go
gci write -s standard -s default -s "prefix(github.com/prometheus/prometheus)" .
popd
done

@ -21,13 +21,12 @@ import (
"sync"
"time"
"github.com/grafana/regexp"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/google/uuid"
"github.com/grafana/regexp"
)
// Clouds.

@ -21,11 +21,10 @@ import (
"testing"
"time"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/pmetric"
"github.com/prometheus/prometheus/prompb"
)

@ -38,8 +38,6 @@ import (
"github.com/stretchr/testify/require"
"go.uber.org/atomic"
"github.com/prometheus/prometheus/util/compression"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
@ -51,6 +49,7 @@ import (
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/record"
"github.com/prometheus/prometheus/tsdb/wlog"
"github.com/prometheus/prometheus/util/compression"
"github.com/prometheus/prometheus/util/runutil"
"github.com/prometheus/prometheus/util/testutil"
)

@ -24,11 +24,15 @@ import (
"time"
"github.com/gogo/protobuf/proto"
deltatocumulative "github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/util/compression"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/otel/metric/noop"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/exemplar"
@ -39,13 +43,7 @@ import (
writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2"
"github.com/prometheus/prometheus/storage"
otlptranslator "github.com/prometheus/prometheus/storage/remote/otlptranslator/prometheusremotewrite"
deltatocumulative "github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/otel/metric/noop"
"github.com/prometheus/prometheus/util/compression"
)
type writeHandler struct {

@ -29,11 +29,8 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/util/compression"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/exemplar"
@ -44,6 +41,7 @@ import (
writev2 "github.com/prometheus/prometheus/prompb/io/prometheus/write/v2"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/util/compression"
"github.com/prometheus/prometheus/util/testutil"
)

@ -29,12 +29,11 @@ import (
"github.com/grafana/regexp"
"github.com/prometheus/client_golang/prometheus"
common_templates "github.com/prometheus/common/helpers/templates"
"github.com/prometheus/common/model"
"golang.org/x/text/cases"
"golang.org/x/text/language"
common_templates "github.com/prometheus/common/helpers/templates"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/util/strutil"
)

@ -27,7 +27,6 @@ import (
"sync"
"github.com/oklog/ulid/v2"
"github.com/prometheus/common/promslog"
"github.com/prometheus/prometheus/model/labels"

@ -19,9 +19,8 @@ import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/tsdb/chunks"

@ -27,10 +27,9 @@ import (
"time"
"github.com/oklog/ulid/v2"
"go.uber.org/atomic"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/promslog"
"go.uber.org/atomic"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/exemplar"

@ -38,8 +38,6 @@ import (
"go.uber.org/atomic"
"golang.org/x/sync/errgroup"
"github.com/prometheus/prometheus/util/compression"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/histogram"
@ -54,6 +52,7 @@ import (
"github.com/prometheus/prometheus/tsdb/tombstones"
"github.com/prometheus/prometheus/tsdb/tsdbutil"
"github.com/prometheus/prometheus/tsdb/wlog"
"github.com/prometheus/prometheus/util/compression"
"github.com/prometheus/prometheus/util/testutil"
)

@ -25,9 +25,8 @@ import (
"sync"
"time"
"go.uber.org/atomic"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/atomic"
"github.com/prometheus/prometheus/model/exemplar"
"github.com/prometheus/prometheus/model/histogram"

@ -17,12 +17,12 @@ import (
"math"
"testing"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunkenc"
"github.com/prometheus/prometheus/tsdb/tsdbutil"
"github.com/stretchr/testify/require"
)
const testMaxSize int = 32

@ -19,11 +19,11 @@ import (
"strconv"
"testing"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/index"
"github.com/stretchr/testify/require"
)
// Make entries ~50B in size, to emulate real-world high cardinality.

@ -19,9 +19,8 @@ import (
"math/rand"
"testing"
"github.com/stretchr/testify/require"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"

@ -16,16 +16,14 @@ package tsdb
import (
"testing"
"github.com/prometheus/prometheus/tsdb/tsdbutil"
prom_testutil "github.com/prometheus/client_golang/prometheus/testutil"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/tsdb/chunks"
"github.com/prometheus/prometheus/tsdb/tsdbutil"
)
const (

@ -20,11 +20,10 @@ import (
"testing"
"time"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
"go.uber.org/goleak"
"github.com/prometheus/common/promslog"
"github.com/prometheus/prometheus/storage"
)

@ -16,9 +16,8 @@ package tsdbutil
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/prometheus/common/promslog"
"github.com/stretchr/testify/require"
"github.com/prometheus/prometheus/util/testutil"
)

@ -30,10 +30,6 @@ import (
"testing"
"time"
"github.com/prometheus/prometheus/prompb"
"github.com/prometheus/prometheus/util/stats"
"github.com/prometheus/prometheus/util/testutil"
jsoniter "github.com/json-iterator/go"
"github.com/prometheus/client_golang/prometheus"
config_util "github.com/prometheus/common/config"
@ -47,6 +43,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/metadata"
"github.com/prometheus/prometheus/model/timestamp"
"github.com/prometheus/prometheus/prompb"
"github.com/prometheus/prometheus/promql"
"github.com/prometheus/prometheus/promql/parser"
"github.com/prometheus/prometheus/promql/promqltest"
@ -55,7 +52,9 @@ import (
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/storage/remote"
"github.com/prometheus/prometheus/tsdb"
"github.com/prometheus/prometheus/util/stats"
"github.com/prometheus/prometheus/util/teststorage"
"github.com/prometheus/prometheus/util/testutil"
)
func testEngine(t *testing.T) *promql.Engine {

Loading…
Cancel
Save