Add timeinfo to health data (#14013)

Capture RoundtripDuration to figure out 
NTP issues in subnet health analyzer.
This commit is contained in:
Shireesh Anjal
2022-01-06 15:21:10 +05:30
committed by GitHub
parent 89441a22aa
commit c27110e37d
4 changed files with 15 additions and 2 deletions
+9
View File
@@ -422,12 +422,21 @@ func (client *peerRESTClient) GetSELinuxInfo(ctx context.Context) (info madmin.S
// GetSysConfig - fetch sys config for a remote node.
func (client *peerRESTClient) GetSysConfig(ctx context.Context) (info madmin.SysConfig, err error) {
sent := time.Now()
respBody, err := client.callWithContext(ctx, peerRESTMethodSysConfig, nil, nil, -1)
if err != nil {
return
}
roundtrip := int32(time.Since(sent).Milliseconds())
defer http.DrainBody(respBody)
err = gob.NewDecoder(respBody).Decode(&info)
cfg := info.Config["time-info"]
if cfg != nil {
ti := cfg.(madmin.TimeInfo)
ti.RoundtripDuration = roundtrip
info.Config["time-info"] = ti
}
return info, err
}