Skip to content

Commit

Permalink
Fix issue stats (#3937)
Browse files Browse the repository at this point in the history
* fix: buggy import

* feat: add `computedAt` key to statistics

* feat: send error to Sentry instead of console
  • Loading branch information
baptou12 authored Sep 4, 2023
1 parent 0d1eb13 commit 81981b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/lib/stats/funnel-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dayjs from "dayjs"
import utc from "dayjs/plugin/utc"
import utc from "dayjs/plugin/utc.js"
import mongoose from "mongoose"

import { callMatomoAPI } from "./piwik.js"
Expand Down
4 changes: 3 additions & 1 deletion backend/lib/stats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Promise from "bluebird"
import fs from "fs/promises"
import path from "path"
import dayjs from "dayjs"
import Sentry from "@sentry/node"

import { getUsageData } from "./piwik.js"
import mongodb from "./mongodb.js"
Expand Down Expand Up @@ -29,10 +30,11 @@ try {
basic: [...mongoData.dailySituationCount, ...piwikData],
survey: mongoData.survey,
funnel: funnelData,
computedAt: dayjs().toISOString(),
}
await fs.writeFile(statsFilePath, JSON.stringify(data, null, 2), "utf-8")
} catch (error) {
console.error("error", error)
Sentry.captureException(error)
process.exitCode = 1
} finally {
mongodb.closeClient()
Expand Down

0 comments on commit 81981b2

Please sign in to comment.