diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml
index c3e033f..d506e20 100644
--- a/.github/workflows/goreleaser.yml
+++ b/.github/workflows/goreleaser.yml
@@ -2,7 +2,7 @@ name: goreleaser
on:
push:
- # not not consider simplec commit
+ # do not consider simple commit
branches:
- '!*'
# consider only release and pre-release tags
@@ -36,7 +36,7 @@ jobs:
run: |
go mod vendor
if [ ! -z "$(git status --porcelain)" ]; then
- echo "::error::vendor directory if not synched with go.mod, please run go mod vendor"
+ echo "::error::vendor directory if not synced with go.mod, please run go mod vendor"
exit 1
fi
diff --git a/README.md b/README.md
index 8c4b96f..0e77579 100644
--- a/README.md
+++ b/README.md
@@ -55,7 +55,7 @@ uaac client add prometheus-credhub \
### Flags
| Flag / Environment Variable | Required | Default | Description |
-| --------------------------- | -------- | ------- | ----------- |
+|-----------------------------------------------------------------------------|----------|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `credhub.api_url`
`CREDHUB_EXPORTER_API_URL` | Yes | | Credhub API URL |
| `credhub.client-id`
`CREDHUB_EXPORTER_CLIENT_ID` | Yes | | Credhub Client ID (must have the `credhub.read` scope) |
| `credhub.client-secret`
`CREDHUB_EXPORTER_CLIENT_SECRET` | Yes | | Credhub Client Secret |
@@ -82,11 +82,11 @@ uaac client add prometheus-credhub \
The exporter returns the following credhub objects metrics:
-| Metric | Description | Labels |
-| ------ | ----------- | ------ |
-| *metrics.namespace*_credential_created_at | Unix timestamp of the creation of the last version of a given credential | `deployment`, `environment`, `id`, `name`, `path` |
-| *metrics.namespace*_certificate_expires_at | Unix timestamp of the expiration time of a given certificate | `deployment`, `environment`, `id`, `name`, `path`, `index` |
-| *metrics.namespace*_last_scrap_error | Number of credentials that the exporter failed to read during last scrape | `deployment`, `environment` |
+| Metric | Description | Labels |
+|--------------------------------------------|---------------------------------------------------------------------------|------------------------------------------------------------|
+| *metrics.namespace*_credential_created_at | Unix timestamp of the creation of the last version of a given credential | `deployment`, `environment`, `id`, `name`, `path` |
+| *metrics.namespace*_certificate_expires_at | Unix timestamp of the expiration time of a given certificate | `deployment`, `environment`, `id`, `name`, `path`, `index` |
+| *metrics.namespace*_last_scrap_error | Number of credentials that the exporter failed to read during last scrape | `deployment`, `environment` |
## Contributing
diff --git a/collector.go b/collector.go
index 8a5fd10..84b1306 100644
--- a/collector.go
+++ b/collector.go
@@ -87,7 +87,7 @@ func NewCredhubCollector(
},
)
- lastScrapeTimesptampMetric := promauto.NewGauge(
+ lastScrapeTimestampMetric := promauto.NewGauge(
prometheus.GaugeOpts{
Namespace: "credhub",
Subsystem: "",
@@ -105,7 +105,7 @@ func NewCredhubCollector(
credentialMetrics: credentialMetrics,
certificateExpiresMetrics: certificateExpiresMetrics,
scrapeErrorMetric: scrapeErrorMetric,
- lastScrapeTimestampMetric: lastScrapeTimesptampMetric,
+ lastScrapeTimestampMetric: lastScrapeTimestampMetric,
}
}
diff --git a/credhub_exporter.go b/credhub_exporter.go
index 323b622..c25cfdf 100644
--- a/credhub_exporter.go
+++ b/credhub_exporter.go
@@ -4,12 +4,11 @@ import (
"code.cloudfoundry.org/credhub-cli/credhub"
"code.cloudfoundry.org/credhub-cli/credhub/auth"
"encoding/json"
+ "github.com/alecthomas/kingpin/v2"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
- log "github.com/sirupsen/logrus"
"github.com/prometheus/common/version"
- "github.com/alecthomas/kingpin/v2"
- "io/ioutil"
+ log "github.com/sirupsen/logrus"
"net/http"
"os"
"regexp"
@@ -181,7 +180,7 @@ func main() {
}
if len(*caCertPath) != 0 {
- b, err := ioutil.ReadFile(*caCertPath)
+ b, err := os.ReadFile(*caCertPath)
if err != nil {
log.Errorf("unable to read file '%s' : %s", *caCertPath, err.Error())
os.Exit(1)
diff --git a/go.mod b/go.mod
index eecbcea..a6b76b7 100644
--- a/go.mod
+++ b/go.mod
@@ -5,10 +5,10 @@ go 1.21
toolchain go1.21.1
require (
- code.cloudfoundry.org/credhub-cli v0.0.0-20230904130630-06d67d32ae64
+ code.cloudfoundry.org/credhub-cli v0.0.0-20230912005203-ed177c58e40c
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
- github.com/cloudfoundry/socks5-proxy v0.2.98 // indirect
+ github.com/cloudfoundry/socks5-proxy v0.2.99 // indirect
github.com/prometheus/client_golang v1.16.0
github.com/prometheus/common v0.44.0
github.com/prometheus/procfs v0.11.1 // indirect
diff --git a/go.sum b/go.sum
index 910286e..f7d8bf2 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,5 @@
-code.cloudfoundry.org/credhub-cli v0.0.0-20230904130630-06d67d32ae64 h1://dslNKYTsx09TNkMk6K9a9LFGLRNn4iLHleCKZlUoo=
-code.cloudfoundry.org/credhub-cli v0.0.0-20230904130630-06d67d32ae64/go.mod h1:9e1UNuSJ9jtOAHqAL79eMy+e0xeiaDVon4N5T+12Dw0=
+code.cloudfoundry.org/credhub-cli v0.0.0-20230912005203-ed177c58e40c h1:jFBCo2KEgFOS6hvz6dca0C8r74eLsRpddd73y1hkDzw=
+code.cloudfoundry.org/credhub-cli v0.0.0-20230912005203-ed177c58e40c/go.mod h1:633M1ipkGr9Ee1EkvPBycAwzHKgxAbdRs8KRpVm8V0U=
github.com/alecthomas/kingpin/v2 v2.3.2 h1:H0aULhgmSzN8xQ3nX1uxtdlTHYoPLu5AhHxWrKI6ocU=
github.com/alecthomas/kingpin/v2 v2.3.2/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
@@ -10,8 +10,8 @@ github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e h1:FQdRViaoDphGRfgrotl2QGsX1gbloe57dbGBS5CG6KY=
github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e/go.mod h1:PXmcacyJB/pJjSxEl15IU6rEIKXrhZQRzsr0UTkgNNs=
-github.com/cloudfoundry/socks5-proxy v0.2.98 h1:4GUMQiZyaVLwxW6CU0UnvAjGf3lDeYVG2bTbNGHlqmw=
-github.com/cloudfoundry/socks5-proxy v0.2.98/go.mod h1:6qsLU3SzzMGC+3+0ptjYsJQLAByGlwH2R7DI/nE1eIA=
+github.com/cloudfoundry/socks5-proxy v0.2.99 h1:oT9M+rTPKYCGN2wbEyMlFA4dFPuVZdmZ0MVfClkn0uc=
+github.com/cloudfoundry/socks5-proxy v0.2.99/go.mod h1:6NScNf+YlmTwIBaXYymjd8O4uzQeLYTdvao6MVVpRDU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -28,8 +28,8 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/google/pprof v0.0.0-20230901174712-0191c66da455 h1:YhRUmI1ttDC4sxKY2V62BTI8hCXnyZBV9h38eAanInE=
-github.com/google/pprof v0.0.0-20230901174712-0191c66da455/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
+github.com/google/pprof v0.0.0-20230907193218-d3ddc7976beb h1:LCMfzVg3sflxTs4UvuP4D8CkoZnfHLe2qzqgDn/4OHs=
+github.com/google/pprof v0.0.0-20230907193218-d3ddc7976beb/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
@@ -73,8 +73,8 @@ golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
-golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
-golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
+golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
+golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 4ad9a8e..f8a3a3a 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,4 +1,4 @@
-# code.cloudfoundry.org/credhub-cli v0.0.0-20230904130630-06d67d32ae64
+# code.cloudfoundry.org/credhub-cli v0.0.0-20230912005203-ed177c58e40c
## explicit; go 1.21
code.cloudfoundry.org/credhub-cli/credhub
code.cloudfoundry.org/credhub-cli/credhub/auth
@@ -24,7 +24,7 @@ github.com/cespare/xxhash/v2
# github.com/cloudfoundry/go-socks5 v0.0.0-20180221174514-54f73bdb8a8e
## explicit
github.com/cloudfoundry/go-socks5
-# github.com/cloudfoundry/socks5-proxy v0.2.98
+# github.com/cloudfoundry/socks5-proxy v0.2.99
## explicit; go 1.21
github.com/cloudfoundry/socks5-proxy
# github.com/golang/protobuf v1.5.3