mirror of
https://github.com/bloomberg/goldpinger.git
synced 2026-08-23 21:36:25 +00:00
Add a ping time that gives the last time a node was pinged
Signed-off-by: Sachin Kamboj <skamboj1@bloomberg.net>
This commit is contained in:
@@ -86,6 +86,7 @@ func (p *Pinger) getClient() (*apiclient.Goldpinger, error) {
|
||||
p.resultsChan <- PingAllPodsResult{
|
||||
podName: p.pod.Name,
|
||||
podResult: models.PodResult{
|
||||
PingTime: strfmt.DateTime(time.Now()),
|
||||
PodIP: p.podIPv4,
|
||||
HostIP: p.hostIPv4,
|
||||
OK: &OK,
|
||||
@@ -124,6 +125,7 @@ func (p *Pinger) Ping() {
|
||||
p.resultsChan <- PingAllPodsResult{
|
||||
podName: p.pod.Name,
|
||||
podResult: models.PodResult{
|
||||
PingTime: strfmt.DateTime(start),
|
||||
PodIP: p.podIPv4,
|
||||
HostIP: p.hostIPv4,
|
||||
OK: &OK,
|
||||
@@ -137,6 +139,7 @@ func (p *Pinger) Ping() {
|
||||
p.resultsChan <- PingAllPodsResult{
|
||||
podName: p.pod.Name,
|
||||
podResult: models.PodResult{
|
||||
PingTime: strfmt.DateTime(start),
|
||||
PodIP: p.podIPv4,
|
||||
HostIP: p.hostIPv4,
|
||||
OK: &OK,
|
||||
|
||||
@@ -24,6 +24,10 @@ type PodResult struct {
|
||||
// o k
|
||||
OK *bool `json:"OK,omitempty"`
|
||||
|
||||
// ping time
|
||||
// Format: date-time
|
||||
PingTime strfmt.DateTime `json:"PingTime,omitempty"`
|
||||
|
||||
// pod IP
|
||||
// Format: ipv4
|
||||
PodIP strfmt.IPv4 `json:"PodIP,omitempty"`
|
||||
@@ -49,6 +53,10 @@ func (m *PodResult) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePingTime(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validatePodIP(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -76,6 +84,19 @@ func (m *PodResult) validateHostIP(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PodResult) validatePingTime(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.PingTime) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := validate.FormatOf("PingTime", "body", "date-time", m.PingTime.String(), formats); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PodResult) validatePodIP(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.PodIP) { // not required
|
||||
|
||||
@@ -259,6 +259,10 @@ func init() {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"PingTime": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"PodIP": {
|
||||
"type": "string",
|
||||
"format": "ipv4"
|
||||
@@ -527,6 +531,10 @@ func init() {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"PingTime": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"PodIP": {
|
||||
"type": "string",
|
||||
"format": "ipv4"
|
||||
|
||||
@@ -37,6 +37,9 @@ definitions:
|
||||
OK:
|
||||
type: boolean
|
||||
default: false
|
||||
PingTime:
|
||||
format: date-time
|
||||
type: string
|
||||
PodIP:
|
||||
type: string
|
||||
format: ipv4
|
||||
|
||||
Reference in New Issue
Block a user