Write deployment id to health report at the start (#14673)

The deployment id was being written to the health report towards the end
of the handler. Because of this, if there was a timeout in any of the
data fetching, the deployment id was not getting written at all. Upload
of such reports fails on SUBNET as deployment id is the unique
identifier for a cluster in subnet.

Fixed by writing the deployment id at the beginning of the processing.
This commit is contained in:
Shireesh Anjal 2022-04-04 01:45:02 +05:30 committed by GitHub
parent 165d60421d
commit 7c696e1cb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1663,7 +1663,14 @@ func (a adminAPIHandlers) HealthInfoHandler(w http.ResponseWriter, r *http.Reque
}
query := r.Form
healthInfo := madmin.HealthInfo{Version: madmin.HealthInfoVersion}
healthInfo := madmin.HealthInfo{
Version: madmin.HealthInfoVersion,
Minio: madmin.MinioHealthInfo{
Info: madmin.MinioInfo{
DeploymentID: globalDeploymentID,
},
},
}
healthInfoCh := make(chan madmin.HealthInfo)
enc := json.NewEncoder(w)
@ -1999,7 +2006,7 @@ func (a adminAPIHandlers) HealthInfoHandler(w http.ResponseWriter, r *http.Reque
go func() {
defer close(healthInfoCh)
partialWrite(healthInfo) // Write first message with only version populated
partialWrite(healthInfo) // Write first message with only version and deployment id populated
getAndWriteCPUs()
getAndWritePartitions()
getAndWriteOSInfo()