Skip to content

Commit 16f893b

Browse files
committed
style: doc comments updated
1 parent e3936c4 commit 16f893b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/metrics/src/Metrics.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,6 @@ class Metrics extends Utility implements MetricsInterface {
982982
}
983983

984984
const timestampMs = isDate(timestamp) ? timestamp.getTime() : timestamp;
985-
986985
const currentTime = new Date().getTime();
987986

988987
const minValidTimestamp = currentTime - EMF_MAX_TIMESTAMP_PAST_AGE;
@@ -992,7 +991,7 @@ class Metrics extends Utility implements MetricsInterface {
992991
}
993992

994993
/**
995-
* Converts a given timestamp to EMF (Embedded Metric Format) compatible format.
994+
* Converts a given timestamp to EMF compatible format.
996995
*
997996
* @param timestamp - The timestamp to convert, which can be either a number (in milliseconds) or a Date object.
998997
* @returns The timestamp in milliseconds. If the input is invalid, returns 0.
@@ -1004,9 +1003,11 @@ class Metrics extends Utility implements MetricsInterface {
10041003
if (isDate(timestamp)) {
10051004
return timestamp.getTime();
10061005
}
1007-
// If this point is reached, input was neither a valid number nor Date
1008-
// Return 0 which represents the initial date of epoch time
1009-
// This will be skipped by Amazon CloudWatch
1006+
/**
1007+
* If this point is reached, it indicates timestamp was neither a valid number nor Date
1008+
* Returning zero represents the initial date of epoch time,
1009+
* which will be skipped by Amazon CloudWatch.
1010+
**/
10101011
return 0;
10111012
}
10121013
}

packages/metrics/tests/unit/Metrics.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,7 +2265,7 @@ describe('Class: Metrics', () => {
22652265
},
22662266
{
22672267
format: 'Date object',
2268-
getTimestamp: (timestamp: number) => new Date(timestamp),
2268+
getTimestamp: (timestampMs: number) => new Date(timestampMs),
22692269
},
22702270
];
22712271

@@ -2313,7 +2313,7 @@ describe('Class: Metrics', () => {
23132313
);
23142314
});
23152315

2316-
test('should not log a warning if the timestamp is withing valid future range', () => {
2316+
test('should not log a warning if the timestamp is within valid future range', () => {
23172317
// Prepare
23182318
const testMetric = 'test-metric';
23192319
const timestampMs = mockDate.getTime() + EMF_MAX_TIMESTAMP_FUTURE_AGE;

0 commit comments

Comments
 (0)