Skip to content

Commit

Permalink
Merge e02ef73 into backport/b-25181-consul-fingerprint-logs/absolutel…
Browse files Browse the repository at this point in the history
…y-lucky-mongoose
  • Loading branch information
hc-github-team-nomad-core authored Feb 21, 2025
2 parents 77bffda + e02ef73 commit ca198c0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/fingerprint/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ type consulState struct {
// tracks that we've successfully fingerprinted this cluster at least once
// since the last Fingerprint call
fingerprintedOnce bool

// we currently can't disable Consul fingerprinting, so for users who aren't
// using it we want to make sure we report the periodic failure only once
reportedOnce bool
}

// valueReader is used to parse out one attribute from consulInfo. Returns
Expand Down Expand Up @@ -225,9 +229,15 @@ func (cfs *consulState) query(logger hclog.Logger) agentconsul.Self {
// If we can't hit this URL consul is probably not running on this machine.
info, err := cfs.client.Agent().Self()
if err != nil {
if cfs.reportedOnce {
return nil
}
cfs.reportedOnce = true
logger.Warn("failed to acquire consul self endpoint", "error", err)
return nil
}

cfs.reportedOnce = false
return info
}

Expand Down

0 comments on commit ca198c0

Please sign in to comment.