Skip to content

Conversation

carlosedp
Copy link
Contributor

These changes add support to Risc-V architecture.

Prometheus builds fine with Go Risc-V upstream project from https://github.com/4a6f656c/riscv-go/.

@carlosedp
Copy link
Contributor Author

Updated the PR with latest modules and fixed conflict on vendor dir.

@simonpasquier
Copy link
Member

To update the vendor directory, you can:

rm -rf vendor/
GO111MODULE=on go mod tidy
GO111MODULE=on go mod vendor

And commit the changes to vendor/

@carlosedp
Copy link
Contributor Author

@simonpasquier, this last commit is already updated like this. Contains all modules fetched by go mod.

@simonpasquier
Copy link
Member

You need to check again because the CI fails due to vendor not matching with what is declared in go.mod.

@carlosedp
Copy link
Contributor Author

Lets see, third time is a charm :D

@carlosedp
Copy link
Contributor Author

Ping @simonpasquier, I think it's ok now :)

@carlosedp
Copy link
Contributor Author

Any news on this?

@carlosedp
Copy link
Contributor Author

@simonpasquier rebased this.

go.mod Outdated
@@ -68,3 +68,5 @@ require (
)

replace k8s.io/klog => github.com/simonpasquier/klog-gokit v0.1.0

go 1.13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you ok if we wait for 1.13 to be released first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped this. My bad.

@carlosedp
Copy link
Contributor Author

@simonpasquier something wonky in the circleci test....

@carlosedp
Copy link
Contributor Author

No errors here:

➜ GO111MODULE=on go test -race -p 2 -mod=vendor ./...
ok  	github.com/prometheus/prometheus/cmd/prometheus	28.057s
ok  	github.com/prometheus/prometheus/cmd/promtool	1.064s
ok  	github.com/prometheus/prometheus/config	1.115s
ok  	github.com/prometheus/prometheus/discovery	4.093s
ok  	github.com/prometheus/prometheus/discovery/azure	1.035s
?   	github.com/prometheus/prometheus/discovery/config	[no test files]
ok  	github.com/prometheus/prometheus/discovery/consul	1.038s
ok  	github.com/prometheus/prometheus/discovery/dns	1.023s
?   	github.com/prometheus/prometheus/discovery/ec2	[no test files]
ok  	github.com/prometheus/prometheus/discovery/file	33.153s
?   	github.com/prometheus/prometheus/discovery/gce	[no test files]
ok  	github.com/prometheus/prometheus/discovery/kubernetes	5.861s
ok  	github.com/prometheus/prometheus/discovery/marathon	1.029s
ok  	github.com/prometheus/prometheus/discovery/openstack	1.057s
ok  	github.com/prometheus/prometheus/discovery/refresh	1.024s
ok  	github.com/prometheus/prometheus/discovery/targetgroup	0.151s
ok  	github.com/prometheus/prometheus/discovery/triton	1.041s
ok  	github.com/prometheus/prometheus/discovery/zookeeper	1.033s
ok  	github.com/prometheus/prometheus/documentation/examples/custom-sd/adapter	1.057s
?   	github.com/prometheus/prometheus/documentation/examples/custom-sd/adapter-usage	[no test files]
?   	github.com/prometheus/prometheus/documentation/examples/remote_storage/example_write_adapter	[no test files]
?   	github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter	[no test files]
ok  	github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/graphite	1.013s
ok  	github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/influxdb	1.026s
ok  	github.com/prometheus/prometheus/documentation/examples/remote_storage/remote_storage_adapter/opentsdb	1.022s
ok  	github.com/prometheus/prometheus/notifier	1.222s
?   	github.com/prometheus/prometheus/pkg/gate	[no test files]
ok  	github.com/prometheus/prometheus/pkg/labels	1.010s
ok  	github.com/prometheus/prometheus/pkg/logging	1.227s
?   	github.com/prometheus/prometheus/pkg/modtimevfs	[no test files]
?   	github.com/prometheus/prometheus/pkg/pool	[no test files]
ok  	github.com/prometheus/prometheus/pkg/relabel	1.025s
ok  	github.com/prometheus/prometheus/pkg/rulefmt	1.038s
?   	github.com/prometheus/prometheus/pkg/runtime	[no test files]
ok  	github.com/prometheus/prometheus/pkg/textparse	1.025s
?   	github.com/prometheus/prometheus/pkg/timestamp	[no test files]
?   	github.com/prometheus/prometheus/pkg/value	[no test files]
?   	github.com/prometheus/prometheus/prompb	[no test files]
ok  	github.com/prometheus/prometheus/promql	3.218s
ok  	github.com/prometheus/prometheus/rules	1.292s
ok  	github.com/prometheus/prometheus/scrape	5.322s
ok  	github.com/prometheus/prometheus/storage	1.023s
ok  	github.com/prometheus/prometheus/storage/remote	10.943s
ok  	github.com/prometheus/prometheus/storage/tsdb	1.075s
ok  	github.com/prometheus/prometheus/template	1.031s
ok  	github.com/prometheus/prometheus/util/httputil	1.030s
ok  	github.com/prometheus/prometheus/util/promlint	1.025s
ok  	github.com/prometheus/prometheus/util/stats	1.036s
ok  	github.com/prometheus/prometheus/util/strutil	1.013s
?   	github.com/prometheus/prometheus/util/testutil	[no test files]
?   	github.com/prometheus/prometheus/util/treecache	[no test files]
ok  	github.com/prometheus/prometheus/web	6.490s
ok  	github.com/prometheus/prometheus/web/api/v1	1.383s
?   	github.com/prometheus/prometheus/web/api/v2	[no test files]
?   	github.com/prometheus/prometheus/web/ui	[no test files]

@simonpasquier
Copy link
Member

I've retriggered the CI, thanks for your patience!

@carlosedp
Copy link
Contributor Author

All good now... thanks @simonpasquier :)

@carlosedp
Copy link
Contributor Author

@simonpasquier ping?

@carlosedp
Copy link
Contributor Author

Hey @simonpasquier , can I rebase this PR?

@simonpasquier
Copy link
Member

I guess that go.mod has versions which are recent enough now thanks to #5883.

golang.org/x/net v0.0.0-20190724013045-ca1201d0de80

golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a

Signed-off-by: CarlosEDP <me@carlosedp.com>
@tklauser
Copy link
Contributor

This should no longer be needed, the GOARCH specific Utsname string conversions have been removed in #5625 and can directly be used from golang.org/x/sys/unix as updated in #5883

@carlosedp
Copy link
Contributor Author

I just built from master with PR#5883 applied and it's GTG:

❯ ./prometheus --version                                                                                                                                                                   prometheus, version 2.12.0 (branch: master, revision: 21c978908335c68c79e471d8b33498d85deb8604)
  build user:       carlosedp@fedora-unleashed
  build date:       20190829-15:33:06
  go version:       devel +5919d4658c 8 days ago

❯ ./promtool --version                                                                                                                                                                     promtool, version 2.12.0 (branch: master, revision: 21c978908335c68c79e471d8b33498d85deb8604)
  build user:       carlosedp@fedora-unleashed
  build date:       20190829-15:33:06
  go version:       devel +5919d4658c 8 days ago

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@simonpasquier
Copy link
Member

@carlosedp so this PR can be closed?

@carlosedp
Copy link
Contributor Author

@simonpasquier yes, it builds correctly by using make build.
If I run just make, I get some problems on the linter by using Go 1.13:

❯ make
>> checking code style
>> checking license header
mkdir -p /Users/cdepaula/go/bin
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/v1.17.1/install.sh \
		| sed -e '/install -d/d' \
		| sh -s -- -b /Users/cdepaula/go/bin v1.17.1
golangci/golangci-lint info checking GitHub for tag 'v1.17.1'
golangci/golangci-lint info found version: 1.17.1 for v1.17.1/darwin/amd64
golangci/golangci-lint info installed /Users/cdepaula/go/bin/golangci-lint
>> running golangci-lint
GO111MODULE=on go list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
GO111MODULE=on /Users/cdepaula/go/bin/golangci-lint run  ./...
discovery/ec2/ec2.go:1: /Users/cdepaula/repos/riscv-go/src/fmt/scan.go:1200:16: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2015 The Prometheus Authors
discovery/gce/gce.go:1: /Users/cdepaula/repos/riscv-go/src/strconv/quote.go:405:12: ValidString not declared by package utf8 (typecheck)
// Copyright 2015 The Prometheus Authors
util/treecache/treecache.go:1: /Users/cdepaula/repos/riscv-go/src/fmt/scan.go:1200:16: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2016 The Prometheus Authors
discovery/config/config.go:1: vendor/github.com/prometheus/common/model/labels.go:161:14: ValidString not declared by package utf8 (typecheck)
// Copyright 2016 The Prometheus Authors
pkg/runtime/limits_default.go:1: /Users/cdepaula/repos/riscv-go/src/strconv/quote.go:405:12: ValidString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
tsdb/errors/errors.go:1: /Users/cdepaula/repos/riscv-go/src/fmt/scan.go:1200:16: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2016 The etcd Authors
tsdb/encoding/encoding.go:1: /Users/cdepaula/repos/riscv-go/src/unicode/utf8/utf8.go:28:8: expected ';', found b00000000 (typecheck)
// Copyright 2018 The Prometheus Authors
util/testutil/context.go:1: /Users/cdepaula/repos/riscv-go/src/bytes/reader.go:98:18: DecodeRune not declared by package utf8 (typecheck)
// Copyright 2016 The Prometheus Authors
util/teststorage/storage.go:1: /Users/cdepaula/repos/riscv-go/src/strconv/quote.go:405:12: ValidString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
prompb/remote.pb.go:1: /Users/cdepaula/repos/riscv-go/src/path/filepath/match.go:215:15: DecodeRuneInString not declared by package utf8 (typecheck)
// Code generated by protoc-gen-gogo. DO NOT EDIT.
web/ui/assets_vfsdata.go:1: /Users/cdepaula/repos/riscv-go/src/path/match.go:200:15: DecodeRuneInString not declared by package utf8 (typecheck)
// Code generated by vfsgen; DO NOT EDIT.
util/promlint/promlint.go:1: vendor/github.com/golang/protobuf/proto/text_parser.go:255:15: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
pkg/modtimevfs/modtimevfs.go:1: /Users/cdepaula/repos/riscv-go/src/bufio/scan.go:395:19: DecodeRune not declared by package utf8 (typecheck)
// Copyright 2018 The Prometheus Authors
tsdb/cmd/tsdb/main.go:1: /Users/cdepaula/repos/riscv-go/src/strings/strings.go:980:20: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
cmd/prometheus/main.go:1: /Users/cdepaula/repos/riscv-go/src/path/filepath/match.go:215:15: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2015 The Prometheus Authors
promql/query_logger.go:133:13: RuneStart not declared by package utf8 (typecheck)
		for !utf8.RuneStart(bytesStr[size]) {
		          ^
cmd/promtool/archive.go:1: /Users/cdepaula/repos/riscv-go/src/strings/strings.go:980:20: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2015 The Prometheus Authors
discovery/manager.go:1: /Users/cdepaula/repos/riscv-go/src/strings/strings.go:980:20: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2016 The Prometheus Authors
discovery/azure/azure.go:1: vendor/github.com/prometheus/common/model/labels.go:161:14: ValidString not declared by package utf8 (typecheck)
// Copyright 2015 The Prometheus Authors
util/strutil/quote.go:102:19: DecodeRuneInString not declared by package utf8 (typecheck)
		r, size := utf8.DecodeRuneInString(s)
		                ^
util/strutil/quote.go:74:14: EncodeRune not declared by package utf8 (typecheck)
			n := utf8.EncodeRune(runeTmp[:], c)
			          ^
discovery/consul/consul.go:1: vendor/github.com/prometheus/client_golang/prometheus/registry.go:869:12: ValidString not declared by package utf8 (typecheck)
// Copyright 2015 The Prometheus Authors
discovery/targetgroup/targetgroup.go:1: /Users/cdepaula/repos/riscv-go/src/encoding/json/fold.go:83:20: DecodeRune not declared by package utf8 (typecheck)
// Copyright 2013 The Prometheus Authors
discovery/zookeeper/zookeeper.go:1: /Users/cdepaula/repos/riscv-go/src/unicode/utf8/utf8.go:28:8: expected ';', found b00000000 (typecheck)
// Copyright 2015 The Prometheus Authors
notifier/notifier.go:1: /Users/cdepaula/repos/riscv-go/src/path/match.go:200:15: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2013 The Prometheus Authors
pkg/labels/labels.go:1: /Users/cdepaula/repos/riscv-go/src/encoding/json/fold.go:83:20: DecodeRune not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
pkg/relabel/relabel.go:1: /Users/cdepaula/repos/riscv-go/src/path/match.go:200:15: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2015 The Prometheus Authors
promql/lex.go:345:15: DecodeRuneInString not declared by package utf8 (typecheck)
	r, w := utf8.DecodeRuneInString(l.input[l.pos:])
	             ^
pkg/rulefmt/rulefmt.go:1: /Users/cdepaula/repos/riscv-go/src/strings/strings.go:789:19: DecodeLastRuneInString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
pkg/textparse/promparse.go:383:12: Valid not declared by package utf8 (typecheck)
		if !utf8.Valid(p.l.buf()) {
		         ^
rules/alerting.go:1: vendor/gopkg.in/yaml.v2/encode.go:305:13: ValidString not declared by package utf8 (typecheck)
// Copyright 2013 The Prometheus Authors
scrape/manager.go:1: /Users/cdepaula/repos/riscv-go/src/bytes/reader.go:98:18: DecodeRune not declared by package utf8 (typecheck)
// Copyright 2013 The Prometheus Authors
storage/tsdb/tsdb.go:1: /Users/cdepaula/repos/riscv-go/src/regexp/regexp.go:967:22: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
storage/tsdb/tsdb_test.go:1: /Users/cdepaula/repos/riscv-go/src/vendor/golang.org/x/net/idna/idna10.0.0.go:420:17: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
tsdb/block.go:1: /Users/cdepaula/repos/riscv-go/src/regexp/regexp.go:967:22: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
tsdb/labels/labels.go:1: /Users/cdepaula/repos/riscv-go/src/path/filepath/match.go:215:15: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2017 The Prometheus Authors
tsdb/wal/live_reader.go:1: /Users/cdepaula/repos/riscv-go/src/bytes/reader.go:98:18: DecodeRune not declared by package utf8 (typecheck)
// Copyright 2019 The Prometheus Authors
util/httputil/compression.go:1: /Users/cdepaula/repos/riscv-go/src/regexp/regexp.go:967:22: DecodeRuneInString not declared by package utf8 (typecheck)
// Copyright 2013 The Prometheus Authors
web/api/v1/api.go:1: vendor/github.com/prometheus/common/model/labels.go:161:14: ValidString not declared by package utf8 (typecheck)
// Copyright 2016 The Prometheus Authors
make: *** [common-lint] Error 1

Other than that, it can be closed.

@carlosedp carlosedp closed this Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants