cgroupruntimeextension

package module
v0.162.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 2

README

Cgroup Go Runtime Extension

Status
Stability alpha
Unsupported Platforms darwin, windows
Distributions contrib, k8s
Issues Open issues Closed issues
Code coverage codecov
Code Owners @mx-psi, @rogercoll

Overview

The OpenTelemetry Cgroup Auto-Config Extension is designed to optimize Go runtime performance in containerized environments by automatically configuring GOMAXPROCS and GOMEMLIMIT based on the Linux cgroup filesystem. This extension leverages automaxprocs or gomaxecs for AWS ECS Tasks and automemlimit packages to dynamically adjust Go runtime variables, ensuring efficient resource usage aligned with container limits.

Configuration

The following settings can be configured:

  • gomaxprocs: Configures the behavior of setting GOMAXPROCS, the maximum number of CPUs for Go runtime. Options:

    • enabled: A boolean value to enable or disable automatic configuration of GOMAXPROCS based on the system’s cgroup settings (default: true).
  • gomemlimit: Configures the behavior of setting GOMEMLIMIT, the maximum memory limit for Go runtime. Options:

    • enabled: A boolean value to enable or disable automatic configuration of GOMEMLIMIT (default: true).
    • ratio: A floating-point value between 0 and 1 that represents the fraction of the detected memory limit to allocate for the Go runtime (default: 0.9).
    • refresh_interval: A duration value that enables periodic refresh of GOMEMLIMIT (default: 0s, disabled).

Examples

extensions:
  # processor name: cgroupruntime
  cgroup_runtime:
    gomaxprocs:
      enabled: true
    gomemlimit:
      enabled: true
      ratio: 0.8
      refresh_interval: 30s

Contributing

See CONTRIBUTING.md for information on how to contribute to this extension.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() extension.Factory

Types

type Config

type Config struct {
	GoMaxProcs GoMaxProcsConfig `mapstructure:"gomaxprocs"`
	GoMemLimit GoMemLimitConfig `mapstructure:"gomemlimit"`
	// contains filtered or unexported fields
}

func (*Config) Validate

func (cfg *Config) Validate() error

Validate checks if the extension configuration is valid

type GoMaxProcsConfig

type GoMaxProcsConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// contains filtered or unexported fields
}

type GoMemLimitConfig

type GoMemLimitConfig struct {
	Enabled bool    `mapstructure:"enabled"`
	Ratio   float64 `mapstructure:"ratio"`
	// RefreshInterval configures the refresh interval for GOMEMLIMIT.
	// Setting the duration to 0 (default) disables periodic auto update.
	RefreshInterval time.Duration `mapstructure:"refresh_interval"`
	// contains filtered or unexported fields
}

Directories

Path Synopsis
internal
metadata
Package metadata contains the autogenerated telemetry and build information for the extension/cgroup_runtime component.
Package metadata contains the autogenerated telemetry and build information for the extension/cgroup_runtime component.

Jump to

Keyboard shortcuts

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