hubble/relay: fix uptime value in ServerStatus implementation #23966
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hubble Relay implements Hubble's
observer.ServerStatus
endpoint from a cluster-wide perspective. It forwardsServerStatus
requests to Hubble peers in the cluster and aggregates the responses. However, while the total number of seen flows can be accumulated, the uptime value cannot. Therefore, the intent for Relay's implementation ofServerStatus
regarding the uptime value was to return the uptime of the oldest running Hubble server in the cluster. However, the implementation is wrong and Relay reports the newest uptime from all the nodes in the cluster.In both the Hubble CLI and Hubble UI, the flow rate is reported as the number of flows per second, e.g. when
hubble status
, which is computed as the number of seen flows divided by the uptime. As you can imagine, the flows/s rate would be very wrong when a Hubble server is restarted as the accumulated seen flows in the cluster would be a large number while the uptime, because of the bug mentioned above, would be a very small number resulting in wrong reporting of the flows rate.This patch fixes this bug by correctly reporting the oldest uptime from all connected Hubble peers instead of the newest one.
Fixes: cilium/hubble#911