Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions alert/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"`
Expand Down
4 changes: 4 additions & 0 deletions edge/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down