Skip to content

Commit

Permalink
Fix prom-migrator proto enum panic.
Browse files Browse the repository at this point in the history
Signed-off-by: Harkishen-Singh <[email protected]>

This commit fixes the duplicate proto enum registration panic
in prom-migrator. This is done by removing all imports from Promscale
which prevents the duplicate registration of the commonly imported
`prompb` package by both Promscale and Prom-migrator.
  • Loading branch information
Harkishen-Singh committed May 27, 2022
1 parent e607a43 commit d8ed757
Show file tree
Hide file tree
Showing 12 changed files with 176 additions and 1,076 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ build: generate
test: unit e2e upgrade-test

.PHONY: unit
unit: generate
unit: generate prom-migrator
go test -v -race $(shell go list ./... | grep -v tests/end_to_end_tests | grep -v tests/upgrade_tests) -timeout 40m

.PHONY: prom-migrator
prom-migrator:
cd migration-tool && go test -v -race ./...

# traces-dataset.sz is used by ./pkg/tests/end_to_end_tests/ingest_trace_test.go
pkg/tests/testdata/traces-dataset.sz:
wget https://github.com/timescale/promscale-test-data/raw/main/traces-dataset.sz -O ./pkg/tests/testdata/traces-dataset.sz
Expand Down
11 changes: 6 additions & 5 deletions migration-tool/cmd/prom-migrator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import (
"time"

"github.com/inhies/go-bytesize"

"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/promql/parser"
"github.com/timescale/promscale/migration-tool/pkg/log"
plan "github.com/timescale/promscale/migration-tool/pkg/planner"
"github.com/timescale/promscale/migration-tool/pkg/reader"
"github.com/timescale/promscale/migration-tool/pkg/utils"
"github.com/timescale/promscale/migration-tool/pkg/writer"
"github.com/timescale/promscale/pkg/log"
"github.com/timescale/promscale/pkg/version"
)

const (
Expand All @@ -35,6 +35,7 @@ const (
defaultStartTime = "1970-01-01T00:00:00+00:00" // RFC3339 based time.Unix from 0 seconds.
defaultMaxReadDuration = time.Hour * 2
defaultLaIncrement = time.Minute
version = "0.0.4"
)

// timeNowUnix returns the current Unix timestamp.
Expand Down Expand Up @@ -82,11 +83,11 @@ func main() {
parseFlags(conf, os.Args[1:])

if err := log.Init(log.Config{Format: "logfmt", Level: "debug"}); err != nil {
fmt.Println("Version: ", version.PromMigrator)
fmt.Println("Version: ", version)
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
log.Info("Version", version.PromMigrator)
log.Info("Version", version)
if err := validateConf(conf); err != nil {
log.Error("msg", "could not parse flags", "error", err)
os.Exit(1)
Expand Down Expand Up @@ -319,7 +320,7 @@ func parseArgs(args []string) (shouldProceed bool) {
switch f {
case "version":
shouldProceed = false
fmt.Println(version.PromMigrator)
fmt.Println(version)
}
}
return
Expand Down
34 changes: 21 additions & 13 deletions migration-tool/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.17

require (
github.com/cespare/xxhash/v2 v2.1.2
github.com/go-kit/log v0.2.0
github.com/gogo/protobuf v1.3.2
github.com/golang/snappy v0.0.4
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf
Expand All @@ -13,52 +14,59 @@ require (
github.com/prometheus/prometheus v1.8.2-0.20220117154355-4855a0c067e2
github.com/schollz/progressbar/v3 v3.8.6
github.com/stretchr/testify v1.7.1
github.com/timescale/promscale v0.0.0-20220427110101-f90d8d289c66
)

require (
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/aws/aws-sdk-go v1.42.31 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490 // indirect
github.com/containerd/containerd v1.5.9 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/pgx/v4 v4.15.1-0.20220219175125-b6b24f9e8a5d // indirect
github.com/jackc/puddle v1.2.1 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common/sigv4 v0.1.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.6.2 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220217155828-d576998c0009 // indirect
google.golang.org/grpc v1.46.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Expand Down
Loading

0 comments on commit d8ed757

Please sign in to comment.