-
-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Labels
β¨ enhancementNew feature or requestNew feature or requestπ¨ breaking changechanges that require a major version bumpchanges that require a major version bump
Milestone
Description
The current data structure isn't very useful without any form of metadata for each metric. It should be an Array, or something that's easily tranformed into an array that makes sense.
Idea credit: Parker.js (π© @katiefenn)
β Current structure
const result = {
'stylesheets.size': 1,
'declarations.total': 2
}
β Proposed structure
const FORMATS = {
STRING: 'string',
RATIO: 'ratio',
FILESIZE: 'filesize',
COUNT: 'integer',
}
const AGGREGATES = {
SUM: 'sum',
AVERAGE: 'average',
MAX: 'max',
MIN: 'min',
LIST: 'list',
}
const result = {
'stylesheets.size': {
id: 'stylesheets.size', // duplication, but very convenient
name: 'Filesize (bytes)',
aggregate: AGGREGATES.SUM,
format: FORMATS.FILESIZE,
value: 2376, // The actual value that we're interested in
},
}
π Advantages
- Easy to see how to interpret or consume a metric. Especially for other services that rely on these metrics.
- Easy to turn into an array with
Object.values(result)
. Also easy to get back the 'old' style result withObject.entries
.
Metadata
Metadata
Assignees
Labels
β¨ enhancementNew feature or requestNew feature or requestπ¨ breaking changechanges that require a major version bumpchanges that require a major version bump