approvedUnits constant

Set<String> const approvedUnits

Allowed values for expectedMagnitude.unit. Time units are recognised by _unitToMicroseconds and participate in the trace-vs-observed cross-check; non-time units pass the shape/positivity/invariant checks and skip the cross-check (a trace cannot certify bytes or frame counts). New units are a schema change — bump when adding.

Implementation

static const Set<String> approvedUnits = {
  // Time
  'ns', 'us', 'µs', 'ms', 's', 'sec', 'seconds',
  // Size
  'bytes', 'kb', 'mb',
  // Counts
  'frames', 'requests', 'gcevents', 'paints', 'rebuilds', 'builds',
  'events', 'instances',
  // Rates (size-per-time) — used by MemoryPressureDetector.heap_growing
  // (slope), and any future detector measuring throughput.
  'bytes/sec',
  // Ratios — used by FrameTimingDetector.jank_detected (jankPercent
  // observation over rolling 240-frame buffer; denominator-independent
  // axis under v0.19.6+ percent-axis bracket convention). Skips the
  // time-unit cross-check (a trace cannot certify a percent), but
  // participates in observedAxisArgKey + observedAxisReduction='last'
  // cross-check.
  'percent',
};