mirror of
https://github.com/Icinga/icingadb.git
synced 2026-06-04 22:32:57 -04:00
Add missing doc in stats_message
This commit is contained in:
parent
ff88cb73f7
commit
bf415f2e1c
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue