api

package
v0.0.0-...-7febb3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseValues

type BaseValues struct {
	Messages  int64             `json:"messages"`
	Volume    int64             `json:"volume"`
	Errors    int64             `json:"errors"`
	Waiting   int64             `json:"waiting"`
	Clients   int64             `json:"clients"`
	LastSeen  int64             `json:"last_seen"`
	ClientMap map[string]string `json:"client_map"`
	Expired   int64             `json:"expired"`
	Delayed   int64             `json:"delayed"`
}

func NewBaseValues

func NewBaseValues() *BaseValues

func (*BaseValues) Add

func (b *BaseValues) Add(value *BaseValues) *BaseValues

func (*BaseValues) AddClient

func (b *BaseValues) AddClient(value string) *BaseValues

func (*BaseValues) CombineWIth

func (b *BaseValues) CombineWIth(other *BaseValues) *BaseValues

func (*BaseValues) Merge

func (b *BaseValues) Merge(other *BaseValues) *BaseValues

func (*BaseValues) SetDelayed

func (b *BaseValues) SetDelayed(value int64) *BaseValues

func (*BaseValues) SetErrors

func (b *BaseValues) SetErrors(value int64) *BaseValues

func (*BaseValues) SetExpired

func (b *BaseValues) SetExpired(value int64) *BaseValues

func (*BaseValues) SetLastSeen

func (b *BaseValues) SetLastSeen(value int64) *BaseValues

func (*BaseValues) SetMessages

func (b *BaseValues) SetMessages(value int64) *BaseValues

func (*BaseValues) SetVolume

func (b *BaseValues) SetVolume(value int64) *BaseValues

func (*BaseValues) SetWaiting

func (b *BaseValues) SetWaiting(value int64) *BaseValues

type BaseValuesDTO

type BaseValuesDTO struct {
	Messages              int64  `json:"messages"`
	MessagesHumanized     string `json:"messagesHumanized"`
	Volume                int64  `json:"volume"`
	VolumeHumanized       string `json:"volumeHumanized"`
	Errors                int64  `json:"errors"`
	ErrorsHumanized       string `json:"errorsHumanized"`
	Waiting               int64  `json:"waiting"`
	WaitingHumanized      string `json:"waitingHumanized"`
	Clients               int64  `json:"clients"`
	ClientsHumanized      string `json:"clientsHumanized"`
	LastActivity          int64  `json:"lastActivity"`
	LastActivityHumanized string `json:"lastActivityHumanized"`
	Expired               int64  `json:"expired"`
	ExpiredHumanized      string `json:"expiredHumanized"`
	Delayed               int64  `json:"delayed"`
	DelayedHumanized      string `json:"delayedHumanized"`
	// contains filtered or unexported fields
}

func NewBaseValuesDTO

func NewBaseValuesDTO() *BaseValuesDTO

func NewBaseValuesDTOFromBaseValues

func NewBaseValuesDTOFromBaseValues(base *BaseValues) *BaseValuesDTO

type ChannelDTO

type ChannelDTO struct {
	Name              string         `json:"name"`
	Type              string         `json:"type"`
	LastActivity      int64          `json:"lastActivity"`
	LastActivityHuman string         `json:"lastActivityHuman"`
	Total             *BaseValuesDTO `json:"total"`
	Incoming          *BaseValuesDTO `json:"incoming"`
	Outgoing          *BaseValuesDTO `json:"outgoing"`
	IsActive          bool           `json:"isActive"`
	ChannelKey        string         `json:"channelKey"`
	Clients           []*ClientDTO   `json:"clients"`
}

func NewChannelDTO

func NewChannelDTO(_type, name string, entity *Entity, clientsEntities *EntitiesFamily) *ChannelDTO

type ClientDTO

type ClientDTO struct {
	Name              string         `json:"name"`
	LastActivity      int64          `json:"lastActivity"`
	LastActivityHuman string         `json:"lastActivityHuman"`
	Total             *BaseValuesDTO `json:"total"`
	Incoming          *BaseValuesDTO `json:"incoming"`
	Outgoing          *BaseValuesDTO `json:"outgoing"`
	IsActive          bool           `json:"isActive"`
}

func NewClientDTO

func NewClientDTO(name string, entity *Entity) *ClientDTO

type DB

type DB struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB() *DB

func (*DB) Close

func (d *DB) Close() error

func (*DB) GetLastEntities

func (d *DB) GetLastEntities() (map[string]*EntitiesGroup, error)

func (*DB) Init

func (d *DB) Init(path string) error

func (*DB) SaveLastEntitiesGroup

func (d *DB) SaveLastEntitiesGroup(groups map[string]*EntitiesGroup) error

type EntitiesFamily

type EntitiesFamily struct {
	LastSeen int64              `json:"last_seen"`
	Name     string             `json:"name"`
	Entities map[string]*Entity `json:"entities"`
}

func EntitiesFamilyFromBinary

func EntitiesFamilyFromBinary(data []byte) (*EntitiesFamily, error)

func NewEntitiesFamily

func NewEntitiesFamily(name string) *EntitiesFamily

func (*EntitiesFamily) AddEntity

func (e *EntitiesFamily) AddEntity(entity *Entity)

func (*EntitiesFamily) Clone

func (e *EntitiesFamily) Clone() *EntitiesFamily

func (*EntitiesFamily) GetActiveEntitiesCount

func (e *EntitiesFamily) GetActiveEntitiesCount() int

func (*EntitiesFamily) List

func (e *EntitiesFamily) List() []*Entity

func (*EntitiesFamily) Merge

func (e *EntitiesFamily) Merge(other *EntitiesFamily) *EntitiesFamily

func (*EntitiesFamily) ReCalcLastSeen

func (e *EntitiesFamily) ReCalcLastSeen()

func (*EntitiesFamily) String

func (e *EntitiesFamily) String() string

func (*EntitiesFamily) ToBinary

func (e *EntitiesFamily) ToBinary() ([]byte, error)

type EntitiesGroup

type EntitiesGroup struct {
	Created  int64                      `json:"created"`
	LastSeen int64                      `json:"last_seen"`
	Families map[string]*EntitiesFamily `json:"entities"`
}

func EntitiesGroupFromBinary

func EntitiesGroupFromBinary(data []byte) (*EntitiesGroup, error)

func NewEntitiesGroup

func NewEntitiesGroup() *EntitiesGroup

func (*EntitiesGroup) AddEntity

func (e *EntitiesGroup) AddEntity(family string, entity *Entity)

func (*EntitiesGroup) Clone

func (e *EntitiesGroup) Clone() *EntitiesGroup

func (*EntitiesGroup) GetActiveEntitiesCount

func (e *EntitiesGroup) GetActiveEntitiesCount() int

func (*EntitiesGroup) GetEntity

func (e *EntitiesGroup) GetEntity(family, name string) (*Entity, bool)

func (*EntitiesGroup) GetFamily

func (e *EntitiesGroup) GetFamily(family string) (*EntitiesFamily, bool)

func (*EntitiesGroup) Key

func (e *EntitiesGroup) Key() string

func (*EntitiesGroup) List

func (e *EntitiesGroup) List() []*Entity

func (*EntitiesGroup) Merge

func (e *EntitiesGroup) Merge(other *EntitiesGroup) *EntitiesGroup

func (*EntitiesGroup) ReCalcLastSeen

func (e *EntitiesGroup) ReCalcLastSeen()

func (*EntitiesGroup) String

func (e *EntitiesGroup) String() string

func (*EntitiesGroup) ToBinary

func (e *EntitiesGroup) ToBinary() ([]byte, error)

type Entity

type Entity struct {
	Time     int64       `json:"time"`
	Type     string      `json:"type"`
	Name     string      `json:"name"`
	In       *BaseValues `json:"in"`
	Out      *BaseValues `json:"out"`
	LastSeen int64       `json:"last_seen"`
}

func EntityFromBinary

func EntityFromBinary(data []byte) (*Entity, error)

func NewEntity

func NewEntity(_type, name string) *Entity

func ParseEntity

func ParseEntity(data []byte) (*Entity, error)

func (*Entity) Bytes

func (e *Entity) Bytes() []byte

func (*Entity) IsActive

func (e *Entity) IsActive() bool

func (*Entity) Key

func (e *Entity) Key() string

func (*Entity) Merge

func (e *Entity) Merge(other *Entity) *Entity

func (*Entity) SetClient

func (e *Entity) SetClient(side, value string) *Entity

func (*Entity) SetIn

func (e *Entity) SetIn(value *BaseValues) *Entity

func (*Entity) SetOut

func (e *Entity) SetOut(value *BaseValues) *Entity

func (*Entity) SetValues

func (e *Entity) SetValues(side, kind string, value int64) *Entity

func (*Entity) String

func (e *Entity) String() string

func (*Entity) ToBinary

func (e *Entity) ToBinary() ([]byte, error)

type FamilyDTO

type FamilyDTO struct {
	Name                string         `json:"name"`
	LastActivity        int64          `json:"lastActivity"`
	LastActivityHuman   string         `json:"lastActivityHuman"`
	Total               *BaseValuesDTO `json:"total"`
	Incoming            *BaseValuesDTO `json:"incoming"`
	Outgoing            *BaseValuesDTO `json:"outgoing"`
	ChannelsList        []*ChannelDTO  `json:"channelsList"`
	Channels            int64          `json:"channels"`
	ChannelsHuman       string         `json:"channelsHuman"`
	Clients             int64          `json:"clients"`
	ClientsHuman        string         `json:"clientsHuman"`
	ActiveChannels      int64          `json:"activeChannels"`
	ActiveChannelsHuman string         `json:"activeChannelsHuman"`
	IsActive            bool           `json:"isActive"`
	// contains filtered or unexported fields
}

func NewFamilyDTO

func NewFamilyDTO(family *EntitiesFamily, clientsEntitiesGroup *EntitiesGroup) *FamilyDTO

func (*FamilyDTO) Add

func (f *FamilyDTO) Add(family *FamilyDTO)

type GroupDTO

type GroupDTO struct {
	ChannelsStats     *StatCardDTO  `json:"channelsStats"`
	IncomingStats     *StatCardDTO  `json:"incomingStats"`
	OutgoingStats     *StatCardDTO  `json:"outgoingStats"`
	Channels          []*ChannelDTO `json:"channels"`
	LastActivityHuman string        `json:"lastActivityHuman"`
}

func NewGroupDTO

func NewGroupDTO(family *FamilyDTO) *GroupDTO

type HostInfoDTO

type HostInfoDTO struct {
	Host              string  `json:"host"`
	Version           string  `json:"version"`
	LastUpdate        string  `json:"lastUpdate"`
	Status            string  `json:"status"`
	Role              string  `json:"role"`
	Uptime            string  `json:"uptime"`
	MemoryAllocated   string  `json:"memoryAllocated"`
	MemoryUsed        string  `json:"memoryUsed"`
	MemoryUtilization float64 `json:"memoryUtilization"`
	OsThreads         int64   `json:"osThreads"`
	CpuCores          int     `json:"cpuCores"`
	CpuUtilization    float64 `json:"cpuUtilization"`
	ActiveClients     int     `json:"activeClients"`
}

func NewHostInfoDTO

func NewHostInfoDTO(system *System) *HostInfoDTO

type Info

type Info struct {
	Host      string `json:"host"`
	Version   string `json:"version"`
	IsHealthy bool   `json:"is_healthy"`
	IsReady   bool   `json:"is_ready"`
}

func NewInfo

func NewInfo() *Info

func (*Info) SetHost

func (i *Info) SetHost(value string) *Info

func (*Info) SetIsHealthy

func (i *Info) SetIsHealthy(value bool) *Info

func (*Info) SetIsReady

func (i *Info) SetIsReady(value bool) *Info

func (*Info) SetVersion

func (i *Info) SetVersion(value string) *Info

type Snapshot

type Snapshot struct {
	Pk       int                       `json:"-"`
	Time     int64                     `json:"time"`
	Host     string                    `json:"host"`
	System   *System                   `json:"system"`
	Entities map[string]*EntitiesGroup `json:"entities"`
}

func NewSnapshot

func NewSnapshot() *Snapshot

func SnapshotFromBinary

func SnapshotFromBinary(data []byte) (*Snapshot, error)

func (*Snapshot) Clone

func (s *Snapshot) Clone() *Snapshot

func (*Snapshot) SetChannelEntities

func (s *Snapshot) SetChannelEntities(value *EntitiesGroup) *Snapshot

func (*Snapshot) SetClientsEntities

func (s *Snapshot) SetClientsEntities(value *EntitiesGroup) *Snapshot

func (*Snapshot) SetSystem

func (s *Snapshot) SetSystem(value *System) *Snapshot

func (*Snapshot) ToBinary

func (s *Snapshot) ToBinary() ([]byte, error)

type SnapshotDTO

type SnapshotDTO struct {
	HostsInfo         []*HostInfoDTO   `json:"hostsInfo"`
	StatsCards        *StatCardDTOs    `json:"statsCards"`
	TopChannels       []*TopChannelDTO `json:"topChannels"`
	LastActivity      int64            `json:"lastActivity"`
	LastActivityHuman string           `json:"lastActivityHuman"`
	Total             *BaseValuesDTO   `json:"total"`
	Incoming          *BaseValuesDTO   `json:"incoming"`
	Outgoing          *BaseValuesDTO   `json:"outgoing"`
	Channels          int64            `json:"channels"`
	ChannelsHuman     string           `json:"channelsHuman"`
	Clients           int64            `json:"clients"`
	ClientsHuman      string           `json:"clientsHuman"`
	ActiveChannels    int64            `json:"activeChannels"`
	Queues            *FamilyDTO       `json:"queues"`
	Pubsub            *FamilyDTO       `json:"pubsub"`
	CommandsQueries   *FamilyDTO       `json:"commandsQueries"`
	NodeType          string           `json:"nodeType"`
	Node              string           `json:"node"`
	// contains filtered or unexported fields
}

func NewSnapshotDTO

func NewSnapshotDTO(systems []*System, channelsEntitiesGroup *EntitiesGroup, clientsEntitiesGroup *EntitiesGroup) *SnapshotDTO

func (*SnapshotDTO) CreateTopChannels

func (g *SnapshotDTO) CreateTopChannels() *SnapshotDTO

func (*SnapshotDTO) UpdateStatCards

func (g *SnapshotDTO) UpdateStatCards() *SnapshotDTO

type StatCardDTO

type StatCardDTO struct {
	PrimaryItemCaption   string              `json:"primaryItemCaption"`
	PrimaryItemValue     string              `json:"primaryItemValue"`
	SecondaryItemCaption string              `json:"secondaryItemCaption,omitempty"`
	SecondaryItemValue   string              `json:"secondaryItemValue,omitempty"`
	Queues               *StatCardSectionDTO `json:"queues,omitempty"`
	PubSub               *StatCardSectionDTO `json:"pubsub,omitempty"`
	CommandsQueries      *StatCardSectionDTO `json:"commandsQueries,omitempty"`
	// contains filtered or unexported fields
}

func NewStatCardDTO

func NewStatCardDTO(primaryCaption, primaryValue, secondaryCaption, secondaryValue string) *StatCardDTO

func (*StatCardDTO) AddCommandsQueriesFamily

func (s *StatCardDTO) AddCommandsQueriesFamily(primaryValue, secondaryValue int64) *StatCardDTO

func (*StatCardDTO) AddPubSubFamily

func (s *StatCardDTO) AddPubSubFamily(primaryValue, secondaryValue int64) *StatCardDTO

func (*StatCardDTO) AddQueuesFamily

func (s *StatCardDTO) AddQueuesFamily(primaryValue, secondaryValue int64) *StatCardDTO

type StatCardDTOs

type StatCardDTOs struct {
	Channels *StatCardDTO `json:"channels"`
	Outgoing *StatCardDTO `json:"outgoing"`
	Incoming *StatCardDTO `json:"incoming"`
	Clients  *StatCardDTO `json:"clients"`
}

func NewStatCardDTOs

func NewStatCardDTOs() *StatCardDTOs

func (*StatCardDTOs) AddChannels

func (s *StatCardDTOs) AddChannels(active, total string, queues, pubsub, commandsQueries *FamilyDTO) *StatCardDTOs

func (*StatCardDTOs) AddClients

func (s *StatCardDTOs) AddClients(total string, queues, pubsub, commandsQueries *FamilyDTO) *StatCardDTOs

func (*StatCardDTOs) AddIncoming

func (s *StatCardDTOs) AddIncoming(messages, volume string, queues, pubsub, commandsQueries *FamilyDTO) *StatCardDTOs

func (*StatCardDTOs) AddOutgoing

func (s *StatCardDTOs) AddOutgoing(messages, volume string, queues, pubsub, commandsQueries *FamilyDTO) *StatCardDTOs

type StatCardSectionDTO

type StatCardSectionDTO struct {
	Title   string `json:"title"`
	Caption string `json:"caption"`
	Value   string `json:"value"`
}

func NewStatCardSectionDTO

func NewStatCardSectionDTO() *StatCardSectionDTO

func (*StatCardSectionDTO) SetCaption

func (s *StatCardSectionDTO) SetCaption(value string) *StatCardSectionDTO

func (*StatCardSectionDTO) SetTitle

func (s *StatCardSectionDTO) SetTitle(value string) *StatCardSectionDTO

func (*StatCardSectionDTO) SetValue

func (s *StatCardSectionDTO) SetValue(value string) *StatCardSectionDTO

type System

type System struct {
	Hostname                string  `json:"hostname"`
	Version                 string  `json:"version"`
	ProcessMemory           float64 `json:"process_memory"`
	ProcessMemoryAllocation float64 `json:"process_memory_allocation"`
	GoRoutines              int64   `json:"go_routines"`
	OSThreads               int64   `json:"os_threads"`
	TotalCPUSeconds         float64 `json:"total_cpu_seconds"`
	TotalCPUs               int     `json:"total_cpus"`
	StartTime               float64 `json:"start_time"`
	Uptime                  float64 `json:"uptime"`
	CPUUtilization          float64 `json:"cpu_utilization"`
	MemoryUtilization       float64 `json:"memory_utilization"`
	UpdatedAt               int64   `json:"updatedAt"`
	ActiveClients           int     `json:"activeClients"`
}

func NewSystem

func NewSystem() *System

func (*System) Calc

func (s *System) Calc() *System

func (*System) SetActiveClients

func (s *System) SetActiveClients(value int) *System

func (*System) SetCPUUtilization

func (s *System) SetCPUUtilization(lastUptime, lastCpuSeconds float64) *System

func (*System) SetGoRoutines

func (s *System) SetGoRoutines(value int64) *System

func (*System) SetOSThreads

func (s *System) SetOSThreads(value int64) *System

func (*System) SetProcessMemory

func (s *System) SetProcessMemory(value float64) *System

func (*System) SetProcessMemoryAllocation

func (s *System) SetProcessMemoryAllocation(value float64) *System

func (*System) SetStartTime

func (s *System) SetStartTime(value float64) *System

func (*System) SetTotalCPUSeconds

func (s *System) SetTotalCPUSeconds(value float64) *System

func (*System) SetUpdatedAt

func (s *System) SetUpdatedAt(value int64) *System

func (*System) SetVersion

func (s *System) SetVersion(value string) *System

type TopChannelDTO

type TopChannelDTO struct {
	Type         string `json:"type"`
	Channel      string `json:"channel"`
	LastActivity string `json:"lastActivity"`
	Sent         string `json:"sent"`
	Delivered    string `json:"delivered"`
	Clients      string `json:"clients"`
	ChannelKey   string `json:"channelKey"`
}

func NewTopChannelDTO

func NewTopChannelDTO(channel *ChannelDTO) *TopChannelDTO

type WebGroup

type WebGroup struct {
	Type     string            `json:"type"`
	Totals   WebGroupTotals    `json:"totals"`
	Channels []WebGroupChannel `json:"channels"`
}

func NewWebGroup

func NewWebGroup() WebGroup

func (WebGroup) AddChannel

func (b WebGroup) AddChannel(value WebGroupChannel) WebGroup

func (WebGroup) SetChannels

func (b WebGroup) SetChannels(value []WebGroupChannel) WebGroup

func (WebGroup) SetTotals

func (b WebGroup) SetTotals(value WebGroupTotals) WebGroup

func (WebGroup) SetType

func (b WebGroup) SetType(value string) WebGroup

type WebGroupBase

type WebGroupBase struct {
	IncomingMessages int64 `json:"incoming_messages"`
	OutgoingMessages int64 `json:"outgoing_messages"`
	IncomingVolume   int64 `json:"incoming_volume"`
	OutgoingVolume   int64 `json:"outgoing_volume"`
	Errors           int64 `json:"errors"`
	Waiting          int64 `json:"waiting"`
}

func NewWebGroupBase

func NewWebGroupBase() WebGroupBase

func (WebGroupBase) SetErrors

func (b WebGroupBase) SetErrors(value int64) WebGroupBase

func (WebGroupBase) SetIncomingMessages

func (b WebGroupBase) SetIncomingMessages(value int64) WebGroupBase

func (WebGroupBase) SetIncomingVolume

func (b WebGroupBase) SetIncomingVolume(value int64) WebGroupBase

func (WebGroupBase) SetOutgoingMessages

func (b WebGroupBase) SetOutgoingMessages(value int64) WebGroupBase

func (WebGroupBase) SetOutgoingVolume

func (b WebGroupBase) SetOutgoingVolume(value int64) WebGroupBase

func (WebGroupBase) SetWaiting

func (b WebGroupBase) SetWaiting(value int64) WebGroupBase

type WebGroupChannel

type WebGroupChannel struct {
	Type string `json:"type,omitempty"`
	Name string `json:"name"`
	WebGroupBase
}

func NewWebGroupChannel

func NewWebGroupChannel() WebGroupChannel

func (WebGroupChannel) SetErrors

func (b WebGroupChannel) SetErrors(value int64) WebGroupChannel

func (WebGroupChannel) SetIncomingMessages

func (b WebGroupChannel) SetIncomingMessages(value int64) WebGroupChannel

func (WebGroupChannel) SetIncomingVolume

func (b WebGroupChannel) SetIncomingVolume(value int64) WebGroupChannel

func (WebGroupChannel) SetName

func (b WebGroupChannel) SetName(value string) WebGroupChannel

func (WebGroupChannel) SetOutgoingMessages

func (b WebGroupChannel) SetOutgoingMessages(value int64) WebGroupChannel

func (WebGroupChannel) SetOutgoingVolume

func (b WebGroupChannel) SetOutgoingVolume(value int64) WebGroupChannel

func (WebGroupChannel) SetType

func (b WebGroupChannel) SetType(value string) WebGroupChannel

func (WebGroupChannel) SetWaiting

func (b WebGroupChannel) SetWaiting(value int64) WebGroupChannel

type WebGroupTotals

type WebGroupTotals struct {
	Channels int64 `json:"channels"`
	WebGroupBase
}

func NewWebGroupTotals

func NewWebGroupTotals() WebGroupTotals

func (WebGroupTotals) SetChannels

func (b WebGroupTotals) SetChannels(value int64) WebGroupTotals

func (WebGroupTotals) SetErrors

func (b WebGroupTotals) SetErrors(value int64) WebGroupTotals

func (WebGroupTotals) SetIncomingMessages

func (b WebGroupTotals) SetIncomingMessages(value int64) WebGroupTotals

func (WebGroupTotals) SetIncomingVolume

func (b WebGroupTotals) SetIncomingVolume(value int64) WebGroupTotals

func (WebGroupTotals) SetOutgoingMessages

func (b WebGroupTotals) SetOutgoingMessages(value int64) WebGroupTotals

func (WebGroupTotals) SetOutgoingVolume

func (b WebGroupTotals) SetOutgoingVolume(value int64) WebGroupTotals

func (WebGroupTotals) SetWaiting

func (b WebGroupTotals) SetWaiting(value int64) WebGroupTotals

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL