Skip to content

Commit

Permalink
change id
Browse files Browse the repository at this point in the history
  • Loading branch information
ersin-erdal committed Oct 19, 2024
1 parent 6e36c7e commit 79e9ecc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ describe('ConnectorUsageReportingTask', () => {

const report = {
creation_timestamp: nowStr,
id: `connector-request-body-bytes-${lastReportedUsageDateStr}-${nowStr}`,
id: 'connector-request-body-bytes-2024-01-01T12:00:00.000Z',
source: {
id: CONNECTOR_USAGE_REPORTING_SOURCE_ID,
instance_group_id: 'test-project',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,14 @@ export class ConnectorUsageReportingTask {
projectId: string;
}): ConnectorUsageReport => {
const period = Math.round((toDate.getTime() - fromDate.getTime()) / 1000);
const fromStr = fromDate.toISOString();
const toStr = toDate.toISOString();
const timestamp = new Date(toStr);
timestamp.setMinutes(0);
timestamp.setSeconds(0);
timestamp.setMilliseconds(0);

return {
id: `connector-request-body-bytes-${fromStr}-${toStr}`,
id: `connector-request-body-bytes-${timestamp.toISOString()}`,
usage_timestamp: toStr,
creation_timestamp: toStr,
usage: {
Expand Down

0 comments on commit 79e9ecc

Please sign in to comment.