format

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 9

Documentation

Overview

Package format provides stdout formatting of monitor messages for reuse by command-line clients of the monitor event channel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MonitorFormatter

type MonitorFormatter struct {
	EventTypes monitorAPI.MessageTypeFilter
	FromSource Uint16Flags
	ToDst      Uint16Flags
	Related    Uint16Flags
	Hex        bool
	JSONOutput bool
	Verbosity  monitorAPI.Verbosity
	Numeric    bool
	// contains filtered or unexported fields
}

MonitorFormatter filters and formats monitor messages from a buffer.

func NewMonitorFormatter

func NewMonitorFormatter(verbosity monitorAPI.Verbosity, linkMonitor getters.LinkGetter, w io.Writer) *MonitorFormatter

NewMonitorFormatter returns a new formatter with default configuration.

func (*MonitorFormatter) FormatEvent

func (m *MonitorFormatter) FormatEvent(pl *payload.Payload) bool

FormatEvent formats an event from the specified payload

Returns true if the event was successfully recognized, false otherwise.

func (*MonitorFormatter) FormatLostEvent added in v1.19.0

func (m *MonitorFormatter) FormatLostEvent(lost uint64, cpu int)

FormatLostEvent formats a lost event using the specified payload parameters.

func (*MonitorFormatter) FormatSample

func (m *MonitorFormatter) FormatSample(data []byte, cpu int)

FormatSample prints an event from the provided raw data slice to stdout.

For most monitor event types, 'data' corresponds to the 'data' field in bpf.PerfEventSample. Exceptions are MessageTypeAccessLog and MessageTypeAgent.

func (*MonitorFormatter) FormatUnknownEvent added in v1.19.0

func (m *MonitorFormatter) FormatUnknownEvent(lost uint64, cpu int, t int)

FormatUnknownEvent formats an unknown event using the specified payload parameters.

type Uint16Flags

type Uint16Flags []uint16

Uint16Flags is a slice of unsigned 16-bit ints with some convenience methods.

func (*Uint16Flags) Has

func (i *Uint16Flags) Has(value uint16) bool

Has returns true of value exist

func (*Uint16Flags) Set

func (i *Uint16Flags) Set(value string) error

Set converts the specified value into an integer and appends it to the flags. Returns an error if the value cannot be converted to a 16-bit unsigned value.

func (*Uint16Flags) String

func (i *Uint16Flags) String() string

String provides a human-readable string format of the received variable.

func (*Uint16Flags) Type

func (i *Uint16Flags) Type() string

Type returns a human-readable string representing the type of the receiver.

Jump to

Keyboard shortcuts

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