eventstream

package
v0.0.0-...-cba18c7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package eventstream holds eventstream related files

Package eventstream holds eventstream related files

Index

Constants

View Source
const EventStreamMap = "events"

EventStreamMap defines the event stream map name

Variables

This section is empty.

Functions

This section is empty.

Types

type InvalidEventCause

type InvalidEventCause int

InvalidEventCause is an enum that represents the cause of an invalid event

const (
	// InvalidType indicates that the type of an event is invalid
	InvalidType InvalidEventCause = iota
)

func (InvalidEventCause) String

func (cause InvalidEventCause) String() string

type LostEventCounter

type LostEventCounter interface {
	CountLostEvent(count uint64, perfMapName string, CPU int)
}

LostEventCounter interface used to monitor event loss

type MapStats

type MapStats struct {
	Bytes *atomic.Uint64
	Count *atomic.Uint64
	Lost  *atomic.Uint64
}

MapStats contains the collected metrics for one event and one cpu in a perf buffer statistics map

func NewEventStreamMapStats

func NewEventStreamMapStats() MapStats

NewEventStreamMapStats returns a new MapStats correctly initialized

func (*MapStats) UnmarshalBinary

func (s *MapStats) UnmarshalBinary(data []byte) error

UnmarshalBinary parses a map entry and populates the current EventStreamMapStats instance

type Monitor

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

Monitor holds statistics about the number of lost and received events

func NewEventStreamMonitor

func NewEventStreamMonitor(config *config.Config, eRPC *erpc.ERPC, manager *manager.Manager, statsdClient statsd.ClientInterface, onEventLost func(perfMapName string, perEvent map[string]uint64), useRingBuffers bool) (*Monitor, error)

NewEventStreamMonitor instantiates a new event statistics counter

func (*Monitor) CountEvent

func (pbm *Monitor) CountEvent(eventType model.EventType, timestamp uint64, count uint64, size uint64, mapName string, cpu int)

CountEvent adds `count` to the counter of received events of the specified type

func (*Monitor) CountInvalidEvent

func (pbm *Monitor) CountInvalidEvent(mapName string, cause InvalidEventCause, size uint64)

CountInvalidEvent counts the size of one invalid event of the specified cause

func (*Monitor) CountLostEvent

func (pbm *Monitor) CountLostEvent(count uint64, mapName string, cpu int)

CountLostEvent adds `count` to the counter of lost events

func (*Monitor) GetAndResetLostCount

func (pbm *Monitor) GetAndResetLostCount(perfMap string, cpu int) uint64

GetAndResetLostCount returns the number of lost events and resets the counter for a given map and cpu. If a cpu of -1 is provided, the function will reset the counters of all the cpus for the provided map, and return the sum of all the lost events of all the cpus of the provided map. (only used in tests)

func (*Monitor) GetEventStats

func (pbm *Monitor) GetEventStats(eventType model.EventType, perfMap string, cpu int) (MapStats, MapStats)

GetEventStats returns the number of received events of the specified type (only used in tests)

func (*Monitor) GetKernelLostCount

func (pbm *Monitor) GetKernelLostCount(perfMap string, cpu int, evtTypes ...model.EventType) uint64

GetKernelLostCount returns the number of lost events for a given map and cpu. If a cpu of -1 is provided, the function will return the sum of all the lost events of all the cpus.

func (*Monitor) GetLostCount

func (pbm *Monitor) GetLostCount(perfMap string, cpu int) uint64

GetLostCount returns the number of lost events for a given map and cpu. If a cpu of -1 is provided, the function will return the sum of all the lost events of all the cpus. (only used in tests)

func (*Monitor) SendStats

func (pbm *Monitor) SendStats() error

SendStats send event stats using the provided statsd client

Directories

Path Synopsis
Package reorderer holds reorderer related files
Package reorderer holds reorderer related files
Package ringbuffer holds ringbuffer related files
Package ringbuffer holds ringbuffer related files

Jump to

Keyboard shortcuts

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