diff --git a/alert/types.go b/alert/types.go index f0d4dab8a..13659addf 100644 --- a/alert/types.go +++ b/alert/types.go @@ -18,12 +18,18 @@ type Event struct { } func (e Event) AlertData() Data { + // adopt time to local timezone + e.State.Time = e.State.Time.Local() + + // transform duration to string for human readability + d := e.State.Duration.String() + return Data{ ID: e.State.ID, Message: e.State.Message, Details: e.State.Details, Time: e.State.Time, - Duration: e.State.Duration, + Duration: d, Level: e.State.Level, Data: e.Data.Result, PreviousLevel: e.previousState.Level, @@ -175,7 +181,8 @@ type Data struct { Message string `json:"message"` Details string `json:"details"` Time time.Time `json:"time"` - Duration time.Duration `json:"duration"` + //Duration time.Duration `json:"duration"` + Duration string `json:"duration"` Level Level `json:"level"` Data models.Result `json:"data"` PreviousLevel Level `json:"previousLevel"` diff --git a/edge/messages.go b/edge/messages.go index 88a9b7f6a..7c10a6da3 100644 --- a/edge/messages.go +++ b/edge/messages.go @@ -325,6 +325,10 @@ func (pm *pointMessage) ToRow() *models.Row { row.Values = make([][]interface{}, 1) row.Values[0] = make([]interface{}, len(row.Columns)) + + // adopt time to local timezone, before store it into row + pm.time = pm.time.Local() + row.Values[0][0] = pm.time for i, c := range row.Columns[1:] { if v, ok := pm.fields[c]; ok {