diff --git a/dist/cjs/index.d.ts b/dist/cjs/index.d.ts index 742646b..214a91b 100644 --- a/dist/cjs/index.d.ts +++ b/dist/cjs/index.d.ts @@ -1,4 +1,4 @@ -import { Schema, Version } from './schema'; +import { Schema } from './schema'; import { Entity, Table } from 'dynamodb-onetable'; type SpanDef = { period: number; @@ -60,7 +60,6 @@ export type MetricEmitOptions = { ttl?: number; }; export type MetricListOptions = { - fields?: string[]; log?: boolean; limit?: number; next?: object; @@ -92,8 +91,9 @@ export declare class CustomMetrics { private ttl; constructor(options?: MetricOptions); emit(namespace: string, metricName: string, value: number, dimensionsList?: MetricDimensionsList, options?: MetricEmitOptions): Promise; - private emitDimensionMetric; - bufferMetric(namespace: string, metricName: string, value: number, dimensionsList: MetricDimensionsList, options: MetricBufferOptions): Point; + private emitDimensions; + private emitDimensionedMetric; + bufferMetric(namespace: string, metricName: string, value: number, dimensionsList: MetricDimensionsList, options: MetricEmitOptions): Promise; static terminate(): Promise; static flushAll(): Promise; flush(): Promise; @@ -115,5 +115,8 @@ export declare class CustomMetrics { static getCache(): InstanceMap; private getTimestamp; private assert; + private info; + private error; + private nop; } -export { Schema, Version }; +export {}; diff --git a/dist/cjs/index.js b/dist/cjs/index.js index df6246c..f6ce1d3 100644 --- a/dist/cjs/index.js +++ b/dist/cjs/index.js @@ -3,11 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.Version = exports.Schema = exports.CustomMetrics = exports.DefaultSpans = void 0; +exports.CustomMetrics = exports.DefaultSpans = void 0; const process_1 = __importDefault(require("process")); const schema_1 = require("./schema"); -Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return schema_1.Schema; } }); -Object.defineProperty(exports, "Version", { enumerable: true, get: function () { return schema_1.Version; } }); const dynamodb_onetable_1 = require("dynamodb-onetable"); const Assert = true; const Buffering = true; @@ -31,25 +29,16 @@ class CustomMetrics { constructor(options = {}) { this.buffers = {}; if (options.log == true) { - this.log = { - info: (message, context) => null, - error: (message, context) => console.log('ERROR: ' + message, context), - }; + this.log = { info: this.nop, error: this.error }; } else if (options.log == 'verbose') { - this.log.info = (message, context) => console.log('INFO: ' + message, context); + this.log = { info: this.info, error: this.error }; } else if (options.log) { this.log = options.log; } else { - this.log = { - info: (message, context) => null, - error: (message, context) => null, - }; - } - if (!options.owner) { - throw new Error('Missing required "owner" in options'); + this.log = { info: this.nop, error: this.nop }; } if (options.ttl && typeof options.ttl != 'number') { throw new Error('Bad type for "ttl" option'); @@ -131,29 +120,20 @@ class CustomMetrics { let point; let buffer = options.buffer || this.buffer; if (buffer && Buffering) { - point = this.bufferMetric(namespace, metricName, value, dimensionsList, buffer); - if (point.timestamp === 0) { - let result = { - spans: [{ points: [point] }], - metric: metricName, - namespace: namespace, - owner: options.owner || this.owner, - version: schema_1.Version, - }; - return result; - } - } - else { - point = { count: 1, sum: value }; + return await this.bufferMetric(namespace, metricName, value, dimensionsList, options); } + point = { count: 1, sum: value }; + return await this.emitDimensions(namespace, metricName, point, dimensionsList, options); + } + async emitDimensions(namespace, metricName, point, dimensionsList, options) { let result; for (let dimensions of dimensionsList) { let dimString = this.makeDimensionString(dimensions); - result = await this.emitDimensionMetric(namespace, metricName, point, dimString, options); + result = await this.emitDimensionedMetric(namespace, metricName, point, dimString, options); } return result; } - async emitDimensionMetric(namespace, metricName, point, dimensions, options = {}) { + async emitDimensionedMetric(namespace, metricName, point, dimensions, options = {}) { let ttl = options.ttl != undefined ? options.ttl : this.ttl; let retries = MaxRetries; let metric; @@ -194,35 +174,40 @@ class CustomMetrics { } while (retries-- > 0); return metric; } - bufferMetric(namespace, metricName, value, dimensionsList, options) { + async bufferMetric(namespace, metricName, value, dimensionsList, options) { + let buffer = options.buffer || this.buffer; let interval = this.spans[0].period / this.spans[0].samples; let key = `${namespace}|${metricName}|${JSON.stringify(dimensionsList)}`; let elt = (this.buffers[key] = this.buffers[key] || { count: 0, sum: 0, - timestamp: this.timestamp + (options.elapsed || interval), + timestamp: this.timestamp + (buffer.elapsed || interval), namespace: namespace, metric: metricName, dimensions: dimensionsList, }); - elt.sum += value; - elt.count++; - if (options.force || - (options.sum && elt.sum >= options.sum) || - (options.count && elt.count >= options.count) || + if (buffer.force || + (buffer.sum && elt.sum >= buffer.sum) || + (buffer.count && elt.count >= buffer.count) || this.timestamp >= elt.timestamp) { - delete this.buffers[key]; - this.log.info(`Emit buffered metric ${namespace}/${metricName} = ${value}, sum ${elt.sum} count ${elt.count} remaining ${elt.timestamp - this.timestamp}`, { elt, buffers: this.buffers }); - return { count: elt.count, sum: elt.sum, timestamp: elt.timestamp }; + this.log.info(`Emit buffered metric ${namespace}/${metricName} = ${value}, sum ${elt.sum} count ${elt.count} remaining ${elt.timestamp - this.timestamp}`); + let point = { count: elt.count, sum: elt.sum, timestamp: elt.timestamp }; + await this.emitDimensions(namespace, metricName, point, dimensionsList, options); } - CustomMetrics.saveInstance({ key }, this); + elt.count++; + elt.sum += value; this.log.info(`Buffer metric ${namespace}/${metricName} = ${value}, sum ${elt.sum} count ${elt.count}, remaining ${elt.timestamp - this.timestamp}`); - return { count: elt.count, sum: elt.sum, timestamp: 0 }; + CustomMetrics.saveInstance({ key }, this); + return { + spans: [{ points: [{ count: elt.count, sum: elt.sum }] }], + metric: metricName, + namespace: namespace, + owner: options.owner || this.owner, + version: schema_1.Version, + }; } static async terminate() { - let start = Date.now(); await CustomMetrics.flushAll(); - console.log(`Lambda terminating, metric flush took ${(Date.now() - start) / 1000} ms`); } static async flushAll() { for (let [key, instance] of Object.entries(Instances)) { @@ -235,7 +220,7 @@ class CustomMetrics { for (let elt of Object.values(this.buffers)) { let point = { count: elt.count, sum: elt.sum }; for (let dimensions of elt.dimensions) { - await this.emitDimensionMetric(elt.namespace, elt.metric, point, this.makeDimensionString(dimensions)); + await this.emitDimensionedMetric(elt.namespace, elt.metric, point, this.makeDimensionString(dimensions)); } } this.buffers = {}; @@ -281,7 +266,7 @@ class CustomMetrics { else { result = { dimensions, metric: metricName, namespace, period, points: [], owner }; } - this.log.info(`Metric query ${namespace}, ${metricName}, ${this.makeDimensionString(dimensions)}, ` + + this.log.info(`Metric query ${namespace}, ${metricName}, ${this.makeDimensionString(dimensions) || '[]'}, ` + `period ${period}, statistic "${statistic}"`, { result }); return result; } @@ -323,19 +308,17 @@ class CustomMetrics { } else if (statistic == 'sum') { value += point.sum; - count += point.count; } else if (statistic == 'count') { value += point.count; - count += point.count; } else if (statistic.match(/^p[0-9]+/)) { - pvalues = pvalues.concat(point.pvalues || []); + pvalues = pvalues.concat(point.pvalues); } else { value += point.sum; - count += point.count; } + count += point.count; } if (statistic.match(/^p[0-9]+/)) { let p = parseInt(statistic.slice(1)); @@ -344,7 +327,7 @@ class CustomMetrics { value = pvalues[nth]; } else if (statistic == 'avg') { - value /= count || 1; + value /= Math.max(count, 1); } return { dimensions: this.makeDimensionObject(metric.dimensions), @@ -359,9 +342,9 @@ class CustomMetrics { let points = []; let interval = span.period / span.samples; let timestamp = span.end - span.points.length * interval; + let value; let i = 0; for (let point of span.points) { - let value; if (point.count > 0) { if (statistic == 'max') { if (point.max != undefined) { @@ -391,13 +374,13 @@ class CustomMetrics { } else if (statistic.match(/^p[0-9]+/)) { let p = parseInt(statistic.slice(1)); - let pvalues = point.pvalues || []; + let pvalues = point.pvalues; pvalues.sort((a, b) => a - b); let nth = Math.min(Math.round((pvalues.length * p) / 100 + 1), pvalues.length - 1); value = pvalues[nth]; } else { - value = point.sum / (point.count || 1); + value = point.sum / point.count; } } timestamp += interval; @@ -416,10 +399,7 @@ class CustomMetrics { } makeDimensionString(dimensions) { let result = []; - for (let [name, value] of Object.entries(dimensions || {})) { - if (Array.isArray(value)) { - this.log.error(`Dimension is an array`, { value, dimensions }); - } + for (let [name, value] of Object.entries(dimensions)) { result.push(`${name}=${value}`); } return result.join(','); @@ -442,35 +422,37 @@ class CustomMetrics { let interval = span.period / span.samples; let points = span.points; let start = span.end - points.length * interval; - let period = span.period < queryPeriod ? queryPeriod : 0; + let aggregate = !queryPeriod || span.period < queryPeriod ? true : false; + while (points.length > span.samples) { + points.shift(); + } if (points.length) { if (timestamp < start) { - this.log.error('Bad span', { metric, point, timestamp, start, span }); + this.log.error('Bad metric span', { metric, point, timestamp, start, span }); return; } let shift = 0; - if (queryPeriod) { - if (period) { - shift = points.length; - } + if (queryPeriod && aggregate) { + shift = points.length; } else if (point.count) { - shift = (timestamp - start) / interval - span.samples + 1; + shift = Math.floor((timestamp - start) / interval) - span.samples + 1; + } + else if (queryPeriod) { + shift = Math.floor((timestamp - start) / interval) - span.samples; } shift = Math.max(0, Math.min(shift, points.length)); this.assert(0 <= shift && shift <= points.length); while (shift-- > 0) { let p = points.shift(); - if (p.count && si + 1 < metric.spans.length) { - this.addValue(metric, start, p, si + 1, period); + if (aggregate && p.count && si + 1 < metric.spans.length) { + this.addValue(metric, start, p, si + 1, queryPeriod); } start += interval; } } - if (period) { - if (si + 1 < metric.spans.length) { - this.addValue(metric, timestamp, point, si + 1, period); - } + if (aggregate && queryPeriod && si + 1 < metric.spans.length) { + this.addValue(metric, timestamp, point, si + 1, queryPeriod); } else if (point.count) { if (points.length == 0) { @@ -516,7 +498,7 @@ class CustomMetrics { if (this.pResolution) { point.pvalues = point.pvalues || []; if (add.pvalues) { - point.pvalues.push(...(add.pvalues || [add.sum / add.count])); + point.pvalues.push(...add.pvalues); } else { point.pvalues.push(add.sum / add.count); @@ -549,17 +531,8 @@ class CustomMetrics { stats, where, }); - let size = JSON.stringify(result).length; - this.log.info(`Emit metric: ${metric.namespace}/${metric.metric}/${metric.dimensions} = ${point.sum}, msize ${size}`, { - metric, - point, - stats, - }); } - async getMetricList(namespace = undefined, metric = undefined, options = { fields: ['pk', 'sk'], limit: MetricListLimit }) { - if (!options.fields) { - options.fields = ['pk', 'sk']; - } + async getMetricList(namespace = undefined, metric = undefined, options = { limit: MetricListLimit }) { let map = {}; let next; let owner = options.owner || this.owner; @@ -655,5 +628,12 @@ class CustomMetrics { this.log.error(`Assertion failed ${msg.stack}`); } } + info(message, context = {}) { + console.log('INFO: ' + message, context); + } + error(message, context = {}) { + console.log('ERROR: ' + message, context); + } + nop() { } } exports.CustomMetrics = CustomMetrics; diff --git a/dist/mjs/index.d.ts b/dist/mjs/index.d.ts index 742646b..214a91b 100644 --- a/dist/mjs/index.d.ts +++ b/dist/mjs/index.d.ts @@ -1,4 +1,4 @@ -import { Schema, Version } from './schema'; +import { Schema } from './schema'; import { Entity, Table } from 'dynamodb-onetable'; type SpanDef = { period: number; @@ -60,7 +60,6 @@ export type MetricEmitOptions = { ttl?: number; }; export type MetricListOptions = { - fields?: string[]; log?: boolean; limit?: number; next?: object; @@ -92,8 +91,9 @@ export declare class CustomMetrics { private ttl; constructor(options?: MetricOptions); emit(namespace: string, metricName: string, value: number, dimensionsList?: MetricDimensionsList, options?: MetricEmitOptions): Promise; - private emitDimensionMetric; - bufferMetric(namespace: string, metricName: string, value: number, dimensionsList: MetricDimensionsList, options: MetricBufferOptions): Point; + private emitDimensions; + private emitDimensionedMetric; + bufferMetric(namespace: string, metricName: string, value: number, dimensionsList: MetricDimensionsList, options: MetricEmitOptions): Promise; static terminate(): Promise; static flushAll(): Promise; flush(): Promise; @@ -115,5 +115,8 @@ export declare class CustomMetrics { static getCache(): InstanceMap; private getTimestamp; private assert; + private info; + private error; + private nop; } -export { Schema, Version }; +export {}; diff --git a/dist/mjs/index.js b/dist/mjs/index.js index fc20049..5722a54 100644 --- a/dist/mjs/index.js +++ b/dist/mjs/index.js @@ -34,25 +34,16 @@ export class CustomMetrics { ttl; constructor(options = {}) { if (options.log == true) { - this.log = { - info: (message, context) => null, - error: (message, context) => console.log('ERROR: ' + message, context), - }; + this.log = { info: this.nop, error: this.error }; } else if (options.log == 'verbose') { - this.log.info = (message, context) => console.log('INFO: ' + message, context); + this.log = { info: this.info, error: this.error }; } else if (options.log) { this.log = options.log; } else { - this.log = { - info: (message, context) => null, - error: (message, context) => null, - }; - } - if (!options.owner) { - throw new Error('Missing required "owner" in options'); + this.log = { info: this.nop, error: this.nop }; } if (options.ttl && typeof options.ttl != 'number') { throw new Error('Bad type for "ttl" option'); @@ -134,29 +125,20 @@ export class CustomMetrics { let point; let buffer = options.buffer || this.buffer; if (buffer && Buffering) { - point = this.bufferMetric(namespace, metricName, value, dimensionsList, buffer); - if (point.timestamp === 0) { - let result = { - spans: [{ points: [point] }], - metric: metricName, - namespace: namespace, - owner: options.owner || this.owner, - version: Version, - }; - return result; - } - } - else { - point = { count: 1, sum: value }; + return await this.bufferMetric(namespace, metricName, value, dimensionsList, options); } + point = { count: 1, sum: value }; + return await this.emitDimensions(namespace, metricName, point, dimensionsList, options); + } + async emitDimensions(namespace, metricName, point, dimensionsList, options) { let result; for (let dimensions of dimensionsList) { let dimString = this.makeDimensionString(dimensions); - result = await this.emitDimensionMetric(namespace, metricName, point, dimString, options); + result = await this.emitDimensionedMetric(namespace, metricName, point, dimString, options); } return result; } - async emitDimensionMetric(namespace, metricName, point, dimensions, options = {}) { + async emitDimensionedMetric(namespace, metricName, point, dimensions, options = {}) { let ttl = options.ttl != undefined ? options.ttl : this.ttl; let retries = MaxRetries; let metric; @@ -197,35 +179,40 @@ export class CustomMetrics { } while (retries-- > 0); return metric; } - bufferMetric(namespace, metricName, value, dimensionsList, options) { + async bufferMetric(namespace, metricName, value, dimensionsList, options) { + let buffer = options.buffer || this.buffer; let interval = this.spans[0].period / this.spans[0].samples; let key = `${namespace}|${metricName}|${JSON.stringify(dimensionsList)}`; let elt = (this.buffers[key] = this.buffers[key] || { count: 0, sum: 0, - timestamp: this.timestamp + (options.elapsed || interval), + timestamp: this.timestamp + (buffer.elapsed || interval), namespace: namespace, metric: metricName, dimensions: dimensionsList, }); - elt.sum += value; - elt.count++; - if (options.force || - (options.sum && elt.sum >= options.sum) || - (options.count && elt.count >= options.count) || + if (buffer.force || + (buffer.sum && elt.sum >= buffer.sum) || + (buffer.count && elt.count >= buffer.count) || this.timestamp >= elt.timestamp) { - delete this.buffers[key]; - this.log.info(`Emit buffered metric ${namespace}/${metricName} = ${value}, sum ${elt.sum} count ${elt.count} remaining ${elt.timestamp - this.timestamp}`, { elt, buffers: this.buffers }); - return { count: elt.count, sum: elt.sum, timestamp: elt.timestamp }; + this.log.info(`Emit buffered metric ${namespace}/${metricName} = ${value}, sum ${elt.sum} count ${elt.count} remaining ${elt.timestamp - this.timestamp}`); + let point = { count: elt.count, sum: elt.sum, timestamp: elt.timestamp }; + await this.emitDimensions(namespace, metricName, point, dimensionsList, options); } - CustomMetrics.saveInstance({ key }, this); + elt.count++; + elt.sum += value; this.log.info(`Buffer metric ${namespace}/${metricName} = ${value}, sum ${elt.sum} count ${elt.count}, remaining ${elt.timestamp - this.timestamp}`); - return { count: elt.count, sum: elt.sum, timestamp: 0 }; + CustomMetrics.saveInstance({ key }, this); + return { + spans: [{ points: [{ count: elt.count, sum: elt.sum }] }], + metric: metricName, + namespace: namespace, + owner: options.owner || this.owner, + version: Version, + }; } static async terminate() { - let start = Date.now(); await CustomMetrics.flushAll(); - console.log(`Lambda terminating, metric flush took ${(Date.now() - start) / 1000} ms`); } static async flushAll() { for (let [key, instance] of Object.entries(Instances)) { @@ -238,7 +225,7 @@ export class CustomMetrics { for (let elt of Object.values(this.buffers)) { let point = { count: elt.count, sum: elt.sum }; for (let dimensions of elt.dimensions) { - await this.emitDimensionMetric(elt.namespace, elt.metric, point, this.makeDimensionString(dimensions)); + await this.emitDimensionedMetric(elt.namespace, elt.metric, point, this.makeDimensionString(dimensions)); } } this.buffers = {}; @@ -284,7 +271,7 @@ export class CustomMetrics { else { result = { dimensions, metric: metricName, namespace, period, points: [], owner }; } - this.log.info(`Metric query ${namespace}, ${metricName}, ${this.makeDimensionString(dimensions)}, ` + + this.log.info(`Metric query ${namespace}, ${metricName}, ${this.makeDimensionString(dimensions) || '[]'}, ` + `period ${period}, statistic "${statistic}"`, { result }); return result; } @@ -326,19 +313,17 @@ export class CustomMetrics { } else if (statistic == 'sum') { value += point.sum; - count += point.count; } else if (statistic == 'count') { value += point.count; - count += point.count; } else if (statistic.match(/^p[0-9]+/)) { - pvalues = pvalues.concat(point.pvalues || []); + pvalues = pvalues.concat(point.pvalues); } else { value += point.sum; - count += point.count; } + count += point.count; } if (statistic.match(/^p[0-9]+/)) { let p = parseInt(statistic.slice(1)); @@ -347,7 +332,7 @@ export class CustomMetrics { value = pvalues[nth]; } else if (statistic == 'avg') { - value /= count || 1; + value /= Math.max(count, 1); } return { dimensions: this.makeDimensionObject(metric.dimensions), @@ -362,9 +347,9 @@ export class CustomMetrics { let points = []; let interval = span.period / span.samples; let timestamp = span.end - span.points.length * interval; + let value; let i = 0; for (let point of span.points) { - let value; if (point.count > 0) { if (statistic == 'max') { if (point.max != undefined) { @@ -394,13 +379,13 @@ export class CustomMetrics { } else if (statistic.match(/^p[0-9]+/)) { let p = parseInt(statistic.slice(1)); - let pvalues = point.pvalues || []; + let pvalues = point.pvalues; pvalues.sort((a, b) => a - b); let nth = Math.min(Math.round((pvalues.length * p) / 100 + 1), pvalues.length - 1); value = pvalues[nth]; } else { - value = point.sum / (point.count || 1); + value = point.sum / point.count; } } timestamp += interval; @@ -419,10 +404,7 @@ export class CustomMetrics { } makeDimensionString(dimensions) { let result = []; - for (let [name, value] of Object.entries(dimensions || {})) { - if (Array.isArray(value)) { - this.log.error(`Dimension is an array`, { value, dimensions }); - } + for (let [name, value] of Object.entries(dimensions)) { result.push(`${name}=${value}`); } return result.join(','); @@ -445,35 +427,37 @@ export class CustomMetrics { let interval = span.period / span.samples; let points = span.points; let start = span.end - points.length * interval; - let period = span.period < queryPeriod ? queryPeriod : 0; + let aggregate = !queryPeriod || span.period < queryPeriod ? true : false; + while (points.length > span.samples) { + points.shift(); + } if (points.length) { if (timestamp < start) { - this.log.error('Bad span', { metric, point, timestamp, start, span }); + this.log.error('Bad metric span', { metric, point, timestamp, start, span }); return; } let shift = 0; - if (queryPeriod) { - if (period) { - shift = points.length; - } + if (queryPeriod && aggregate) { + shift = points.length; } else if (point.count) { - shift = (timestamp - start) / interval - span.samples + 1; + shift = Math.floor((timestamp - start) / interval) - span.samples + 1; + } + else if (queryPeriod) { + shift = Math.floor((timestamp - start) / interval) - span.samples; } shift = Math.max(0, Math.min(shift, points.length)); this.assert(0 <= shift && shift <= points.length); while (shift-- > 0) { let p = points.shift(); - if (p.count && si + 1 < metric.spans.length) { - this.addValue(metric, start, p, si + 1, period); + if (aggregate && p.count && si + 1 < metric.spans.length) { + this.addValue(metric, start, p, si + 1, queryPeriod); } start += interval; } } - if (period) { - if (si + 1 < metric.spans.length) { - this.addValue(metric, timestamp, point, si + 1, period); - } + if (aggregate && queryPeriod && si + 1 < metric.spans.length) { + this.addValue(metric, timestamp, point, si + 1, queryPeriod); } else if (point.count) { if (points.length == 0) { @@ -519,7 +503,7 @@ export class CustomMetrics { if (this.pResolution) { point.pvalues = point.pvalues || []; if (add.pvalues) { - point.pvalues.push(...(add.pvalues || [add.sum / add.count])); + point.pvalues.push(...add.pvalues); } else { point.pvalues.push(add.sum / add.count); @@ -552,17 +536,8 @@ export class CustomMetrics { stats, where, }); - let size = JSON.stringify(result).length; - this.log.info(`Emit metric: ${metric.namespace}/${metric.metric}/${metric.dimensions} = ${point.sum}, msize ${size}`, { - metric, - point, - stats, - }); } - async getMetricList(namespace = undefined, metric = undefined, options = { fields: ['pk', 'sk'], limit: MetricListLimit }) { - if (!options.fields) { - options.fields = ['pk', 'sk']; - } + async getMetricList(namespace = undefined, metric = undefined, options = { limit: MetricListLimit }) { let map = {}; let next; let owner = options.owner || this.owner; @@ -658,5 +633,11 @@ export class CustomMetrics { this.log.error(`Assertion failed ${msg.stack}`); } } + info(message, context = {}) { + console.log('INFO: ' + message, context); + } + error(message, context = {}) { + console.log('ERROR: ' + message, context); + } + nop() { } } -export { Schema, Version }; diff --git a/package-lock.json b/package-lock.json index 8201877..0eb543d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,24 +1,24 @@ { "name": "custom-metrics", - "version": "0.7.1", + "version": "0.7.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "custom-metrics", - "version": "0.7.1", + "version": "0.7.2", "license": "MIT", "dependencies": { - "@aws-sdk/client-dynamodb": "^3.391.0", - "@aws-sdk/util-dynamodb": "^3.391.0", + "@aws-sdk/client-dynamodb": "^3.395.0", + "@aws-sdk/util-dynamodb": "^3.395.0", "dynamodb-onetable": "^2.6.4" }, "devDependencies": { "@types/jest": "^29.5.3", - "@types/node": "^20.5.0", + "@types/node": "^20.5.1", "dynamo-db-local": "^6.0.0", "jest": "^29.6.2", - "senselogs": "^1.0.5", + "senselogs": "^1.0.6", "ts-jest": "^29.1.1", "typescript": "^5.1.6", "wait-port": "^1.0.4" @@ -129,14 +129,14 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@aws-sdk/client-dynamodb": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.391.0.tgz", - "integrity": "sha512-3JDes5VeZ1jT8L+lq3zUQZUsWm+V8VTKyQzyJkCAOa69pguEo4qmPNVIbtpka83OYCBk3cFpZ1hjVnZAR164EQ==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.395.0.tgz", + "integrity": "sha512-wBwiX27kirnYEBmHSg2xQ9KirFtR0W+JF8q+QfRpUtXNpIjQ3qgcZVbx7Jhha0LNXK2erk29Q3YtQl7xlnpZwg==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.391.0", - "@aws-sdk/credential-provider-node": "3.391.0", + "@aws-sdk/client-sts": "3.395.0", + "@aws-sdk/credential-provider-node": "3.395.0", "@aws-sdk/middleware-endpoint-discovery": "3.391.0", "@aws-sdk/middleware-host-header": "3.391.0", "@aws-sdk/middleware-logger": "3.391.0", @@ -178,9 +178,9 @@ } }, "node_modules/@aws-sdk/client-sso": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.391.0.tgz", - "integrity": "sha512-aT+O1CbWIWYlCtWK6g3ZaMvFNImOgFGurOEPscuedqzG5UQc1bRtRrGYShLyzcZgfXP+s0cKYJqgGeRNoWiwqA==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.395.0.tgz", + "integrity": "sha512-IEmqpZnflzFk6NTlkRpEXIcU2uBrTYl+pA5z4ZerbKclYWuxJ7MoLtLDNWgIn3mkNxvdroWgaPY1B2dkQlTe4g==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", @@ -221,13 +221,13 @@ } }, "node_modules/@aws-sdk/client-sts": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.391.0.tgz", - "integrity": "sha512-y+KmorcUx9o5O99sXVPbhGUpsLpfhzYRaYCqxArLsyzZTCO6XDXMi8vg/xtS+b703j9lWEl5GxAv2oBaEwEnhQ==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.395.0.tgz", + "integrity": "sha512-zWxZ+pjeP88uRN4k0Zzid6t/8Yhzg1Cv2LnrYX6kZzbS6AOTDho7fVGZgUl+cme33QZhtE8pXUvwGeJAptbhqg==", "dependencies": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/credential-provider-node": "3.391.0", + "@aws-sdk/credential-provider-node": "3.395.0", "@aws-sdk/middleware-host-header": "3.391.0", "@aws-sdk/middleware-logger": "3.391.0", "@aws-sdk/middleware-recursion-detection": "3.391.0", @@ -282,13 +282,13 @@ } }, "node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.391.0.tgz", - "integrity": "sha512-DJZmbmRMqNSfSV7UF8eBVhADz16KAMCTxnFuvgioHHfYUTZQEhCxRHI8jJqYWxhLTriS7AuTBIWr+1AIbwsCTA==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.395.0.tgz", + "integrity": "sha512-t7cWs+syJsSkj9NGdKyZ1t/+nYQyOec2nPjTtPWwKs8D7rvH3IMIgJwkvAGNzYaiIoIpXXx0wgCqys84TSEIYQ==", "dependencies": { "@aws-sdk/credential-provider-env": "3.391.0", "@aws-sdk/credential-provider-process": "3.391.0", - "@aws-sdk/credential-provider-sso": "3.391.0", + "@aws-sdk/credential-provider-sso": "3.395.0", "@aws-sdk/credential-provider-web-identity": "3.391.0", "@aws-sdk/types": "3.391.0", "@smithy/credential-provider-imds": "^2.0.0", @@ -302,14 +302,14 @@ } }, "node_modules/@aws-sdk/credential-provider-node": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.391.0.tgz", - "integrity": "sha512-LXHQwsTw4WBwRzD9swu8254Hao5MoIaGXIzbhX4EQ84dtOkKYbwiY4pDpLfcHcw3B1lFKkVclMze8WAs4EdEww==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.395.0.tgz", + "integrity": "sha512-qJawWTYf5L7Z1Is0sSJEYc4e96Qd0HWGqluO2h9qoUNrRREZ9RSxsDq+LGxVVAYLupYFcIFtiCnA/MoBBIWhzg==", "dependencies": { "@aws-sdk/credential-provider-env": "3.391.0", - "@aws-sdk/credential-provider-ini": "3.391.0", + "@aws-sdk/credential-provider-ini": "3.395.0", "@aws-sdk/credential-provider-process": "3.391.0", - "@aws-sdk/credential-provider-sso": "3.391.0", + "@aws-sdk/credential-provider-sso": "3.395.0", "@aws-sdk/credential-provider-web-identity": "3.391.0", "@aws-sdk/types": "3.391.0", "@smithy/credential-provider-imds": "^2.0.0", @@ -338,11 +338,11 @@ } }, "node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.391.0.tgz", - "integrity": "sha512-FT/WoiRHiKys+FcRwvjui0yKuzNtJdn2uGuI1hYE0gpW1wVmW02ouufLckJTmcw09THUZ4w53OoCVU5OY00p8A==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.395.0.tgz", + "integrity": "sha512-wAoHG9XqO0L8TvJv4cjwN/2XkYskp0cbnupKKTJm+D29MYcctKEtL0aYOHxaNN2ECAYxIFIQDdlo62GKb3nJ5Q==", "dependencies": { - "@aws-sdk/client-sso": "3.391.0", + "@aws-sdk/client-sso": "3.395.0", "@aws-sdk/token-providers": "3.391.0", "@aws-sdk/types": "3.391.0", "@smithy/property-provider": "^2.0.0", @@ -540,9 +540,9 @@ } }, "node_modules/@aws-sdk/util-dynamodb": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.391.0.tgz", - "integrity": "sha512-cOqoIyWuQlLEhXorcnoq0P8mcN2iM/zyFRxazRyXYw3f6vjuDRGGAYhXHhcdkr+Nlr40pS7Al1559QktCbjb9g==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.395.0.tgz", + "integrity": "sha512-hc97G4f75+xoOn2stERwORvsuugZ6mYPJIdCuaapxWFckqHc8H0jBnEFA1z8XbPVIZdvtS23ixcXOOM4TBWXuA==", "dependencies": { "tslib": "^2.5.0" }, @@ -2220,9 +2220,9 @@ } }, "node_modules/@types/node": { - "version": "20.5.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", - "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==", + "version": "20.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.1.tgz", + "integrity": "sha512-4tT2UrL5LBqDwoed9wZ6N3umC4Yhz3W3FloMmiiG4JwmUJWpie0c7lcnUNd4gtMKuDEO4wRVS8B6Xa0uMRsMKg==", "dev": true }, "node_modules/@types/stack-utils": { @@ -4329,9 +4329,9 @@ } }, "node_modules/senselogs": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/senselogs/-/senselogs-1.0.5.tgz", - "integrity": "sha512-zGtPuIZ+MnTZ1jUISX9xY5MGTU+a889pIt99zLx1mdb+mth0f52Dj+OI5ce4aE2EazQm+rEd376ixhMNpgyE8w==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/senselogs/-/senselogs-1.0.6.tgz", + "integrity": "sha512-qD92MAyKmzZ8/f40Gts9pfRJ0ZHXwdn3PIAX6kE59RLkROAgx8QRr4v8rXzpnyq71rcgERYDSz6TRgvPKfUdpw==", "dev": true }, "node_modules/shebang-command": { @@ -4969,14 +4969,14 @@ } }, "@aws-sdk/client-dynamodb": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.391.0.tgz", - "integrity": "sha512-3JDes5VeZ1jT8L+lq3zUQZUsWm+V8VTKyQzyJkCAOa69pguEo4qmPNVIbtpka83OYCBk3cFpZ1hjVnZAR164EQ==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.395.0.tgz", + "integrity": "sha512-wBwiX27kirnYEBmHSg2xQ9KirFtR0W+JF8q+QfRpUtXNpIjQ3qgcZVbx7Jhha0LNXK2erk29Q3YtQl7xlnpZwg==", "requires": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.391.0", - "@aws-sdk/credential-provider-node": "3.391.0", + "@aws-sdk/client-sts": "3.395.0", + "@aws-sdk/credential-provider-node": "3.395.0", "@aws-sdk/middleware-endpoint-discovery": "3.391.0", "@aws-sdk/middleware-host-header": "3.391.0", "@aws-sdk/middleware-logger": "3.391.0", @@ -5015,9 +5015,9 @@ } }, "@aws-sdk/client-sso": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.391.0.tgz", - "integrity": "sha512-aT+O1CbWIWYlCtWK6g3ZaMvFNImOgFGurOEPscuedqzG5UQc1bRtRrGYShLyzcZgfXP+s0cKYJqgGeRNoWiwqA==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.395.0.tgz", + "integrity": "sha512-IEmqpZnflzFk6NTlkRpEXIcU2uBrTYl+pA5z4ZerbKclYWuxJ7MoLtLDNWgIn3mkNxvdroWgaPY1B2dkQlTe4g==", "requires": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", @@ -5055,13 +5055,13 @@ } }, "@aws-sdk/client-sts": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.391.0.tgz", - "integrity": "sha512-y+KmorcUx9o5O99sXVPbhGUpsLpfhzYRaYCqxArLsyzZTCO6XDXMi8vg/xtS+b703j9lWEl5GxAv2oBaEwEnhQ==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.395.0.tgz", + "integrity": "sha512-zWxZ+pjeP88uRN4k0Zzid6t/8Yhzg1Cv2LnrYX6kZzbS6AOTDho7fVGZgUl+cme33QZhtE8pXUvwGeJAptbhqg==", "requires": { "@aws-crypto/sha256-browser": "3.0.0", "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/credential-provider-node": "3.391.0", + "@aws-sdk/credential-provider-node": "3.395.0", "@aws-sdk/middleware-host-header": "3.391.0", "@aws-sdk/middleware-logger": "3.391.0", "@aws-sdk/middleware-recursion-detection": "3.391.0", @@ -5110,13 +5110,13 @@ } }, "@aws-sdk/credential-provider-ini": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.391.0.tgz", - "integrity": "sha512-DJZmbmRMqNSfSV7UF8eBVhADz16KAMCTxnFuvgioHHfYUTZQEhCxRHI8jJqYWxhLTriS7AuTBIWr+1AIbwsCTA==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.395.0.tgz", + "integrity": "sha512-t7cWs+syJsSkj9NGdKyZ1t/+nYQyOec2nPjTtPWwKs8D7rvH3IMIgJwkvAGNzYaiIoIpXXx0wgCqys84TSEIYQ==", "requires": { "@aws-sdk/credential-provider-env": "3.391.0", "@aws-sdk/credential-provider-process": "3.391.0", - "@aws-sdk/credential-provider-sso": "3.391.0", + "@aws-sdk/credential-provider-sso": "3.395.0", "@aws-sdk/credential-provider-web-identity": "3.391.0", "@aws-sdk/types": "3.391.0", "@smithy/credential-provider-imds": "^2.0.0", @@ -5127,14 +5127,14 @@ } }, "@aws-sdk/credential-provider-node": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.391.0.tgz", - "integrity": "sha512-LXHQwsTw4WBwRzD9swu8254Hao5MoIaGXIzbhX4EQ84dtOkKYbwiY4pDpLfcHcw3B1lFKkVclMze8WAs4EdEww==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.395.0.tgz", + "integrity": "sha512-qJawWTYf5L7Z1Is0sSJEYc4e96Qd0HWGqluO2h9qoUNrRREZ9RSxsDq+LGxVVAYLupYFcIFtiCnA/MoBBIWhzg==", "requires": { "@aws-sdk/credential-provider-env": "3.391.0", - "@aws-sdk/credential-provider-ini": "3.391.0", + "@aws-sdk/credential-provider-ini": "3.395.0", "@aws-sdk/credential-provider-process": "3.391.0", - "@aws-sdk/credential-provider-sso": "3.391.0", + "@aws-sdk/credential-provider-sso": "3.395.0", "@aws-sdk/credential-provider-web-identity": "3.391.0", "@aws-sdk/types": "3.391.0", "@smithy/credential-provider-imds": "^2.0.0", @@ -5157,11 +5157,11 @@ } }, "@aws-sdk/credential-provider-sso": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.391.0.tgz", - "integrity": "sha512-FT/WoiRHiKys+FcRwvjui0yKuzNtJdn2uGuI1hYE0gpW1wVmW02ouufLckJTmcw09THUZ4w53OoCVU5OY00p8A==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.395.0.tgz", + "integrity": "sha512-wAoHG9XqO0L8TvJv4cjwN/2XkYskp0cbnupKKTJm+D29MYcctKEtL0aYOHxaNN2ECAYxIFIQDdlo62GKb3nJ5Q==", "requires": { - "@aws-sdk/client-sso": "3.391.0", + "@aws-sdk/client-sso": "3.395.0", "@aws-sdk/token-providers": "3.391.0", "@aws-sdk/types": "3.391.0", "@smithy/property-provider": "^2.0.0", @@ -5323,9 +5323,9 @@ } }, "@aws-sdk/util-dynamodb": { - "version": "3.391.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.391.0.tgz", - "integrity": "sha512-cOqoIyWuQlLEhXorcnoq0P8mcN2iM/zyFRxazRyXYw3f6vjuDRGGAYhXHhcdkr+Nlr40pS7Al1559QktCbjb9g==", + "version": "3.395.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.395.0.tgz", + "integrity": "sha512-hc97G4f75+xoOn2stERwORvsuugZ6mYPJIdCuaapxWFckqHc8H0jBnEFA1z8XbPVIZdvtS23ixcXOOM4TBWXuA==", "requires": { "tslib": "^2.5.0" } @@ -6652,9 +6652,9 @@ } }, "@types/node": { - "version": "20.5.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz", - "integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==", + "version": "20.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.1.tgz", + "integrity": "sha512-4tT2UrL5LBqDwoed9wZ6N3umC4Yhz3W3FloMmiiG4JwmUJWpie0c7lcnUNd4gtMKuDEO4wRVS8B6Xa0uMRsMKg==", "dev": true }, "@types/stack-utils": { @@ -8209,9 +8209,9 @@ "dev": true }, "senselogs": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/senselogs/-/senselogs-1.0.5.tgz", - "integrity": "sha512-zGtPuIZ+MnTZ1jUISX9xY5MGTU+a889pIt99zLx1mdb+mth0f52Dj+OI5ce4aE2EazQm+rEd376ixhMNpgyE8w==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/senselogs/-/senselogs-1.0.6.tgz", + "integrity": "sha512-qD92MAyKmzZ8/f40Gts9pfRJ0ZHXwdn3PIAX6kE59RLkROAgx8QRr4v8rXzpnyq71rcgERYDSz6TRgvPKfUdpw==", "dev": true }, "shebang-command": { diff --git a/package.json b/package.json index 85645f6..8b11896 100644 --- a/package.json +++ b/package.json @@ -39,16 +39,16 @@ "test-cov": "jest --coverage" }, "dependencies": { - "@aws-sdk/client-dynamodb": "^3.391.0", - "@aws-sdk/util-dynamodb": "^3.391.0", + "@aws-sdk/client-dynamodb": "^3.395.0", + "@aws-sdk/util-dynamodb": "^3.395.0", "dynamodb-onetable": "^2.6.4" }, "devDependencies": { "@types/jest": "^29.5.3", - "@types/node": "^20.5.0", + "@types/node": "^20.5.1", "dynamo-db-local": "^6.0.0", "jest": "^29.6.2", - "senselogs": "^1.0.5", + "senselogs": "^1.0.6", "ts-jest": "^29.1.1", "typescript": "^5.1.6", "wait-port": "^1.0.4"