Skip to content

[9.2](backport #48054) [Metricbeat] Add memory PSI metrics for cgroupv2#49056

Merged
rdner merged 2 commits into9.2from
mergify/bp/9.2/pr-48054
Feb 24, 2026
Merged

[9.2](backport #48054) [Metricbeat] Add memory PSI metrics for cgroupv2#49056
rdner merged 2 commits into9.2from
mergify/bp/9.2/pr-48054

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Feb 24, 2026

Proposed commit message

Add memory pressure PSI metrics to the system.process.cgroup.memory
metricset, complementing the existing CPU and IO pressure metrics.

New fields added under system.process.cgroup.memory.pressure:

  • pressure.some.{10,60,300}.pct - Share of time with some tasks stalled
  • pressure.some.total - Total some pressure time
  • pressure.full.{10,60,300}.pct - Share of time with all tasks stalled
  • pressure.full.total - Total full pressure time

Closes #47604

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

How to test this PR locally

1. Build and Run Metricbeat

cd metricbeat
go build .

2. Create Test Configuration

metricbeat.modules:
- module: system
  period: 5s
  metricsets:
    - process
  processes: ['.*']
  process.cgroups.enabled: true

output.console:
  pretty: true

3. Run Metricbeat

./metricbeat -e -c /tmp/metricbeat-psi-test.yml

4. Verify Memory Pressure Fields

Look for system.process.cgroup.memory.pressure in the output:

"memory": {
  "pressure": {
    "some": {
      "10": { "pct": 0 },
      "60": { "pct": 0 },
      "300": { "pct": 0 },
      "total": 0
    },
    "full": {
      "10": { "pct": 0 },
      "60": { "pct": 0 },
      "300": { "pct": 0 },
      "total": 0
    }
  }
}

5. Compare Before/After (Optional)

compare-psi-metrics.sh
Use the comparison script to compare output from main vs this PR:

compare-psi-metrics.sh
Usage: ./compare-psi-metrics.sh <main-output.ndjson> <pr-output.ndjson>

Related issues


This is an automatic backport of pull request #48054 done by [Mergify](https://mergify.com).

## Proposed commit message
Add memory pressure PSI metrics to the system.process.cgroup.memory
metricset, complementing the existing CPU and IO pressure metrics.

New fields added under system.process.cgroup.memory.pressure:
- pressure.some.{10,60,300}.pct - Share of time with some tasks stalled
- pressure.some.total - Total some pressure time
- pressure.full.{10,60,300}.pct - Share of time with all tasks stalled
- pressure.full.total - Total full pressure time

Closes #47604

## How to test this PR locally

### 1. Build and Run Metricbeat

```bash
cd metricbeat
go build .
```

### 2. Create Test Configuration

```yaml
metricbeat.modules:
- module: system
  period: 5s
  metricsets:
    - process
  processes: ['.*']
  process.cgroups.enabled: true

output.console:
  pretty: true
```

### 3. Run Metricbeat

```bash
./metricbeat -e -c /tmp/metricbeat-psi-test.yml
```

### 4. Verify Memory Pressure Fields

Look for `system.process.cgroup.memory.pressure` in the output:
```json
"memory": {
  "pressure": {
    "some": {
      "10": { "pct": 0 },
      "60": { "pct": 0 },
      "300": { "pct": 0 },
      "total": 0
    },
    "full": {
      "10": { "pct": 0 },
      "60": { "pct": 0 },
      "300": { "pct": 0 },
      "total": 0
    }
  }
}
```

### 5. Compare Before/After (Optional)
[compare-psi-metrics.sh](https://github.com/user-attachments/files/24191696/compare-psi-metrics.sh)
Use the comparison script to compare output from main vs this PR:

```
compare-psi-metrics.sh
Usage: ./compare-psi-metrics.sh <main-output.ndjson> <pr-output.ndjson>
```

## Related issues

- Requires elastic/elastic-agent-system-metrics#274
- Closes #47604

(cherry picked from commit c3f35a9)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
@mergify mergify bot requested review from a team as code owners February 24, 2026 10:01
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Feb 24, 2026
@mergify mergify bot requested a review from a team as a code owner February 24, 2026 10:01
@mergify mergify bot requested review from faec and mauri870 and removed request for a team February 24, 2026 10:01
@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Feb 24, 2026

Cherry-pick of c3f35a9 has failed:

On branch mergify/bp/9.2/pr-48054
Your branch is up to date with 'origin/9.2'.

You are currently cherry-picking commit c3f35a907.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   changelog/fragments/1765878935-metricbeat-cgroup-memory-pressure.yaml
	modified:   docs/reference/metricbeat/exported-fields-system.md
	modified:   docs/reference/metricbeat/metricbeat-metricset-system-process.md
	modified:   metricbeat/module/system/fields.go
	modified:   metricbeat/module/system/process/_meta/data.json
	modified:   metricbeat/module/system/process/_meta/fields.yml
	modified:   metricbeat/module/system/process/process_test.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   NOTICE.txt
	both modified:   go.mod
	both modified:   go.sum

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions github-actions bot added enhancement Team:Docs Label for the Observability docs team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Feb 24, 2026
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 24, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 24, 2026

✅ Vale Linting Results

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide.

To use Vale locally or report issues, refer to Elastic style guide for Vale.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 24, 2026

@rdner rdner requested review from rdner and removed request for a team, faec and mauri870 February 24, 2026 10:10
@rdner rdner assigned rdner and unassigned orestisfl Feb 24, 2026
@rdner rdner enabled auto-merge (squash) February 24, 2026 10:15
@rdner rdner merged commit ccb68c9 into 9.2 Feb 24, 2026
53 checks passed
@rdner rdner deleted the mergify/bp/9.2/pr-48054 branch February 24, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport conflicts There is a conflict in the backported pull request enhancement Team:Docs Label for the Observability docs team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants