Skip to content

Commit

Permalink
metrics: always resolve all versions
Browse files Browse the repository at this point in the history
Do not bail-out in case of failure to resolve any of the sub-component
versions but rather defer this failure to final status code. Required in
order to avoid partial versions-view as part of exported status metric.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
  • Loading branch information
synarete committed Aug 5, 2024
1 parent f29cb81 commit 03ba0ec
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/metrics/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,26 @@ func UpdateDefaultVersions(version, commitid string) {
// ResolveVersions is a best-effort to resolve current pod's versions info
func ResolveVersions(clnt *kclient) (Versions, error) {
var err error
var status error
vers := Versions{
Version: defaultVersions.Version,
CommitID: defaultVersions.CommitID,
}
if clnt != nil {
vers.SambaImage, err = resolveSambaImage(clnt)
if err != nil {
return vers, err
status = err
}
}
vers.SambaVersion, err = resolveSambaVersion()
if err != nil {
return vers, err
if err != nil && status != nil {
status = err
}
vers.CtdbVersion, err = resolveCtdbVersion()
if err != nil {
return vers, err
if err != nil && status != nil {
status = err
}
return vers, nil
return vers, status
}

func resolveSambaImage(clnt *kclient) (string, error) {
Expand Down

0 comments on commit 03ba0ec

Please sign in to comment.