Documentation ¶
Index ¶
- Constants
- func GetColumns() *columns.Columns[Event]
- func GetGadgetIdentByPrefix(spec *ebpf.CollectionSpec, prefix string) ([]string, error)
- func GetSetter[T FieldType | string](f *EventFactory, name string) func(*Event, T)
- func Populate(m *metadatav1.GadgetMetadata, spec *ebpf.CollectionSpec) error
- func Validate(m *metadatav1.GadgetMetadata, spec *ebpf.CollectionSpec) error
- type ColumnDesc
- type Event
- type EventFactory
- type FieldType
- type GadgetInfo
- type Kind
- type L3Endpoint
- type L4Endpoint
- type Printer
- type RunGadgetDesc
- type Type
Constants ¶
View Source
const ( // Name of the type that gadgets should use to store an L3 endpoint. L3EndpointTypeName = "gadget_l3endpoint_t" // Name of the type that gadgets should use to store an L4 endpoint. L4EndpointTypeName = "gadget_l4endpoint_t" // Name of the type to store a mount namespace inode id MntNsIdTypeName = "gadget_mntns_id" // Name of the type to store a timestamp TimestampTypeName = "gadget_timestamp" )
Keep this aligned with include/gadget/types.h
View Source
const ( IndexVirtual = -1 IndexEBPF = 0 IndexFixed = 1 )
View Source
const (
GadgetHeapMapName = "gadget_heap"
)
Keep this aligned with include/gadget/buffer.h
View Source
const (
// Name of the parameter that defins the network interface a TC program is attached to.
IfaceParam = "iface"
)
View Source
const ( // Prefix used to mark tracer map created with GADGET_TRACER_MAP() defined in // include/gadget/buffer.h. TracerMapPrefix = "gadget_map_tracer_" )
Keep this aligned with include/gadget/macros.h
Variables ¶
This section is empty.
Functions ¶
func GetColumns ¶
func GetGadgetIdentByPrefix ¶ added in v0.24.0
func GetGadgetIdentByPrefix(spec *ebpf.CollectionSpec, prefix string) ([]string, error)
GetGadgetIdentByPrefix returns the strings generated by GADGET_ macros.
func GetSetter ¶ added in v0.24.0
func GetSetter[T FieldType | string](f *EventFactory, name string) func(*Event, T)
func Populate ¶ added in v0.27.0
func Populate(m *metadatav1.GadgetMetadata, spec *ebpf.CollectionSpec) error
Populate fills the metadata from its ebpf spec
func Validate ¶ added in v0.27.0
func Validate(m *metadatav1.GadgetMetadata, spec *ebpf.CollectionSpec) error
Types ¶
type ColumnDesc ¶ added in v0.24.0
type ColumnDesc struct { Name string BlobIndex int // -1: virtual, 0: ebpf, 1: fixed length, 1+ strings Type Type Offset uintptr }
ColumnDesc describes how a column is built. It's basically a serializable version of columns.DynamicField
func FactoryAddField ¶ added in v0.24.0
func FactoryAddField[T FieldType](f *EventFactory, name string) ColumnDesc
func FactoryAddString ¶ added in v0.24.0
func FactoryAddString(f *EventFactory, name string) ColumnDesc
type Event ¶
type Event struct { // Do not use eventtypes.Event because we don't want to have the timestamp column. eventtypes.CommonData // Type indicates the kind of this event Type eventtypes.EventType `json:"type"` // Message when Type is ERR, WARN, DEBUG or INFO Message string `json:"message,omitempty"` L3Endpoints []L3Endpoint `json:"l3endpoints,omitempty"` L4Endpoints []L4Endpoint `json:"l4endpoints,omitempty"` Timestamps []eventtypes.Time `json:"timestamps,omitempty"` MountNsID uint64 `json:"-"` NetNsID uint64 `json:"-"` // Blob is used to save data to be sent to the client. // [0] is used for bpf event // [1] is used for fixed-size members // [1+] is used for variable size members Blob [][]byte `json:"blob,omitempty"` }
func (*Event) GetEndpoints ¶ added in v0.21.0
func (ev *Event) GetEndpoints() []*eventtypes.L3Endpoint
func (*Event) GetMountNSID ¶ added in v0.22.0
func (*Event) GetNetNSID ¶ added in v0.22.0
type EventFactory ¶ added in v0.24.0
type EventFactory struct {
// contains filtered or unexported fields
}
func NewEventFactory ¶ added in v0.24.0
func NewEventFactory() *EventFactory
func (*EventFactory) NewEvent ¶ added in v0.24.0
func (f *EventFactory) NewEvent() *Event
type FieldType ¶ added in v0.24.0
type FieldType interface { constraints.Integer | constraints.Float | bool }
type GadgetInfo ¶ added in v0.22.0
type GadgetInfo struct { GadgetMetadata *metadatav1.GadgetMetadata Columns []ColumnDesc ProgContent []byte GadgetType gadgets.GadgetType EventFactory *EventFactory }
type Kind ¶ added in v0.24.0
type Kind uint8
const ( KindNone Kind = iota KindUint8 KindUint16 KindUint32 KindUint64 KindInt8 KindInt16 KindInt32 KindInt64 KindBool KindFloat32 KindFloat64 KindString KindArray // TODO: this should be made more generic to avoid coupling operators with this KindL3Endpoint KindL4Endpoint KindTimestamp )
TODO: use reflect.Kind? (once we resolve TODO below)
type L3Endpoint ¶ added in v0.21.0
type L3Endpoint struct { eventtypes.L3Endpoint Name string }
type L4Endpoint ¶ added in v0.21.0
type L4Endpoint struct { eventtypes.L4Endpoint Name string }
type Printer ¶ added in v0.22.0
type Printer interface { Output(payload string) Logf(severity logger.Level, fmt string, params ...any) }
Printer is implemented by objects that can print information, like frontends.
type RunGadgetDesc ¶ added in v0.22.0
type RunGadgetDesc interface { GetGadgetInfo(params *params.Params, args []string) (*GadgetInfo, error) CustomParser(info *GadgetInfo) (parser.Parser, error) JSONConverter(info *GadgetInfo, p Printer) func(ev any) JSONPrettyConverter(info *GadgetInfo, p Printer) func(ev any) YAMLConverter(info *GadgetInfo, p Printer) func(ev any) }
RunGadgetDesc represents the different methods implemented by the run gadget descriptor.
Click to show internal directories.
Click to hide internal directories.