samples

package
v0.0.0-...-0958f0d Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrKeyValue

type AttrKeyValue[T string | int64] struct {
	Key string
	// Set to true for OTel SemConv attributes with requirement level: Required
	Required bool
	Value    T
}

AttrKeyValue is a helper to populate Profile.attribute_table.

type AttrTableManager

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

AttrTableManager maintains index allocation and deduplication for attribute tables.

func NewAttrTableManager

func NewAttrTableManager(attrTable pprofile.AttributeTableSlice) *AttrTableManager

func (*AttrTableManager) AppendInt

func (m *AttrTableManager) AppendInt(
	attrs pcommon.Int32Slice, key attribute.Key, value int64)

AppendInt adds the index for the given integer attribute to an attribute index slice.

func (*AttrTableManager) AppendOptionalString

func (m *AttrTableManager) AppendOptionalString(
	attrs pcommon.Int32Slice, key attribute.Key, value string)

AppendOptionalString adds the index for the given string attribute to an attribute index slice if it is non-empty.

type ExecInfo

type ExecInfo struct {
	FileName   string
	GnuBuildID string
}

ExecInfo enriches an executable with additional metadata.

type FuncInfo

type FuncInfo struct {
	Name     string
	FileName string
}

FuncInfo is a helper to construct profile.Function messages.

type SampleAttrProducer

type SampleAttrProducer interface {
	// CollectExtraSampleMeta gathers extra sample meta-info and returns it as
	// a pointer to a **hashable** struct.
	CollectExtraSampleMeta(trace *libpf.Trace, meta *TraceEventMeta) any

	// ExtraSampleAttrs is called when the reporter populates the Sample struct
	// before sending it out. Attributes returned from this function are added
	// as Sample attributes. `meta` receives the pointer that was returned from
	// CollectExtraSampleMeta.
	ExtraSampleAttrs(attrMgr *AttrTableManager, meta any) []int32
}

SampleAttrProducer provides a hook point to:

- inspect each trace and its meta when it is enqueued in the reporter - produce extra meta info - attach extra attributes to the trace

type SourceInfo

type SourceInfo struct {
	LineNumber     libpf.SourceLineno
	FunctionOffset uint32
	FunctionName   string
	FilePath       string
}

SourceInfo allows mapping a frame to its source origin.

type TraceAndMetaKey

type TraceAndMetaKey struct {
	Hash libpf.TraceHash
	// comm and apmServiceName are provided by the eBPF programs
	Comm           string
	ApmServiceName string
	// containerID is annotated based on PID information
	ContainerID string
	Pid         int64
	// Executable path is retrieved from /proc/PID/exe
	Executable string
	// ExtraMeta stores extra meta info that may have been produced by a
	// `SampleAttrProducer` instance. May be nil.
	ExtraMeta any
}

TraceAndMetaKey is the deduplication key for samples. This **must always** contain all trace fields that aren't already part of the trace hash to ensure that we don't accidentally merge traces with different fields.

type TraceEventMeta

type TraceEventMeta struct {
	Timestamp      libpf.UnixTime64
	Comm           string
	Executable     string
	APMServiceName string
	PID, TID       libpf.PID
	CPU            int
}

type TraceEvents

type TraceEvents struct {
	Files              []libpf.FileID
	Linenos            []libpf.AddressOrLineno
	FrameTypes         []libpf.FrameType
	MappingStarts      []libpf.Address
	MappingEnds        []libpf.Address
	MappingFileOffsets []uint64
	Timestamps         []uint64 // in nanoseconds
}

TraceEvents holds known information about a trace.

Jump to

Keyboard shortcuts

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