quark

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

README

go-quark

Documentation

Index

Constants

View Source
const (
	// quark_queue_attr{} flags
	QQ_THREAD_EVENTS = int(C.QQ_THREAD_EVENTS)
	QQ_KPROBE        = int(C.QQ_KPROBE)
	QQ_EBPF          = int(C.QQ_EBPF)
	QQ_MIN_AGG       = int(C.QQ_MIN_AGG)
	QQ_ENTRY_LEADER  = int(C.QQ_ENTRY_LEADER)
	QQ_ALL_BACKENDS  = int(C.QQ_ALL_BACKENDS)

	// Event.events
	QUARK_EV_FORK         = uint64(C.QUARK_EV_FORK)
	QUARK_EV_EXEC         = uint64(C.QUARK_EV_EXEC)
	QUARK_EV_EXIT         = uint64(C.QUARK_EV_EXIT)
	QUARK_EV_SETPROCTITLE = uint64(C.QUARK_EV_SETPROCTITLE)

	// EntryLeaderType
	QUARK_ELT_UNKNOWN   = int(C.QUARK_ELT_UNKNOWN)
	QUARK_ELT_INIT      = int(C.QUARK_ELT_INIT)
	QUARK_ELT_KTHREAD   = int(C.QUARK_ELT_KTHREAD)
	QUARK_ELT_SSHD      = int(C.QUARK_ELT_SSHD)
	QUARK_ELT_SSM       = int(C.QUARK_ELT_SSM)
	QUARK_ELT_CONTAINER = int(C.QUARK_ELT_CONTAINER)
	QUARK_ELT_TERM      = int(C.QUARK_ELT_TERM)
	QUARK_ELT_CONSOLE   = int(C.QUARK_ELT_CONSOLE)
)
View Source
const (
	QUARK_VL_SILENT = int(C.QUARK_VL_SILENT)
	QUARK_VL_WARN   = int(C.QUARK_VL_WARN)
	QUARK_VL_DEBUG  = int(C.QUARK_VL_DEBUG)
)

Variables

View Source
var ErrUndefined = errors.New("undefined")

Functions

func SetVerbose

func SetVerbose(level int)

Sets quark verbosity globally, not per queue.

Types

type Event

type Event struct {
	Events  uint64
	Process Process
}

Events is a bitmask of QUARK_EV_* and expresses what triggered this event, Process is the context of the Event.

type Exit

type Exit struct {
	ExitCode        int32
	ExitTimeProcess uint64
	Valid           bool
}

Exit carries data on the exit behavior of the process. Only valid if `Valid` is set.

type Proc

type Proc struct {
	CapInheritable  uint64
	CapPermitted    uint64
	CapEffective    uint64
	CapBset         uint64
	CapAmbient      uint64
	TimeBoot        uint64
	Ppid            uint32
	Uid             uint32
	Gid             uint32
	Suid            uint32
	Sgid            uint32
	Euid            uint32
	Egid            uint32
	Pgid            uint32
	Sid             uint32
	EntryLeader     uint32
	EntryLeaderType uint32
	TtyMajor        uint32
	TtyMinor        uint32
	UtsInonum       uint32
	IpcInonum       uint32
	MntInonum       uint32
	NetInonum       uint32
	Valid           bool
}

Proc carries data on the state of the process. Only vaid if `Valid` is set.

type Process

type Process struct {
	Pid      uint32   // Always present
	Proc     Proc     // Only meaningful if Proc.Valid (QUARK_F_PROC)
	Exit     Exit     // Only meaningful if Exit.Valid (QUARK_F_EXIT)
	Comm     string   // QUARK_F_COMM
	Filename string   // QUARK_F_FILENAME
	Cmdline  []string // QUARK_F_CMDLINE
	Cwd      string   // QUARK_F_CWD
	Cgroup   string   // QUARK_F_CGROUP
}

Process represents a single process.

type Queue

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

Queue holds the state of a quark instance.

func OpenQueue

func OpenQueue(attr QueueAttr) (*Queue, error)

OpenQueue opens a Quark Queue with the given attributes.

func (*Queue) Block

func (queue *Queue) Block() error

Block blocks until there are events or an undefined timeout expires. GetEvent should be called once Block returns.

func (*Queue) Close

func (queue *Queue) Close()

Close closes the queue.

func (*Queue) GetEvent added in v0.4.0

func (queue *Queue) GetEvent() (Event, bool)

func (*Queue) Lookup

func (queue *Queue) Lookup(pid int) (Process, bool)

Lookup looks up for the Process associated with PID in quark's internal cache.

func (*Queue) Snapshot

func (queue *Queue) Snapshot() []Process

Snapshot returns a snapshot of all processes in the cache.

func (*Queue) Stats

func (queue *Queue) Stats() Stats

Stats returns statistics of an active queue.

type QueueAttr

type QueueAttr struct {
	Flags          int
	MaxLength      int
	CacheGraceTime int
	HoldTime       int
}

QueueAttr defines the attributes for the Quark queue.

func DefaultQueueAttr

func DefaultQueueAttr() QueueAttr

DefaultQueueAttr returns the default attributes for the queue.

type Stats

type Stats struct {
	Insertions         uint64
	Removals           uint64
	Aggregations       uint64
	NonAggregations    uint64
	Lost               uint64
	GarbageCollections uint64
	Backend            int
}

Documented in https://elastic.github.io/quark/quark_queue_get_stats.3.html.

Jump to

Keyboard shortcuts

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