Help us shape the future of Go! Take the 2026 Go Developer Survey

metadata

package
v0.51.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Overview

containermetadata provides functionality for retrieving the kubernetes pod and container metadata or the docker container metadata for a particular PID. For kubernetes it uses the shared informer from the k8s client-go API (https://github.com/kubernetes/client-go/blob/master/tools/cache/shared_informer.go). Through the shared informer we are notified of changes in the state of pods in the Kubernetes cluster and can add the pod container metadata to the cache. As a backup to the kubernetes shared informer and to find the docker container metadata for each pid received (if it is not already in the container caches), it will retrieve the container id from the /proc/PID/cgroup and retrieve the metadata for the containerID.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDeferred = errors.New("lookup deferred due to previous failure")
)
View Source
var ErrFileParse = errors.New("Error Parsing File")

Functions

func GetControllerOf

func GetControllerOf(controllee v1.Object) *v1.OwnerReference

GetControllerOf returns a pointer to a copy of the controllerRef if controllee has a controller https://github.com/kubernetes/apimachinery/blob/cd2cae2b39fa57e8063fa1f5f13cfe9862db3d41/pkg/apis/meta/v1/controller_ref.go

func InKubernetes added in v0.50.1

func InKubernetes() bool

InKubernetes reports whether the agent runs inside a Kubernetes pod.

Types

type Config added in v0.51.0

type Config struct {
	LocalOnly           bool
	Semconv             bool
	KeepDiscoveryLabels bool
}

Config selects metadata discovery and the names providers emit. OTLP emits semconv keys directly; discovery labels are only needed for user relabel rules.

type ExecInfo

type ExecInfo struct {
	FileName string
	BuildID  string
	Compiler string
	Static   bool
	Stripped bool
	// IsELF is false for executables the profiler reports that are not ELF
	// files, such as .NET PE assemblies. Only ELF files are uploaded.
	IsELF bool
}

ExecInfo enriches an executable with additional metadata.

type MetadataProvider

type MetadataProvider interface {
	// AddMetadata adds metadata to the provided labels.Builder for the given PID.
	// It returns whether the metadata can be safely cached.
	AddMetadata(ctx context.Context, pid libpf.PID, lb *labels.Builder) bool
}

MetadataProvider implementations support adding metadata to a labels.Builder.

func NewAgentMetadataProvider

func NewAgentMetadataProvider(revision string) MetadataProvider

func NewContainerMetadataProvider

func NewContainerMetadataProvider(ctx context.Context, nodeName string, cfg Config) (MetadataProvider, error)

NewContainerMetadataProvider creates a new container metadata provider.

func NewLocalContainerMetadataProvider added in v0.51.0

func NewLocalContainerMetadataProvider() MetadataProvider

NewLocalContainerMetadataProvider reads container IDs and pod UIDs from procfs without initializing Kubernetes or container runtime clients. Set the resource label directly so memory profiles and GPU resources, which have no trace-event container ID, can also be enriched by the receiver. Pod UIDs also let GPU metrics and NVTX use a collector's resource-based pod association instead of associating by the agent's connection IP.

func NewMainExecutableMetadataProvider

func NewMainExecutableMetadataProvider(
	executableCache *lru.SyncedLRU[libpf.FileID, ExecInfo],
	cfg Config,
) MetadataProvider

NewMainExecutableMetadataProvider creates a new mainExecutableMetadataProvider.

func NewProcessMetadataProvider

func NewProcessMetadataProvider(cfg Config) MetadataProvider

NewProcessMetadataProvider creates a new processMetadataProvider.

func NewSystemMetadataProvider

func NewSystemMetadataProvider(cfg Config) (MetadataProvider, error)

type Role

type Role string

Role is role of the service in Kubernetes.

const (
	RolePod  Role = "pod"
	RoleNode Role = "node"
)

The valid options for Role.

Jump to

Keyboard shortcuts

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