Private constructorOptional event: anyOptional context: anyStatic Private contextStatic Private correlationStatic Private eventStatic Private instanceStatic Private metadataStatic Private metricStatic Private namespaceStatic Private servicePrivate canPrivate createCreate the base AWS EMF object shape.
Private createGet dynamic metadata with aws-metadata-utils and
add some extra bits on top.
Private createCreate the metric object.
Private filter"Flush" your metric log, which in plain English means "send it". The log will be picked up by CloudWatch Metrics automatically through the log format.
mikroMetric.flush();
Private hasPrivate isPut a dimension onto the metric log.
From the AWS docs: "A dimension is a name/value pair that is part of the identity of a metric. You can assign up to 30 dimensions to a metric".
mikroMetric.putDimension('User', 'Sam Person');
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension
Optional unit: UnitPut a metric onto the metric log.
mikroMetric.putMetric('Duration', 83, 'Milliseconds');
Set a property onto the metric log.
These will be shown in CloudWatch Logs (Insights) but not in CloudWatch Metrics.
mikroMetric.setProperty('RequestId', '422b1569-16f6-4a03-b8f0-fe3fd9b100f8');
Private sortStatic startOptional input: MikroMetricInputThis instantiates MikroMetric. In order to be able
to "remember" event and context we use a singleton pattern to
reuse the same logical instance.
mikroMetric.start({ namespace: 'MyNamespace', serviceName: 'MyService' });
Generated using TypeDoc
Description
MikroMetric is a Lambda-oriented lightweight wrapper for producing AWS CloudWatch Embedded Metric Format-compatible metric logs.
Example