Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Refactor metrictank repo to be compatible with go modules #2042

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- image: circleci/golang:1.17.3
steps:
- checkout
- run: GO111MODULE=off go test -v -race --short ./...
- run: go test -v -race --short ./...

qa:
working_directory: /go/src/github.com/grafana/metrictank
Expand Down Expand Up @@ -53,8 +53,8 @@ jobs:
- run: go version
- run: scripts/qa/docs.sh
- run: docker load -i build_docker/metrictank.tar
- run: GO111MODULE=off go test -v ./stacktest/tests/end2end_carbon
- run: GO111MODULE=off go test -v ./stacktest/tests/end2end_carbon_bigtable
- run: go test -v ./pkg/stacktest/tests/end2end_carbon
- run: go test -v ./pkg/stacktest/tests/end2end_carbon_bigtable

qa-chaos:
working_directory: /home/circleci/.go_workspace/src/github.com/grafana/metrictank
Expand All @@ -75,7 +75,7 @@ jobs:
- run: docker pull jaegertracing/all-in-one
# kafka broker advertises itself as 'kafka' but that doesn't resolve. we do have a docker proxy on localhost
- run: echo "127.0.0.1 kafka" | sudo tee -a /etc/hosts
- run: GO111MODULE=off go test -v ./stacktest/tests/chaos_cluster
- run: go test -v ./pkg/stacktest/tests/chaos_cluster

deploy:
docker:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
build_docker
build_pkg
build_tmp
vendor/
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
default:
$(MAKE) all
test:
GO111MODULE=off CGO_ENABLED=1 go test -race -short ./...
CGO_ENABLED=1 go test -race -short ./...
test-all:
GO111MODULE=off CGO_ENABLED=1 go test -race ./...
CGO_ENABLED=1 go test -race ./...
benchmark:
GO111MODULE=off CGO_ENABLED=0 go test -count=10 -run='^$$' -bench=. -benchtime=100ms ./... | tee benchmark.txt
CGO_ENABLED=0 go test -count=10 -run='^$$' -bench=. -benchtime=100ms ./... | tee benchmark.txt

stacktest:
# count=1 forces uncached runs
# not using stacktest/... here because Go would run them all in parallel,
# or at least the TestMain's, and the stacks would conflict with each other
GO111MODULE=off go test -count=1 -v ./stacktest/tests/chaos_cluster
GO111MODULE=off go test -count=1 -v ./stacktest/tests/end2end_carbon
GO111MODULE=off go test -count=1 -v ./stacktest/tests/end2end_carbon_bigtable
go test -count=1 -v ./pkg/stacktest/tests/chaos_cluster
go test -count=1 -v ./pkg/stacktest/tests/end2end_carbon
go test -count=1 -v ./pkg/stacktest/tests/end2end_carbon_bigtable

check:
$(MAKE) test
Expand Down
42 changes: 21 additions & 21 deletions cmd/metrictank/metrictank.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ import (
"github.com/Dieterbe/profiletrigger/heap"
"github.com/Shopify/sarama"
"github.com/grafana/globalconf"
"github.com/grafana/metrictank/api"
"github.com/grafana/metrictank/cluster"
"github.com/grafana/metrictank/idx"
"github.com/grafana/metrictank/idx/bigtable"
"github.com/grafana/metrictank/idx/cassandra"
"github.com/grafana/metrictank/idx/memory"
metatagsBt "github.com/grafana/metrictank/idx/metatags/bigtable"
metatagsCass "github.com/grafana/metrictank/idx/metatags/cassandra"
"github.com/grafana/metrictank/input"
inCarbon "github.com/grafana/metrictank/input/carbon"
inKafkaMdm "github.com/grafana/metrictank/input/kafkamdm"
"github.com/grafana/metrictank/jaeger"
"github.com/grafana/metrictank/logger"
"github.com/grafana/metrictank/mdata"
"github.com/grafana/metrictank/mdata/cache"
"github.com/grafana/metrictank/mdata/notifierKafka"
"github.com/grafana/metrictank/stats"
statsConfig "github.com/grafana/metrictank/stats/config"
bigtableStore "github.com/grafana/metrictank/store/bigtable"
cassandraStore "github.com/grafana/metrictank/store/cassandra"
"github.com/grafana/metrictank/util"
"github.com/grafana/metrictank/internal/cluster"
"github.com/grafana/metrictank/internal/idx"
"github.com/grafana/metrictank/internal/idx/bigtable"
"github.com/grafana/metrictank/internal/idx/cassandra"
"github.com/grafana/metrictank/internal/idx/memory"
metatagsBt "github.com/grafana/metrictank/internal/idx/metatags/bigtable"
metatagsCass "github.com/grafana/metrictank/internal/idx/metatags/cassandra"
"github.com/grafana/metrictank/internal/input"
inCarbon "github.com/grafana/metrictank/internal/input/carbon"
inKafkaMdm "github.com/grafana/metrictank/internal/input/kafkamdm"
"github.com/grafana/metrictank/internal/jaeger"
"github.com/grafana/metrictank/internal/mdata"
"github.com/grafana/metrictank/internal/mdata/cache"
"github.com/grafana/metrictank/internal/mdata/notifierKafka"
"github.com/grafana/metrictank/internal/stats"
statsConfig "github.com/grafana/metrictank/internal/stats/config"
bigtableStore "github.com/grafana/metrictank/internal/store/bigtable"
cassandraStore "github.com/grafana/metrictank/internal/store/cassandra"
"github.com/grafana/metrictank/internal/util"
"github.com/grafana/metrictank/pkg/api"
"github.com/grafana/metrictank/pkg/logger"
"github.com/raintank/dur"
log "github.com/sirupsen/logrus"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/mt-aggs-explain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"os"
"runtime"

"github.com/grafana/metrictank/conf"
"github.com/grafana/metrictank/consolidation"
"github.com/grafana/metrictank/logger"
"github.com/grafana/metrictank/internal/consolidation"
"github.com/grafana/metrictank/pkg/conf"
"github.com/grafana/metrictank/pkg/logger"
log "github.com/sirupsen/logrus"
)

Expand Down
22 changes: 11 additions & 11 deletions cmd/mt-backfill/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import (

"github.com/Shopify/sarama"
"github.com/grafana/globalconf"
"github.com/grafana/metrictank/api"
"github.com/grafana/metrictank/cluster"
"github.com/grafana/metrictank/idx"
"github.com/grafana/metrictank/idx/memory"
"github.com/grafana/metrictank/input"
inKafka "github.com/grafana/metrictank/input/kafkamdm"
"github.com/grafana/metrictank/logger"
"github.com/grafana/metrictank/mdata"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/schema/msg"
cassandraStore "github.com/grafana/metrictank/store/cassandra"
"github.com/grafana/metrictank/internal/cluster"
"github.com/grafana/metrictank/internal/idx"
"github.com/grafana/metrictank/internal/idx/memory"
"github.com/grafana/metrictank/internal/input"
inKafka "github.com/grafana/metrictank/internal/input/kafkamdm"
"github.com/grafana/metrictank/internal/mdata"
"github.com/grafana/metrictank/internal/schema"
"github.com/grafana/metrictank/internal/schema/msg"
cassandraStore "github.com/grafana/metrictank/internal/store/cassandra"
"github.com/grafana/metrictank/pkg/api"
"github.com/grafana/metrictank/pkg/logger"
"github.com/raintank/dur"
log "github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-control-server/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/gocql/gocql"
"github.com/grafana/globalconf"
"github.com/grafana/metrictank/cassandra"
"github.com/grafana/metrictank/internal/cassandra"
)

// CliConfig is a cassandra IdxConfig. It is instantiated with default values which can then be changed.
Expand Down
14 changes: 7 additions & 7 deletions cmd/mt-control-server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import (
"github.com/Shopify/sarama"
"github.com/gocql/gocql"
"github.com/grafana/globalconf"
"github.com/grafana/metrictank/api/models"
"github.com/grafana/metrictank/api/response"
"github.com/grafana/metrictank/cmd/mt-control-server/controlmodels"
"github.com/grafana/metrictank/expr/tagquery"
"github.com/grafana/metrictank/idx"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/schema/msg"
"github.com/grafana/metrictank/util"
"github.com/grafana/metrictank/internal/idx"
"github.com/grafana/metrictank/internal/schema"
"github.com/grafana/metrictank/internal/schema/msg"
"github.com/grafana/metrictank/internal/util"
"github.com/grafana/metrictank/pkg/api/models"
"github.com/grafana/metrictank/pkg/api/response"
"github.com/grafana/metrictank/pkg/expr/tagquery"
log "github.com/sirupsen/logrus"
"gopkg.in/macaron.v1"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-control-server/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/Shopify/sarama"
"github.com/grafana/globalconf"
"github.com/grafana/metrictank/kafka"
"github.com/grafana/metrictank/internal/kafka"
log "github.com/sirupsen/logrus"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/mt-explain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"os"
"time"

"github.com/grafana/metrictank/expr"
"github.com/grafana/metrictank/logger"
"github.com/grafana/metrictank/pkg/expr"
"github.com/grafana/metrictank/pkg/logger"
"github.com/raintank/dur"
log "github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/cmd/agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"time"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
"github.com/raintank/worldping-api/pkg/log"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/cmd/bad.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"time"

"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
"github.com/raintank/worldping-api/pkg/log"
"github.com/spf13/cobra"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/mt-fakemetrics/cmd/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (

"time"

"github.com/grafana/metrictank/clock"
"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/cmd/mt-fakemetrics/policy"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/clock"
"github.com/grafana/metrictank/internal/schema"
log "github.com/sirupsen/logrus"
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/mt-fakemetrics/cmd/datafeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"math"
"time"

"github.com/grafana/metrictank/clock"
"github.com/grafana/metrictank/cmd/mt-fakemetrics/metricbuilder"
"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/cmd/mt-fakemetrics/policy"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/clock"
"github.com/grafana/metrictank/internal/schema"
"github.com/raintank/worldping-api/pkg/log"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/cmd/resolutionchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"time"

"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/cmd/schemasbackfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

"github.com/grafana/metrictank/cmd/mt-fakemetrics/policy"
"github.com/grafana/metrictank/conf"
"github.com/grafana/metrictank/pkg/conf"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/cmd/storageconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"time"

"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/metricbuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"strconv"
"strings"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
)

type Builder interface {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/carbon/carbon.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
"github.com/raintank/met"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/fanout.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package out

import "github.com/grafana/metrictank/schema"
import "github.com/grafana/metrictank/internal/schema"

type multiErr struct {
errors []error
Expand Down
4 changes: 2 additions & 2 deletions cmd/mt-fakemetrics/out/gnet/gnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"time"

"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/schema/msg"
"github.com/grafana/metrictank/internal/schema"
"github.com/grafana/metrictank/internal/schema/msg"
"github.com/jpillora/backoff"
"github.com/raintank/met"
"github.com/raintank/worldping-api/pkg/log"
Expand Down
6 changes: 3 additions & 3 deletions cmd/mt-fakemetrics/out/kafkamdm/kafkamdm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"time"

"github.com/Shopify/sarama"
p "github.com/grafana/metrictank/cluster/partitioner"
"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/cmd/mt-fakemetrics/out/kafkamdm/keycache"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/schema/msg"
p "github.com/grafana/metrictank/internal/cluster/partitioner"
"github.com/grafana/metrictank/internal/schema"
"github.com/grafana/metrictank/internal/schema/msg"
"github.com/raintank/met"
log "github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/kafkamdm/keycache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package keycache
import (
"time"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
)

// Cache is a single-tenant keycache
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/kafkamdm/keycache/keycache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"time"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
)

// KeyCache tracks for all orgs, which keys have been seen, and when was the last time
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/kafkamdm/keycache/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"time"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
)

// SubKey is the last 15 bytes of a 16 byte Key
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/kafkamdm/keycache/shard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
)

func GetKey(suffix int) schema.Key {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/offsetfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package out
import (
"errors"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
"github.com/raintank/dur"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package out
import (
"fmt"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
"github.com/raintank/met"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/periodfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strconv"
"strings"

"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
)

type rule struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mt-fakemetrics/out/stdout/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

"github.com/grafana/metrictank/cmd/mt-fakemetrics/out"
"github.com/grafana/metrictank/schema"
"github.com/grafana/metrictank/internal/schema"
"github.com/raintank/met"
)

Expand Down
Loading