detector

package
v1.300064.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSkipProcess indicates that the current process being evaluated should be skipped.
	ErrSkipProcess = errors.New("skip process")
	// ErrIncompatibleDetector indicates that a specific detector is incompatible with a resource.
	ErrIncompatibleDetector = errors.New("incompatible detector")
)
View Source
var (
	ErrIncompatibleExtractor = errors.New("incompatible extractor")
	ErrExtractName           = errors.New("unable to extract name")
	ErrExtractPort           = errors.New("unable to extract port")
	ErrInvalidPort           = errors.New("invalid port")
)

Functions

This section is empty.

Types

type Category

type Category string

Category represents a classification type for discovered resources.

const (
	CategoryJVM         Category = "JVM"
	CategoryTomcat      Category = "TOMCAT"
	CategoryKafkaBroker Category = "KAFKA/BROKER"
	CategoryKafkaClient Category = "KAFKA/CLIENT"
	CategoryNvidiaGPU   Category = "NVIDIA_GPU"
)

type DeviceDetector

type DeviceDetector interface {
	// Detect attempts to gather metadata for devices. Returns an error if the detection fails.
	Detect() (*Metadata, error)
}

DeviceDetector defines an interface for detecting and categorizing devices.

type Extractor

type Extractor[T any] interface {
	Extract(ctx context.Context, process Process) (T, error)
}

type Metadata

type Metadata struct {
	// Categories can be one or more ordered Category entries that a detector matched. For example, a Tomcat detector
	// would match both JVM and Tomcat.
	Categories []Category `json:"categories"`
	// Name is the identifier of the resource.
	Name string `json:"name,omitempty"`
	// Attributes can be used to supply additional optional information.
	Attributes map[string]string `json:"attributes,omitempty"`
	// TelemetryPort is the port for the resource that exposes telemetry.
	TelemetryPort int `json:"telemetry_port,omitempty"`
	// Status is the current status of telemetry availability for the resource.
	Status Status `json:"status"`
}

Metadata represents discovered information about a resource including its categories, details, and current Status.

type MetadataSlice

type MetadataSlice []*Metadata

MetadataSlice is a grouping on Metadata entries.

type NameExtractor

type NameExtractor = Extractor[string]

type NameFilter

type NameFilter interface {
	ShouldInclude(name string) bool
}

NameFilter determines based on the detected name if a resource should be included in the detection results.

type OpenFilesStat added in v1.300062.0

type OpenFilesStat = process.OpenFilesStat

type PortExtractor

type PortExtractor = Extractor[int]

type Process

type Process interface {
	// PID returns the process ID.
	PID() int32
	// ExeWithContext returns the executable path of the process.
	ExeWithContext(ctx context.Context) (string, error)
	// CwdWithContext returns the current working directory of the process.
	CwdWithContext(ctx context.Context) (string, error)
	// CmdlineSliceWithContext returns the command line arguments of the process as a slice. Includes the executable
	// in the first entry.
	CmdlineSliceWithContext(ctx context.Context) ([]string, error)
	// EnvironWithContext returns the environment variables of the process. Each entry follows a <NAME>=<VALUE> pattern.
	EnvironWithContext(ctx context.Context) ([]string, error)
	// CreateTimeWithContext returns the creation time of the process in milliseconds.
	CreateTimeWithContext(ctx context.Context) (int64, error)
	// OpenFilesWithContext returns the open file descriptors of the process.
	OpenFilesWithContext(context.Context) ([]OpenFilesStat, error)
}

Process defines an interface for interacting with system processes.

type ProcessDetector

type ProcessDetector interface {
	// Detect attempts to gather metadata for a given process. Returns an error if the detection fails.
	Detect(ctx context.Context, process Process) (*Metadata, error)
}

ProcessDetector defines an interface for detecting and categorizing processes.

type ProcessFilter

type ProcessFilter interface {
	ShouldInclude(ctx context.Context, process Process) bool
}

ProcessFilter determines if a process should be included in the detection results.

type Status

type Status string

Status represents whether the resource requires more actions before telemetry is available.

var (
	StatusReady                  Status = "READY"
	StatusNeedsSetupJmxPort      Status = "NEEDS_SETUP/JMX_PORT"
	StatusNeedsSetupNvidiaDriver Status = "NEEDS_SETUP/NVIDIA_DRIVER"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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