@aws-lambda-powertools/metrics
Version:
The metrics package for the Powertools for AWS Lambda (TypeScript) library
97 lines (96 loc) • 3.53 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EMF_MAX_TIMESTAMP_FUTURE_AGE = exports.EMF_MAX_TIMESTAMP_PAST_AGE = exports.MetricResolution = exports.MetricUnit = exports.MAX_DIMENSION_COUNT = exports.MAX_METRIC_VALUES_SIZE = exports.MAX_METRICS_SIZE = exports.MAX_METRIC_NAME_LENGTH = exports.MIN_METRIC_NAME_LENGTH = exports.DEFAULT_NAMESPACE = exports.COLD_START_METRIC = void 0;
/**
* The dimension key for the cold start metric.
*/
const COLD_START_METRIC = 'ColdStart';
exports.COLD_START_METRIC = COLD_START_METRIC;
/**
* The default namespace for metrics.
*/
const DEFAULT_NAMESPACE = 'default_namespace';
exports.DEFAULT_NAMESPACE = DEFAULT_NAMESPACE;
/**
* The minimum length constraint of the metric name
*/
const MIN_METRIC_NAME_LENGTH = 1;
exports.MIN_METRIC_NAME_LENGTH = MIN_METRIC_NAME_LENGTH;
/**
* The maximum length constraint of the metric name
*/
const MAX_METRIC_NAME_LENGTH = 255;
exports.MAX_METRIC_NAME_LENGTH = MAX_METRIC_NAME_LENGTH;
/**
* The maximum number of metrics that can be emitted in a single EMF blob.
*/
const MAX_METRICS_SIZE = 100;
exports.MAX_METRICS_SIZE = MAX_METRICS_SIZE;
/**
* The maximum number of metric values that can be emitted in a single metric.
*/
const MAX_METRIC_VALUES_SIZE = 100;
exports.MAX_METRIC_VALUES_SIZE = MAX_METRIC_VALUES_SIZE;
/**
* The maximum number of dimensions that can be added to a metric (0-indexed).
*/
const MAX_DIMENSION_COUNT = 29;
exports.MAX_DIMENSION_COUNT = MAX_DIMENSION_COUNT;
/**
* The maximum age of a timestamp in milliseconds that can be emitted in a metric.
* This is set to 14 days.
*/
const EMF_MAX_TIMESTAMP_PAST_AGE = 14 * 24 * 60 * 60 * 1000;
exports.EMF_MAX_TIMESTAMP_PAST_AGE = EMF_MAX_TIMESTAMP_PAST_AGE;
/**
* The maximum age of a timestamp in milliseconds that can be emitted in a metric.
* This is set to 2 hours.
*/
const EMF_MAX_TIMESTAMP_FUTURE_AGE = 2 * 60 * 60 * 1000;
exports.EMF_MAX_TIMESTAMP_FUTURE_AGE = EMF_MAX_TIMESTAMP_FUTURE_AGE;
/**
* The unit of the metric.
*
* @see {@link https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Unit | Amazon CloudWatch Units}
* @see {@link https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html | Amazon CloudWatch MetricDatum}
*/
const MetricUnit = {
Seconds: 'Seconds',
Microseconds: 'Microseconds',
Milliseconds: 'Milliseconds',
Bytes: 'Bytes',
Kilobytes: 'Kilobytes',
Megabytes: 'Megabytes',
Gigabytes: 'Gigabytes',
Terabytes: 'Terabytes',
Bits: 'Bits',
Kilobits: 'Kilobits',
Megabits: 'Megabits',
Gigabits: 'Gigabits',
Terabits: 'Terabits',
Percent: 'Percent',
Count: 'Count',
BytesPerSecond: 'Bytes/Second',
KilobytesPerSecond: 'Kilobytes/Second',
MegabytesPerSecond: 'Megabytes/Second',
GigabytesPerSecond: 'Gigabytes/Second',
TerabytesPerSecond: 'Terabytes/Second',
BitsPerSecond: 'Bits/Second',
KilobitsPerSecond: 'Kilobits/Second',
MegabitsPerSecond: 'Megabits/Second',
GigabitsPerSecond: 'Gigabits/Second',
TerabitsPerSecond: 'Terabits/Second',
CountPerSecond: 'Count/Second',
NoUnit: 'None',
};
exports.MetricUnit = MetricUnit;
/**
* The resolution of the metric.
*
* @see {@link https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Resolution_definition | Amazon CloudWatch Resolution}
*/
const MetricResolution = {
Standard: 60,
High: 1,
};
exports.MetricResolution = MetricResolution;