all repos — website @ bb05e47f6022227c64aad94677f8da9ef8ae227c

My website

Simplify metrics

Alan Pearce
commit

bb05e47f6022227c64aad94677f8da9ef8ae227c

parent

9aba2856bca331d5283e527713a1e810cea3394e

1 file changed, 1 insertion(+), 26 deletions(-)

changed files
M src/app.tssrc/app.ts
@@ -45,14 +45,7 @@ const metrics = {
requests: new prom.Counter({ name: "homestead_requests", help: "Number of requests by path, status code, and method", - labelNames: [ - "path", - "status_code", - "hostname", - "method", - "content_encoding", - "cache_basis", - ] as const, + labelNames: ["status_code", "content_encoding", "cache_basis"] as const, }), requestDuration: new prom.Histogram({ name: "homestead_request_duration_seconds",
@@ -162,10 +155,7 @@ config.redirect_other_hostnames &&
hostname !== expectedHostURL.host ) { metrics.requests.inc({ - method: request.method, - hostname, content_encoding: "identity", - path: pathname, status_code: (status = 301), }); return new Response("", {
@@ -186,10 +176,7 @@ request.headers.get("if-modified-since"),
) >= file?.mtime.getTime(); if (etagMatch || mtimeMatch) { metrics.requests.inc({ - method: request.method, - hostname, content_encoding: contentEncoding, - path: pathname, status_code: (status = 304), cache_basis: etagMatch ? "etag" : "mtime", });
@@ -211,9 +198,6 @@ }
status = 200; metrics.requests.inc({ - method: request.method, - hostname, - path: pathname, status_code: status, content_encoding: contentEncoding, });
@@ -231,9 +215,6 @@ } else {
if (files.has(pathname + "/")) { newpath = pathname + "/"; metrics.requests.inc({ - method: request.method, - hostname, - path: pathname, content_encoding: contentEncoding, status_code: (status = 302), });
@@ -244,9 +225,6 @@ });
} else if (files.has(pathname.replace(/index.html$/, ""))) { newpath = pathname.replace(/index.html$/, ""); metrics.requests.inc({ - method: request.method, - hostname, - path: newpath, content_encoding: contentEncoding, status_code: (status = 302), });
@@ -270,9 +248,6 @@ }
} } catch (error) { metrics.requests.inc({ - method: request.method, - hostname, - path: pathname, status_code: status, content_encoding: "identity", });