OptionalcustomA custom configuration service to use for retrieving configuration values.
OptionaldefaultThe default dimensions to add to all metrics.
OptionalfunctionFunction name to use as dimension for the ColdStart metric.
When not provided, the function name is inferred either via:
POWERTOOLS_FUNCTION_NAME environment variablelogMetrics() decorator or the Middy.js middlewarefunctionName parameter in the captureColdStartMetric() methodIf none of the above are available, the ColdStart metric will not include a function name dimension.
OptionalloggerLogger object to be used for emitting debug, warning, and error messages.
If not provided, debug messages will be suppressed, and warning and error messages will be sent to stdout.
Note that EMF metrics are always sent directly to stdout, regardless of the logger to avoid compatibility issues with custom loggers.
OptionalnamespaceThe namespace to use for all metrics.
OptionalserviceThe service name to use for all metrics.
OptionalsingleWhether to configure the Metrics class to emit a single metric as soon as it is added.
Options to configure the Metrics class.
Example