Skip to content

Commit

Permalink
helm chart fixes (#102)
Browse files Browse the repository at this point in the history
* Adding Error Counter Metric

* Adding Semver Prefix and fix typo
  • Loading branch information
davidcollom committed Jul 12, 2023
1 parent 04d9736 commit 9185224
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deploy/charts/version-checker/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
appVersion: "v0.2.2"
version: 0.2.3
version: v0.2.3
description: A Helm chart for version-checker
home: https://github.com/jetstack/verison-checker
home: https://github.com/jetstack/version-checker
name: version-checker
maintainers:
- name: davidcollom
13 changes: 13 additions & 0 deletions pkg/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Metrics struct {

registry *prometheus.Registry
containerImageVersion *prometheus.GaugeVec
containerImageErrors *prometheus.CounterVec
log *logrus.Entry

// container cache stores a cache of a container's current image, version,
Expand All @@ -47,14 +48,26 @@ func New(log *logrus.Entry) *Metrics {
"namespace", "pod", "container", "image", "current_version", "latest_version",
},
)
containerImageErrors := prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "version_checker",
Name: "image_failures",
Help: "Where the version-checker was unable to get the latest upstream registry version",
},
[]string{
"namespace", "pod", "container", "image",
},
)

registry := prometheus.NewRegistry()
registry.MustRegister(containerImageVersion)
registry.MustRegister(containerImageErrors)

return &Metrics{
log: log.WithField("module", "metrics"),
registry: registry,
containerImageVersion: containerImageVersion,
containerImageErrors: containerImageErrors,
containerCache: make(map[string]cacheItem),
}
}
Expand Down

0 comments on commit 9185224

Please sign in to comment.