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 ¶
- Variables
- func GetControllerOf(controllee v1.Object) *v1.OwnerReference
- func InKubernetes() bool
- type Config
- type ExecInfo
- type MetadataProvider
- func NewAgentMetadataProvider(revision string) MetadataProvider
- func NewContainerMetadataProvider(ctx context.Context, nodeName string, cfg Config) (MetadataProvider, error)
- func NewLocalContainerMetadataProvider() MetadataProvider
- func NewMainExecutableMetadataProvider(executableCache *lru.SyncedLRU[libpf.FileID, ExecInfo], cfg Config) MetadataProvider
- func NewProcessMetadataProvider(cfg Config) MetadataProvider
- func NewSystemMetadataProvider(cfg Config) (MetadataProvider, error)
- type Role
Constants ¶
This section is empty.
Variables ¶
var (
ErrDeferred = errors.New("lookup deferred due to previous failure")
)
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
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 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.
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)