github.com/grafana/pyroscope@v1.18.0/public/app/legacy/models/units.ts (about)

     1  import { z } from 'zod';
     2  
     3  export const units = [
     4    'samples',
     5    'objects',
     6    'goroutines',
     7    'bytes',
     8    'lock_samples',
     9    'lock_nanoseconds',
    10    'trace_samples',
    11    'exceptions',
    12    'nanoseconds',
    13  ] as const;
    14  
    15  export const UnitsSchema = z.preprocess(
    16    (u) => units.find((knownUnit) => u === knownUnit) || 'unknown',
    17    z.enum([...units, 'unknown'])
    18  );
    19  
    20  export type UnitsType = (typeof units)[number];
    21  export type Units = z.infer<typeof UnitsSchema>;