Skip to content

ENT-6511: Increase cf-monitord measurement slots from 100 to 300#6239

Open
nickanderson wants to merge 2 commits into
cfengine:masterfrom
nickanderson:CFE-612-increase-monitor-slots
Open

ENT-6511: Increase cf-monitord measurement slots from 100 to 300#6239
nickanderson wants to merge 2 commits into
cfengine:masterfrom
nickanderson:CFE-612-increase-monitor-slots

Conversation

@nickanderson

@nickanderson nickanderson commented Jul 20, 2026

Copy link
Copy Markdown
Member

Raises CF_OBSERVABLES from 100 to 300. Previously out of the box ~80 of the 100 slots are consumed by default measurements, leaving only ~19 for custom measurements: promises.

Notably, this change does increase the disk footprint required by an agent by 60MB (.27MB per slot). That storage is required even if the slots are not in active use (Ref: ENT-14329)

Ticket: ENT-6511

~80 of the 100 slots are consumed by default measurements, leaving little
room for custom ones. Raise the limit to 300.

Kept in sync: CF_OBSERVABLES and the two cf-check copies of the on-disk
struct, plus the OBSERVABLES name table (GetObservable() indexes it for
unregistered slots, so a short table crashes cf-monitord). cf-check dump now
tolerates the shorter records and ts_key a pre-upgrade agent leaves behind.

Ticket: ENT-6511
Changelog: Increased the maximum number of cf-monitord measurement slots (CF_OBSERVABLES) from 100 to 300
@nickanderson

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins please.

@cf-bottom

Copy link
Copy Markdown

@nickanderson
nickanderson marked this pull request as ready for review July 20, 2026 16:27
@nickanderson
nickanderson requested a review from larsewi July 20, 2026 16:27

@larsewi larsewi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

Comment thread cf-check/dump.c Outdated
Comment on lines +165 to +168
// A record written before an increase of CF_OBSERVABLES is shorter than the
// current struct (e.g. after a package upgrade, until cf-monitord rewrites
// it). Accept any size up to the full struct and copy into a zeroed struct
// so the un-stored trailing slots read back as zero.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to do a DB migration like libpromises/dbm_migration_lastseen.c instead if its possible.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK ... this makes me wonder about the other DB backends like tcdb and qmdb and bdb, those aren't covered at all. I guess that's ok we don't vendor any packages with those

Raising CF_OBSERVABLES enlarges the fixed-size Averages record, so records
written by an older agent are shorter than the current struct. Added a
migration (modelled on dbm_migration_lastseen.c) that rewrites old records to
the current size, zero-filling the new slots, registered for the observations
and history DBs. This replaces the cf-check dump leniency with a one-time
on-disk migration; dump only needs to know the new "version" key.

Ticket: ENT-6511
Changelog: None
@nickanderson
nickanderson force-pushed the CFE-612-increase-monitor-slots branch from 1a91252 to 5f4e187 Compare July 21, 2026 14:41
@nickanderson
nickanderson requested a review from larsewi July 21, 2026 15:56
@nickanderson

Copy link
Copy Markdown
Member Author

@cf-bottom jenkins please.

@cf-bottom

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants