[Flaky Test] metricbeat.module.system.test_system.Test test_process_summary
- Dominant language
- Go
- Stars
- 12.7k
- Forks
- 5k
- Avg merge
- 2d 15m
- Merged PRs (30d)
- 385
Description
## Flaky Test
* **Test Name:** test_process_summary
* **Scope:** metricbeat.module.system.test_system.Test
* **File:** metricbeat/module/system/test_system.py
* **Location:** metricbeat/module/system/test_system.py:394
* **Buildkite Link:** https://buildkite.com/organizations/elastic/analytics/suites/beats/tests/b0bdeaac-1950-8bc4-aafa-3f22d9cdd0ba
* **Flaky Instances:** 1
* **Latest Occurrence:** 2026-04-27T03:34:28.756Z
### Details
```json
{
"id": "b0bdeaac-1950-8bc4-aafa-3f22d9cdd0ba",
"web_url": "https://buildkite.com/organizations/elastic/analytics/suites/beats/tests/b0bdeaac-1950-8bc4-aafa-3f22d9cdd0ba",
"scope": "metricbeat.module.system.test_system.Test",
"name": "test_process_summary",
"location": "metricbeat/module/system/test_system.py:394",
"file_name": "metricbeat/module/system/test_system.py",
"instances": 1,
"latest_occurrence_at": "2026-04-27T03:34:28.756Z",
"most_recent_instance_at": "2026-04-27T03:34:28.756Z",
"last_resolved_at": null,
"ownership_team_ids": [],
"failure_examples_count": 1
}
```
### Failure Examples
**Example 1:**
**Run:** https://api.buildkite.com/v2/analytics/organizations/elastic/suites/beats/runs/0072e5dc-8068-8f6f-83eb-b4b6028ec812
**Time:** 2026-04-27T03:02:51.844Z
**Stacktrace:**
```
self =
@unittest.skipUnless(re.match("(?i)win|linux|darwin|freebsd", sys.platform), "os")
def test_process_summary(self):
"""
Test system/process_summary output.
"""
self.render_config_template(modules=[{
"name": "system",
"metricsets": ["process_summary"],
"period": "5s",
}])
self.run_beat_and_stop()
output = self.read_output_json()
self.assertGreater(len(output), 0)
only_errors_encountered = True
for evt in output:
> self.assert_fields_are_documented(evt)
module/system/test_system.py:412:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
evt = {'@timestamp': '2026-04-27T03:04:40.340Z', 'agent': {'ephemeral_id': '8d9df52c-5840-4ef1-8f1e-76902b2037d2', 'id': 'd3...s': {'version': '8.0.0'}, 'event': {'dataset': 'system.process.summary', 'duration': 4117208, 'module': 'system'}, ...}
def assert_fields_are_documented(self, evt):
"""
Assert that all keys present in evt are documented in fields.yml.
This reads from the global fields.yml, means `mage fields` has to be run before the check.
"""
expected_fields, dict_fields, aliases = self.load_fields()
flat = self.flatten_object(evt, dict_fields)
def field_pattern_match(pattern, key):
pattern_fields = pattern.split(".")
key_fields = key.split(".")
if len(pattern_fields) != len(key_fields):
return False
for i in range(len(pattern_fields)):
if pattern_fields[i] == "*":
continue
if pattern_fields[i] != key_fields[i]:
return False
return True
def is_documented(key, docs):
if key in docs:
return True
for pattern in (f for f in docs if "*" in f):
if field_pattern_match(pattern, key):
return True
return False
undocumented_keys = []
is_documented_aliases = []
for key in flat.keys():
meta_key = key.startswith('@metadata.')
# Range keys as used in 'date_range' etc will not have docs of course
is_range_key = key.split('.')[-1] in ['gte', 'gt', 'lte', 'lt']
if not(is_documented(key, expected_fields) or meta_key or is_range_key):
undocumented_keys.append(key)
if is_documented(key, aliases):
is_documented_aliases.append(key)
if undocumented_keys:
> raise Exception(f"Keys:\n\n{undocumented_keys}\n\nnot documented in event:\n\n{str(evt)}\n")
E Exception: Keys:
E
E ['system.process.summary.disk_sleep']
E
E not documented in event:
E
E {'@timestamp': '2026-04-27T03:04:40.340Z', 'event': {'dataset': 'system.process.summary', 'module': 'system', 'duration': 4117208}, 'metricset': {'name': 'process_summary', 'period': 5000}, 'ecs': {'version': '8.0.0'}, 'host': {'name': 'bk-agent-prod-gcp-1777258708281031237'}, 'agent': {'version': '9.5.0', 'ephemeral_id': '8d9df52c-5840-4ef1-8f1e-76902b2037d2', 'id': 'd33b0bc5-6215-403e-b5e6-da8f608e7b73', 'name': 'bk-agent-prod-gcp-1777258708281031237', 'type': 'metricbeat'}, 'service': {'type': 'system'}, 'system': {'process': {'summary': {'sleeping': 82, 'threads': {'running': 1, 'blocked': 1}, 'total': 159, 'idle': 76, 'disk_sleep': 1}}}}
../libbeat/tests/system/beat/beat.py:862: Exception
```
Contributor guide
Research direction
Start with metricbeat/module/system/test_system.py at test_process_summary, around line 394, and the assert_fields_are_documented failure. Run the named test and inspect the fields.yml loading and generation noted in the test; done means the test no longer reports system.process.summary.disk_sleep as undocumented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, python
- Domain
- observability-sre, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100