Session logs and usage logs should use seconds not ms

This commit is contained in:
Owen
2026-08-26 10:50:04 -04:00
parent 3d4e143c1f
commit e57826d6e0
7 changed files with 20 additions and 19 deletions
+3 -1
View File
@@ -580,6 +580,8 @@ export async function recordUsage(input: UsageRecordInput): Promise<void> {
);
}
const timestamp = Math.floor(Date.now() / 1000);
usageRecordBuffer.push({
orgId: input.orgId,
providerId: input.providerId,
@@ -597,7 +599,7 @@ export async function recordUsage(input: UsageRecordInput): Promise<void> {
totalTokens,
costUsd: input.costUsd,
estimated: usage.estimated,
createdAt: input.createdAt ?? Date.now()
createdAt: input.createdAt ?? timestamp
});
// Flush immediately if buffer is full, otherwise schedule a flush