Ray's Knowledge Base
Unlock

dftracer-utils constants: a split rule between knobs and format values

DecisionVerified 2 Oct 2026Holds anywhere
Decision. The context, the choice, why, and the options that were turned down.

Context#

Deciding where constants live in dftracer-utils.

Decision#

Global tuning defaults, values that two or more libraries read, and every env var name with its default go in include/dftracer/utils/core/common/constants.h. Env vars use the DFTRACER_UTILS_ prefix and are read only through Env::get. A value that is part of a stored or wire format (key bytes, column family names, magic numbers) stays next to the code that reads and writes that format.

Why#

A knob is changed by users and benchmarks and must be greppable and documentable in one list. A format value cannot change without breaking stored data, so it belongs with its reader and writer.

Rejected options#

"Every area owns its constants"; one shared constants.h for everything, including format values.

Cost accepted#

Every library includes constants.h, so editing it rebuilds everything. Python cannot include the header, so any env var it reads needs a Python list with a parity test, or an extension that exports the names.

Also found by searching

  • where do global constants go in dftracer-utils
  • env var names DFTRACER_UTILS_ prefix read only through Env::get
  • format values stay next to the code that reads and writes them
  • one shared constants.h for everything rejected