blakelead / couchbase_exporter

Export metrics from Couchbase Server for Prometheus consumption
Other
35 stars 18 forks source link

couchbase_export build failed #42

Closed zouzc closed 5 years ago

zouzc commented 5 years ago

go build

github.com/leansys-team/couchbase_exporter

./couchbase_exporter.go:62:3: unknown field 'TLSEnabled' in struct literal of type collector.Context ./couchbase_exporter.go:63:3: unknown field 'TLSSkipInsecure' in struct literal of type collector.Context ./couchbase_exporter.go:64:3: unknown field 'TLSCACert' in struct literal of type collector.Context ./couchbase_exporter.go:65:3: unknown field 'TLSClientCert' in struct literal of type collector.Context ./couchbase_exporter.go:66:3: unknown field 'TLSClientKey' in struct literal of type collector.Context

go mod collector source is not new

diff collector/common.go /mnt/e/go/dev/pkg/mod/github.com/blakelead/couchbase_exporter@v0.0.0-20190619133003-7860afde272f/collector/common.go 9,10d8 < "crypto/tls" < "crypto/x509" 40,52c38,45 < URI string < Username string < Password string < Timeout time.Duration < ScrapeCluster bool < ScrapeNode bool < ScrapeBucket bool < ScrapeXDCR bool < TLSEnabled bool < TLSSkipInsecure bool < TLSCACert string < TLSClientCert string < TLSClientKey string

  URI           string
  Username      string
  Password      string
  Timeout       time.Duration
  ScrapeCluster bool
  ScrapeNode    bool
  ScrapeBucket  bool
  ScrapeXDCR    bool

121,128d113 < tlsClientConfig := &tls.Config{} < if c.TLSEnabled { < tlsClientConfig, err = createTLSClientConfig(c) < if err != nil { < log.Error(err) < } < } < 130,136c115 < client := http.Client{ < Timeout: c.Timeout, < Transport: &http.Transport{ < TLSClientConfig: tlsClientConfig, < }, < } <

  client := http.Client{Timeout: c.Timeout}

138d116 < 143d120 < 266,288d242 < } < < // createTLSClientConfig loads certificates and create TLS config < func createTLSClientConfig(c Context) (*tls.Config, error) { < caCert, err := ioutil.ReadFile(c.TLSCACert) < if err != nil { < return nil, err < } < certPool := x509.NewCertPool() < certPool.AppendCertsFromPEM(caCert) < < keyPair, err := tls.LoadX509KeyPair(c.TLSClientCert, c.TLSClientKey) < if err != nil { < return nil, err < } < < config := tls.Config{ < Certificates: []tls.Certificate{keyPair}, < ClientCAs: certPool, < InsecureSkipVerify: c.TLSSkipInsecure, < } < < return &config, nil

blakelead commented 5 years ago

Hello @zouzc

Thanks for opening this issue, I'll try my best to help.

Could you give me more details, like which version of the exporter are you trying to build? Also, it would be great if you'd better formulate your question because I have trouble understanding it, to be honest.

zouzc commented 5 years ago

go version go version go1.12.9 linux/amd64

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"

$git branch

blakelead commented 5 years ago

Thanks, @zouzc and sorry for the delay.

I reproduced the bug, and I fixed it in master branch. Could you test again, please?