1.4 KiB
1.4 KiB
Chart bounded context
Before working in server/chart/, read README.md — it covers the
architecture, the SCD + bitmap data model, sample strategies, and a step-by-step
guide for adding new datasets and charts.
Quick reminders (full detail in the README):
- This is a self-contained bounded context. No chart package may import
server/fleetorserver/contexts/viewer—arch_test.goenforces this. Bridge to legacy Fleet via a narrowapiinterface implemented inserver/acl/chartacl. - External code only touches
bootstrap.Newand theapipackage. - Data lives in one table,
host_scd_data(slowly-changing-dimension type-2), with host-sets stored as roaring bitmaps. Work in op form (*roaring.Bitmap); only cross the storage boundary viaBitmapToBlob/DecodeBitmap. - Mind the nil vs empty-slice semantics on
HostFilter.TeamIDsandGetSCDDataentityIDs— they are load-bearing; don't normalize them away. - Snapshot collectors must call
RecordBucketDataeven with an empty map (it closes open rows). Accumulate collectors may skip empty input. - Adding a dataset: implement
api.Datasetindatasets.go, add any store method to bothapi.DatasetStoreandinternal/types.Datastore, register it incmd/fleet/serve.go, and wire config gating + scrub inserver/fleet/historical_data.goif it's opt-in/out.