Răsfoiți Sursa

Merge pull request #4196 from overleaf/jpa-compile-metrics-version

[misc] PdfJsMetrics: add a version number to the event segmentation

GitOrigin-RevId: 4c5e1df9e3513edbfeae0f47303ce9512a25c118
Jakob Ackermann 5 ani în urmă
părinte
comite
3b3f1fbb73

+ 6 - 0
services/web/frontend/js/ide/pdf/controllers/PdfJsMetrics.js

@@ -1,7 +1,13 @@
 import { v4 as uuid } from 'uuid'
 import { sendMB } from '../../../infrastructure/event-tracking'
 
+// VERSION should get incremented when making changes to caching behavior or
+//  adjusting metrics collection.
+// Keep in sync with the service worker.
+const VERSION = 2
+
 const pdfJsMetrics = {
+  version: VERSION,
   id: uuid(),
   epoch: Date.now(),
   totalBandwidth: 0,

+ 1 - 0
services/web/frontend/js/serviceWorker.js

@@ -3,6 +3,7 @@ const OError = require('@overleaf/o-error')
 
 // VERSION should get incremented when making changes to caching behavior or
 //  adjusting metrics collection.
+// Keep in sync with PdfJsMetrics.
 const VERSION = 2
 
 const CLEAR_CACHE_REQUEST_MATCHER = /^\/project\/[0-9a-f]{24}\/output$/