ENT-6511: Increase cf-monitord measurement slots from 100 to 300#20
Closed
nickanderson wants to merge 1 commit into
Closed
ENT-6511: Increase cf-monitord measurement slots from 100 to 300#20nickanderson wants to merge 1 commit into
nickanderson wants to merge 1 commit into
Conversation
nickanderson
force-pushed
the
CFE-612-increase-monitor-slots
branch
from
July 20, 2026 07:32
8cf4641 to
3aebd63
Compare
nickanderson
force-pushed
the
CFE-612-increase-monitor-slots
branch
5 times, most recently
from
July 20, 2026 14:42
2110807 to
8a9567c
Compare
Out of the box ~80 of 100 measurement slots are used by default measurements, leaving little room for custom measurements. This change increases the maximum number of slots to 300. Changes are synchronized across: - libpromises/cf3.defs.h (main constant) - cf-check/observables.h (cf-check copy) - cf-check/db_structs.h (LMDB struct layout) - libpromises/constants.c (OBSERVABLES name table) - tests/unit/mon_*_test.c (unit test buffers) The OBSERVABLES name table must have an entry per slot: cf-monitord's GetObservable() falls back to OBSERVABLES[i] for any slot without a registered measurement, so leaving the table at 100 entries while raising CF_OBSERVABLES makes cf-monitord read past its end (NULL) and crash on the first sampling pass, whether or not any custom measurements are configured. The table is extended to 300 entries to match. cf-check dump must tolerate monitoring state written before the upgrade: a pre-upgrade record is shorter than the enlarged Averages struct, and the pre-upgrade ts_key has fewer than CF_OBSERVABLES entries. dump.c now accepts a record up to sizeof(Averages) (copied into a zeroed struct) and GetObservableNames() fills any missing names with a spare[] fallback instead of leaving the array partly uninitialized, so `cf-check dump` does not crash on pre-upgrade state in the brief window before cf-monitord rewrites it. Ticket: ENT-6511 Changelog: Increased the maximum number of cf-monitord measurement slots (CF_OBSERVABLES) from 100 to 300
nickanderson
force-pushed
the
CFE-612-increase-monitor-slots
branch
from
July 20, 2026 15:15
8a9567c to
50d4f8a
Compare
Owner
Author
|
Superseded by the upstream PR against cfengine/core: cfengine#6239 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Increased
CF_OBSERVABLESfrom 100 to 300 across all relevant headers to allow cf-monitord to measure up to 300 things.Changes
libpromises/cf3.defs.h:CF_OBSERVABLES 100 -> 300cf-check/observables.h:CF_OBSERVABLES 100 -> 300cf-check/db_structs.h:CF_OBSERVABLES 100 -> 300tests/unit/mon_cpu_test.c: array size[100] -> [300]tests/unit/mon_load_test.c: array size[100] -> [300]tests/unit/mon_processes_test.c: array size[100] -> [300]tests/unit/mon_slots_test.c: new — verifies 300-slot capacity (5 tests)core/NOTES_ENT-6511.md: documentationVerification
CF_OBSERVABLES = 300consistent in all 3 headersSLOTS[228]custom slots available (300 - 72 built-in)sizeof(Averages) = 9,608 bytesmatches across all modulesmon_slots_test.cpasses all 5 assertionsmakesucceeds cleanly