Skip to content

Commit b362ab1

Browse files
committed
Remove metrics
1 parent 6472bdc commit b362ab1

File tree

7 files changed

+0
-255
lines changed

7 files changed

+0
-255
lines changed

src/editor/index.js

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
minSecretLengthCheck,
1919
setupSecretLengthTooltip
2020
} from "./secret-length-tooltip.js";
21-
import * as metrics from "../metrics.js";
2221
import {
2322
algorithmSelect,
2423
signatureStatusElement,
@@ -47,23 +46,6 @@ import log from "loglevel";
4746
// passed to the event manager.
4847
const eventManager = new EventManager();
4948

50-
function trackToken(jwt, operation, extra) {
51-
const tokenInfo = getSafeTokenInfo(jwt);
52-
53-
metrics.track(
54-
"editor-jwt-tracked",
55-
Object.assign(
56-
{
57-
operation: operation,
58-
tokenInfo: tokenInfo
59-
},
60-
extra
61-
)
62-
);
63-
64-
return tokenInfo.hash;
65-
}
66-
6749
function isSharedSecretAlgorithm(algorithm) {
6850
return algorithm && algorithm.indexOf("HS") === 0;
6951
}
@@ -198,8 +180,6 @@ function setAlgorithmInHeader(algorithm) {
198180
function algorithmChangeHandler() {
199181
const algorithm = getSelectedAlgorithm();
200182

201-
metrics.track("editor-algorithm-selected", { algorithm: algorithm });
202-
203183
displaySecretOrKeys(algorithm);
204184

205185
if (isDefaultToken(getTrimmedValue(tokenEditor))) {
@@ -277,9 +257,6 @@ function encodeToken() {
277257
.then(encoded => {
278258
eventManager.withDisabledEvents(() => {
279259
tokenEditor.setValue(encoded);
280-
trackToken(encoded, "encode", {
281-
secretBase64Checkbox: secretBase64Checkbox.checked
282-
});
283260
});
284261
})
285262
.catch(e => {
@@ -288,7 +265,6 @@ function encodeToken() {
288265
markAsInvalid();
289266
tokenEditor.setValue("");
290267
});
291-
metrics.track("editor-encoding-error");
292268
})
293269
.finally(() => {
294270
verifyToken();
@@ -304,15 +280,9 @@ function decodeToken() {
304280
const jwt = getTrimmedValue(tokenEditor);
305281
const decoded = decode(jwt);
306282

307-
const tokenHash = trackToken(jwt, "decode");
308-
309283
selectAlgorithm(decoded.header.alg);
310284
if (isPublicKeyAlgorithm(decoded.header.alg)) {
311285
downloadPublicKeyIfPossible(decoded).then(publicKey => {
312-
metrics.track("editor-jwt-public-key-downloaded", {
313-
tokenHash: tokenHash
314-
});
315-
316286
eventManager.withDisabledEvents(() => {
317287
publicKeyTextArea.value = publicKey;
318288
verifyToken();
@@ -325,10 +295,6 @@ function decodeToken() {
325295

326296
if (decoded.errors) {
327297
markAsInvalidWithElement(editorElement, false);
328-
metrics.track("editor-jwt-invalid", {
329-
reason: `partial decode`,
330-
tokenHash: tokenHash
331-
});
332298
} else {
333299
if (decoded.warnings && decoded.warnings.length > 0) {
334300
showEditorWarnings(decoded.warnings);
@@ -341,11 +307,6 @@ function decodeToken() {
341307
}
342308
} catch (e) {
343309
log.warn("Failed to decode token: ", e);
344-
345-
metrics.track("editor-jwt-invalid", {
346-
reason: `failed to decode token`,
347-
tokenHash: trackToken(jwt)
348-
});
349310
}
350311
});
351312
}
@@ -354,14 +315,8 @@ function verifyToken() {
354315
const jwt = getTrimmedValue(tokenEditor);
355316
const decoded = decode(jwt);
356317

357-
const tokenHash = trackToken(jwt, "verify");
358-
359318
if (!decoded.header.alg || decoded.header.alg === "none") {
360319
markAsInvalid();
361-
metrics.track("editor-jwt-invalid", {
362-
reason: `header.alg value is ${decoded.header.alg}`,
363-
tokenHash: tokenHash
364-
});
365320
return;
366321
}
367322

@@ -373,25 +328,11 @@ function verifyToken() {
373328
if (result.validSignature) {
374329
if (!result.validBase64) {
375330
markJWTAsInvalid();
376-
metrics.track("editor-jwt-invalid", {
377-
reason: "invalid base64",
378-
tokenHash: tokenHash,
379-
secretBase64Checkbox: secretBase64Checkbox.checked
380-
});
381331
} else {
382332
markAsValid();
383-
metrics.track("editor-jwt-verified", {
384-
tokenHash: tokenHash,
385-
secretBase64Checkbox: secretBase64Checkbox.checked
386-
});
387333
}
388334
} else {
389335
markAsInvalid();
390-
metrics.track("editor-jwt-invalid", {
391-
reason: "invalid signature",
392-
tokenHash: tokenHash,
393-
secretBase64Checkbox: secretBase64Checkbox.checked
394-
});
395336
}
396337
});
397338
}

src/editor/utils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { isWideScreen } from '../utils.js';
2-
import * as metrics from '../metrics.js';
32
import * as jwt from './jwt.js';
43
import registeredClaims from './jwt-iana-registered-claims.js';
54
import forge from 'node-forge';
@@ -46,7 +45,6 @@ export function disableUnsupportedAlgorithms() {
4645
// TODO: test supported algorithms in runtime
4746
if(isSafari()) {
4847
algorithmEs512.disabled = true;
49-
metrics.track('editor-disabled-es512-safari');
5048
}
5149
}
5250

src/metrics.js

Lines changed: 0 additions & 132 deletions
This file was deleted.

src/share-button.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import { copyTokenLink } from './utils.js';
22
import { getTokenEditorValue } from './editor';
3-
import * as metrics from './metrics.js';
43

54
import strings from './strings.js';
65

76
export function setupShareJwtButton(shareJwtElement, shareJwtTextElement) {
87
shareJwtElement.addEventListener('click', event => {
98
event.preventDefault();
109

11-
metrics.track('editor-share-button-clicked');
12-
1310
const value = getTokenEditorValue();
1411
if(value.token) {
1512
// If the selected algorithm does not use public keys, publicKey will be

src/website/index.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as metrics from "../metrics.js";
21
import { setupNavbar } from "./navbar.js";
32
import { setupExtensionButton } from "./extension.js";
43
import { setupLibraries } from "./libraries.js";
@@ -37,10 +36,7 @@ function parseLocationQuery() {
3736
const token = locSearch[key] || locHash[key];
3837

3938
if (token) {
40-
metrics.track("token-in-url", { type: key });
41-
4239
if (locSearch.publicKey || locHash.publicKey) {
43-
metrics.track("pubkey-in-url");
4440
publicKeyTextArea.value = locSearch.publicKey || locHash.publicKey;
4541
}
4642

@@ -55,31 +51,13 @@ function parseLocationQuery() {
5551

5652
function pickEbookOrExtensionBanner() {
5753
if ((isChrome() || isFirefox()) && Math.random() >= 0.5) {
58-
metrics.track("extension-banner-shown");
5954
extensionSection.style.display = "block";
6055
} else {
61-
metrics.track("ebook-banner-shown");
6256
ebookSection.style.display = "block";
6357
}
6458
}
6559

66-
function setupMetrics() {
67-
metrics.init();
68-
69-
// Section visible metrics
70-
window.addEventListener("scroll", e => {
71-
if (isPartiallyInViewport(librariesElement)) {
72-
once("libraries-visible", () => metrics.track("libraries-visible-once"));
73-
}
74-
75-
if (isPartiallyInViewport(debuggerSection)) {
76-
once("editor-visible", () => metrics.track("editor-visible-once"));
77-
}
78-
});
79-
}
80-
8160
// Initialization
82-
setupMetrics();
8361
setupNavbar();
8462
setupExtensionButton();
8563
setupSmoothScrolling();

src/website/introduction/index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { setupHighlighting } from "../highlighting.js";
22
import { setupJwtCounter } from "../counter.js";
3-
import * as metrics from "../../metrics.js";
4-
5-
function setupMetrics() {
6-
metrics.init();
7-
}
83

94
// Initialization
10-
setupMetrics();
115
setupHighlighting();
126
setupJwtCounter();

0 commit comments

Comments
 (0)