use time.Time for node events for compatibility

This commit is contained in:
Chelsea Holland Komlo
2018-03-27 13:22:29 -04:00
parent 6e35eec31e
commit 041786360e
5 changed files with 6 additions and 5 deletions

View File

@@ -212,7 +212,7 @@ type NodeEvent struct {
Message string
Subsystem string
Details map[string]string
Timestamp int64
Timestamp time.Time
CreateIndex uint64
}

View File

@@ -1069,7 +1069,7 @@ func (c *Client) updateNodeFromDriver(name string, fingerprint, health *structs.
event := &structs.NodeEvent{
Subsystem: "Driver",
Message: health.HealthDescription,
Timestamp: time.Now().Unix(),
Timestamp: time.Now(),
}
c.triggerNodeEvent(event)
}

View File

@@ -429,7 +429,7 @@ func (c *NodeStatusCommand) outputNodeEvent(events []*api.NodeEvent) {
}
for i, event := range events {
timestamp := formatTime(time.Unix(event.Timestamp, 0))
timestamp := formatTime(event.Timestamp)
subsystem := event.Subsystem
msg := event.Message
if c.verbose {

View File

@@ -6,6 +6,7 @@ import (
"io"
"log"
"sort"
"time"
"github.com/hashicorp/go-memdb"
multierror "github.com/hashicorp/go-multierror"
@@ -538,7 +539,7 @@ func (s *StateStore) UpsertNode(index uint64, node *structs.Node) error {
nodeEvent := &structs.NodeEvent{
Message: "Node Registered",
Subsystem: "Cluster",
Timestamp: node.StatusUpdatedAt,
Timestamp: time.Unix(node.StatusUpdatedAt, 0),
}
node.Events = []*structs.NodeEvent{nodeEvent}
node.CreateIndex = index

View File

@@ -1188,7 +1188,7 @@ type NodeEvent struct {
Message string
Subsystem string
Details map[string]string
Timestamp int64
Timestamp time.Time
CreateIndex uint64
}