> ## Documentation Index
> Fetch the complete documentation index at: https://otel.fyi/llms.txt
> Use this file to discover all available pages before exploring further.

# Cgroupruntime

> OpenTelemetry extension for Cgroupruntime

# Cgroupruntime Extension

![Status](https://img.shields.io/badge/status-alpha-red)

**Available in:** `contrib`

**Maintainers:** [@mx-psi](https://github.com/mx-psi), [@rogercoll](https://github.com/rogercoll)

**Source:** [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/cgroupruntimeextension)

## Overview

## 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](https://github.com/uber-go/automaxprocs) or [gomaxecs](https://github.com/rdforte/gomaxecs) for AWS ECS Tasks and [automemlimit](https://github.com/KimMachineGun/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

```yaml theme={null}
extensions:
  # processor name: cgroupruntime
  cgroup_runtime:
    gomaxprocs:
      enabled: true
    gomemlimit:
      enabled: true
      ratio: 0.8
      refresh_interval: 30s
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for information on how to contribute to this extension.

## Configuration

### Example Configuration

```yaml theme={null}
cgroup_runtime:
cgroup_runtime/invalid_ratio:
  gomemlimit:
    ratio: 1.1
cgroup_runtime/invalid_ratio_disabled:
  gomemlimit:
    ratio: 0
cgroup_runtime/invalid_ratio_negative:
  gomemlimit:
    ratio: -12.5
cgroup_runtime/invalid_ratio_type:
  gomemlimit:
    ratio: "not_valid"
cgroup_runtime/invalid_refresh_interval:
  gomemlimit:
    refresh_interval: -10s
```

***

*Last generated: 2026-07-06*
