metrics

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BPFPerfEventCollector added in v0.24.0

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

BPFPerfEventCollector is a custom Prometheus collector that reads from BPF maps on-demand

func NewBPFPerfEventCollector added in v0.24.0

func NewBPFPerfEventCollector(perfEventStatsMap *bpf.BPFMap) *BPFPerfEventCollector

NewBPFPerfEventCollector creates a new on-demand BPF perf event collector

func (*BPFPerfEventCollector) Collect added in v0.24.0

func (c *BPFPerfEventCollector) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector - this is called when Prometheus scrapes

func (*BPFPerfEventCollector) Describe added in v0.24.0

func (c *BPFPerfEventCollector) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector

type BPFPerfEventStats added in v0.24.0

type BPFPerfEventStats struct {
	Attempts map[events.ID]uint64
	Failures map[events.ID]uint64
}

BPFPerfEventStats holds the BPF perf event stats

type ChannelMetrics added in v0.24.0

type ChannelMetrics[T any] map[string]<-chan T

func (ChannelMetrics[T]) MarshalJSON added in v0.24.0

func (m ChannelMetrics[T]) MarshalJSON() ([]byte, error)

func (ChannelMetrics[T]) RegisterChannels added in v0.24.0

func (m ChannelMetrics[T]) RegisterChannels() error

type Collector added in v0.22.5

type Collector[K comparable] struct {
	// contains filtered or unexported fields
}

func NewCollector added in v0.22.5

func NewCollector[K comparable](description string, gv *prometheus.GaugeVec) *Collector[K]

func (*Collector[K]) Description added in v0.22.5

func (c *Collector[K]) Description() string

func (*Collector[K]) GaugeVec added in v0.22.5

func (c *Collector[K]) GaugeVec() *prometheus.GaugeVec

func (*Collector[K]) Get added in v0.22.5

func (c *Collector[K]) Get(k K) (uint64, bool)

func (*Collector[K]) Reset added in v0.22.5

func (c *Collector[K]) Reset()

func (*Collector[K]) Set added in v0.22.5

func (c *Collector[K]) Set(k K, v uint64)

func (*Collector[K]) Total added in v0.22.5

func (c *Collector[K]) Total() uint64

func (*Collector[K]) Values added in v0.22.5

func (c *Collector[K]) Values() map[K]uint64

type EventCollector added in v0.22.5

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

func NewEventCollector added in v0.22.5

func NewEventCollector(description string, gv *prometheus.GaugeVec) *EventCollector

func (*EventCollector) Description added in v0.22.5

func (ec *EventCollector) Description() string

func (*EventCollector) GaugeVec added in v0.22.5

func (ec *EventCollector) GaugeVec() *prometheus.GaugeVec

func (*EventCollector) Get added in v0.22.5

func (ec *EventCollector) Get(id events.ID) uint64

func (*EventCollector) Log added in v0.22.5

func (ec *EventCollector) Log()

func (*EventCollector) MarshalJSON added in v0.23.0

func (ec *EventCollector) MarshalJSON() ([]byte, error)

func (*EventCollector) Reset added in v0.22.5

func (ec *EventCollector) Reset()

func (*EventCollector) Set added in v0.22.5

func (ec *EventCollector) Set(id events.ID, v uint64)

func (*EventCollector) Total added in v0.22.5

func (ec *EventCollector) Total() uint64

func (*EventCollector) Values added in v0.22.5

func (ec *EventCollector) Values() map[events.ID]uint64

type Stats

type Stats struct {
	EventCount       *counter.Counter `json:"EventCount"`
	EventsFiltered   *counter.Counter `json:"EventsFiltered"`
	NetCapCount      *counter.Counter `json:"NetCapCount"` // network capture events
	BPFLogsCount     *counter.Counter `json:"BPFLogsCount"`
	ErrorCount       *counter.Counter `json:"ErrorCount"`
	LostEvCount      *counter.Counter `json:"LostEvCount"`
	LostWrCount      *counter.Counter `json:"LostWrCount"`
	LostNtCapCount   *counter.Counter `json:"LostNtCapCount"` // lost network capture events
	LostBPFLogsCount *counter.Counter `json:"LostBPFLogsCount"`

	Channels ChannelMetrics[*trace.Event] `json:"ChannelMetrics"`
	// contains filtered or unexported fields
}

When updating this struct, please make sure to update the relevant exporting functions

func NewStats added in v0.22.5

func NewStats() *Stats

func (*Stats) GetBPFPerfEventStats added in v0.24.0

func (s *Stats) GetBPFPerfEventStats() BPFPerfEventStats

GetBPFPerfEventStats returns the BPF perf event stats

func (*Stats) MarshalJSON added in v0.23.0

func (s *Stats) MarshalJSON() ([]byte, error)

func (*Stats) RegisterPrometheus added in v0.8.0

func (s *Stats) RegisterPrometheus() error

Register Stats to prometheus metrics exporter

func (*Stats) SetPerfEventStatsMap added in v0.24.0

func (s *Stats) SetPerfEventStatsMap(perfEventStatsMap *bpf.BPFMap)

SetPerfEventStatsMap sets the BPF map for on-demand perf event stats collection

func (*Stats) ShouldTrackEventForBPFStats added in v0.24.0

func (s *Stats) ShouldTrackEventForBPFStats(id events.ID) bool

ShouldTrackEventForBPFStats determines if an event should be tracked for BPF stats collection.

Jump to

Keyboard shortcuts

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