Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #1692, add GA logging for any shots that are deleted after the ex…
Browse files Browse the repository at this point in the history
…piration time
  • Loading branch information
ianb committed Oct 28, 2016
1 parent a2b8d8a commit dcb380b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ These are events that an add-on user can encounter on a shot they own
8. ~~Switch to clip view from full page (already covered)~~
9. [x] Click on clip (already covered)

#### Server events

1. [x] When an expired shot is deleted (about 2 weeks after expiration) it sends `server/clean-deleted-shot` with an eventValue of the number of shots cleaned at that moment. (By default these are checked every minute.)

#### Homepage web visits

1. ~~Click install from Firefox, `web/start-install/homepage-firefox`~~
Expand Down
13 changes: 11 additions & 2 deletions server/src/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@

const config = require("./config").getProperties();
const mozlog = require("mozlog")("jobs");
const ua = require("universal-analytics");

// Convert to milliseconds:
let keepTime = config.exportKeepTime * 60 * 1000;
//let keepTime = config.exportKeepTime * 60 * 1000;
let checkDeletedInterval = config.checkDeletedInterval * 1000;

exports.start = function () {

setInterval(require("./exporter").cleanExports, keepTime / 10);
//setInterval(require("./exporter").cleanExports, keepTime / 10);

setInterval(function () {
require("./servershot").Shot.cleanDeletedShots()
.then((rowCount) => {
if (rowCount) {
mozlog.info("cleaning-expired-shots", {rowCount});
}
if (config.gaId) {
let analytics = ua(config.gaId);
analytics.event({
ec: "server",
ea: "clean-deleted-shot",
ev: rowCount
}).send();
}
})
.catch((e) => {
mozlog.error("error-cleaning-shots", {
Expand Down

0 comments on commit dcb380b

Please sign in to comment.