in code/log-processing/src/lib/logging/logger.js [145:173]
Dimensions: buildDimensions(service, options),
Timestamp: new Date(),
Unit: unit,
Value: value
},
],
Namespace: namespace
};
return metric
}
/**
* Builds correct format for custom metric dimensions from args.
*
* CloudWatch accepts a max of 10 dimensions per metric
* we include service name as a dimension
* so we take up to 9 values as additional dimensions
* before we return our dimensions array
*
* @param {JSON} service Service dimension. (e.g. {service: 'value'})
* @param {JSON} extra_dimensions Extra metric dimensions and. Optional. (e.g. {customer: customerId})
*
* @returns {Array} Dimensions in the form of [{Name: 'dim1', Value: 'val1'}, {Name: 'dim10', Value: 'val10'}]
*/
const buildDimensions = (service, extra_dimensions) => {
let dimensions = [{ Name: 'service', Value: service }]
if (extra_dimensions) {
Object.keys(extra_dimensions).forEach(k => {