ir

package
v0.0.0-...-6a83aa9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ir contains a representation of probes as applied to a specific binary.

The key data structure is ir.Program, which represents all the information needed to describe the set of probes that will be connected to a single binary.

Index

Constants

View Source
const MaxStringLiteralLength = 255

MaxStringLiteralLength is the maximum length of a string literal that can be used in a condition expression.

Variables

This section is empty.

Functions

func CompareProbeIDs

func CompareProbeIDs[A, B ProbeIDer](a A, b B) int

CompareProbeIDs compares two probe definitions by their ID and version.

Types

type CaptureConfig

type CaptureConfig interface {
	GetMaxReferenceDepth() uint32
	GetMaxFieldCount() uint32
	GetMaxLength() uint32
	GetMaxCollectionSize() uint32
}

CaptureConfig is the capture configuration of a probe.

type CaptureExpressionDefinition

type CaptureExpressionDefinition interface {
	GetName() string
	GetDSL() string
	GetJSON() json.RawMessage
	// GetCaptureConfig returns per-expression capture limits, or nil for probe defaults.
	GetCaptureConfig() CaptureConfig
}

CaptureExpressionDefinition defines a single capture expression on a probe.

type EventKind

type EventKind uint8

EventKind is the kind of event.

const (

	// EventKindEntry is an event that emits an entry.
	EventKindEntry EventKind
	// EventKindReturn is an event that emits a return.
	EventKindReturn
	// EventKindLine is an event that emits a line.
	EventKindLine
)

func (EventKind) IsValid

func (k EventKind) IsValid() bool

IsValid returns true if the event kind is valid.

func (EventKind) String

func (i EventKind) String() string

type FunctionWhere

type FunctionWhere interface {
	Where
	Location() (functionName string)
}

FunctionWhere is a where clause of a probe that is a function.

type Issue

type Issue struct {
	Kind    IssueKind
	Message string
}

Issue is an issue that was encountered while processing a probe.

func (Issue) IsNone

func (i Issue) IsNone() bool

IsNone returns true if the issue is empty.

type IssueKind

type IssueKind int

IssueKind is the kind of issue that was encountered.

const (

	// IssueKindInvalidProbeDefinition is an issue that was encountered while
	// deserializing a probe definition.
	IssueKindInvalidProbeDefinition IssueKind
	// IssueKindTargetNotFoundInBinary is an issue that was encountered while
	// processing a probe definition and failing to find the target in the
	// binary.
	IssueKindTargetNotFoundInBinary
	// IssueKindUnsupportedFeature is an issue that was encountered while
	// processing a probe definition that uses a feature that is not supported.
	IssueKindUnsupportedFeature
	// IssueKindMalformedExecutable is an issue that was encountered while
	// processing a probe definition that uses a malformed executable.
	IssueKindMalformedExecutable
	// IssueKindInvalidDWARF is an issue that was encountered while processing
	// a probe definition that uses an invalid DWARF.
	IssueKindInvalidDWARF
	// IssueKindDisassemblyFailed is an issue that was encountered while
	// disassembling an instruction.
	IssueKindDisassemblyFailed
	// IssueKindConditionVariableUnavailable is an issue that was encountered
	// when the variable referenced in a condition expression is not available.
	IssueKindConditionVariableUnavailable
	// IssueKindConditionExpressionUnresolvable is an issue that was
	// encountered when the condition expression's type chain could not be
	// fully resolved (e.g., unresolved pointee types, missing struct fields).
	IssueKindConditionExpressionUnresolvable
)

func (IssueKind) String

func (i IssueKind) String() string

type LineWhere

type LineWhere interface {
	Where
	Line() (functionName string, sourceFile string, lineNumber string)
}

LineWhere is a where clause of a probe that is a line within a function.

type ProbeDefinition

type ProbeDefinition interface {
	ProbeIDer
	// GetTags returns the tags of the probe.
	GetTags() []string
	// GetKind returns the kind of the probe.
	GetKind() ProbeKind
	// GetWhere returns the where clause of the probe.
	GetWhere() Where
	// GetCaptureConfig returns the capture configuration of the probe.
	GetCaptureConfig() CaptureConfig
	// ThrottleConfig returns the throttle configuration of the probe.
	GetThrottleConfig() ThrottleConfig
	// GetTemplate returns the template of the probe.
	GetTemplate() TemplateDefinition
	// GetCaptureExpressions returns the capture expressions of the probe, or
	// nil if the probe does not have capture expressions.
	GetCaptureExpressions() []CaptureExpressionDefinition
	// GetWhen returns the JSON condition expression for the probe, or nil
	// if the probe fires unconditionally.
	GetWhen() json.RawMessage
	// GetWhenDSL returns the human-readable DSL string for the probe's
	// condition, or "" if the probe fires unconditionally.
	GetWhenDSL() string
}

ProbeDefinition abstracts the configuration of a probe.

type ProbeIDer

type ProbeIDer interface {
	// GetID returns the ID of the probe.
	GetID() string
	// GetVersion returns the version of the probe.
	GetVersion() int
}

ProbeIDer is an interface that allows for comparison of probe definitions.

type ProbeIssue

type ProbeIssue struct {
	ProbeDefinition `json:"probe_definition"`
	Issue           `json:"issue"`
}

ProbeIssue is an issue that was encountered while processing a probe.

type ProbeKind

type ProbeKind uint8

ProbeKind is the kind of probe.

const (

	// ProbeKindLog is a probe that emits a log.
	ProbeKindLog ProbeKind
	// ProbeKindSpan is a probe that emits a span.
	ProbeKindSpan
	// ProbeKindMetric is a probe that updates a metric.
	ProbeKindMetric
	// ProbeKindSnapshot is a probe that emits a snapshot.
	//
	// Internally in rcjson these are log probes with capture_snapshot set to
	// true.
	ProbeKindSnapshot
	// ProbeKindCaptureExpression is a probe that captures specific expressions.
	//
	// Internally in rcjson these are log probes with captureSnapshot=false and
	// captureExpressions set.
	ProbeKindCaptureExpression
)

func (ProbeKind) IsValid

func (k ProbeKind) IsValid() bool

IsValid returns true if the probe kind is valid.

func (ProbeKind) String

func (i ProbeKind) String() string

type TemplateDefinition

type TemplateDefinition interface {
	GetTemplateString() string
	GetSegments() iter.Seq[TemplateSegmentDefinition]
}

TemplateDefinition represents the configuration-time template definition

type TemplateSegmentDefinition

type TemplateSegmentDefinition interface {
	TemplateSegment() // marker method
}

TemplateSegmentDefinition represents a configuration-time template segment

type TemplateSegmentExpression

type TemplateSegmentExpression interface {
	TemplateSegmentDefinition
	GetDSL() string
	GetJSON() json.RawMessage
}

TemplateSegmentExpression represents an expression segment in configuration

type TemplateSegmentString

type TemplateSegmentString interface {
	TemplateSegmentDefinition
	GetString() string
}

TemplateSegmentString represents a string literal segment in configuration

type ThrottleConfig

type ThrottleConfig interface {
	GetThrottlePeriodMs() uint32
	GetThrottleBudget() int64
}

ThrottleConfig is the throttle configuration of a probe.

type Where

type Where interface {
	Where() // marker method
}

Where is a where clause of a probe.

Jump to

Keyboard shortcuts

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