timescale / prometheus-postgresql-adapter

Use PostgreSQL as a remote storage database for Prometheus
Apache License 2.0
335 stars 66 forks source link

Unable to build adapter #18

Closed lgwapnitsky closed 6 years ago

lgwapnitsky commented 6 years ago

I was able to build this adapter previously on a CentOS system with a little hoop-jumping.

My environment uses Ubuntu for our standard services, and I've been having issues building the adapter for non-docker use. The issue, whether using dep or go get is with the libraries in github.com/go-stack/stack.

(barebones install)

~$ go get github.com/timescale/prometheus-postgresql-adapter
go build github.com/go-stack/stack: no buildable Go source files in /home/user/go/src/github.com/go-stack/stack
# github.com/lib/pq
go/src/github.com/lib/pq/notify.go:787: undefined: time.Until
# github.com/prometheus/prometheus/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime
go/src/github.com/prometheus/prometheus/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go:149: r.Context undefined (type *http.Request has no field or method Context)

Same thing occurs when using dep and the Makefile

user@labmon1:~/go/src$ cd prometheus-postgresql-adapter/
user@labmon1:~/go/src/prometheus-postgresql-adapter$ ls
Dockerfile  Gopkg.lock  Gopkg.toml  LICENSE  main.go  Makefile  postgresql  README.md  sample-docker-prometheus.yml
user@labmon1:~/go/src/prometheus-postgresql-adapter$ $GOBIN/dep ensure
user@labmon1:~/go/src/prometheus-postgresql-adapter$ make
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo --ldflags '-w' -o prometheus-postgresql-adapter main.go
vendor/github.com/go-kit/kit/log/value.go:6:2: no buildable Go source files in /home/user/go/src/prometheus-postgresql-adapter/vendor/github.com/go-stack/stack
Makefile:30: recipe for target 'prometheus-postgresql-adapter' failed
make: *** [prometheus-postgresql-adapter] Error 1

Please advise, Thank you

CassDBA commented 6 years ago

I was able to get file working with following steps git clone https://github.com/timescale/prometheus-postgresql-adapter.git cd prometheus-postgresql-adapter go install

8-bitLincoln commented 6 years ago

I had same error when I had installed go from Ubuntu repositories. Try to install last version from https://golang.org/dl/