From bf415f2e1cdf9136fa011e88fef9d4872da367ef Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 22 Jun 2021 14:53:52 +0200 Subject: [PATCH] Add missing doc in stats_message --- pkg/icingaredis/v1/stats_message.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/icingaredis/v1/stats_message.go b/pkg/icingaredis/v1/stats_message.go index 817d0a21..5b046292 100644 --- a/pkg/icingaredis/v1/stats_message.go +++ b/pkg/icingaredis/v1/stats_message.go @@ -9,10 +9,12 @@ import ( // StatsMessage represents a message from the Redis stream icinga:stats. type StatsMessage map[string]interface{} +// Raw returns the key-value pairs of the message. func (m StatsMessage) Raw() map[string]interface{} { return m } +// IcingaStatus extracts Icinga status information from the message into IcingaStatus and returns it. func (m StatsMessage) IcingaStatus() (*IcingaStatus, error) { if s, ok := m["IcingaApplication"].(string); ok { var envelope struct { @@ -33,6 +35,7 @@ func (m StatsMessage) IcingaStatus() (*IcingaStatus, error) { return nil, errors.Errorf(`bad message %#v. "IcingaApplication" missing`, m) } +// Time extracts the timestamp of the message into types.UnixMilli and returns it. func (m StatsMessage) Time() (*types.UnixMilli, error) { if s, ok := m["timestamp"].(string); ok { var t types.UnixMilli