about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-12 14:02:33 +0200
committerAlan Pearce2024-04-12 14:02:33 +0200
commitbb05e47f6022227c64aad94677f8da9ef8ae227c (patch)
treec12f9d86c9ea5e6c592cc3ec6b938dc1a1547e98
parent9aba2856bca331d5283e527713a1e810cea3394e (diff)
downloadwebsite-bb05e47f6022227c64aad94677f8da9ef8ae227c.tar.lz
website-bb05e47f6022227c64aad94677f8da9ef8ae227c.tar.zst
website-bb05e47f6022227c64aad94677f8da9ef8ae227c.zip
Simplify metrics
-rw-r--r--src/app.ts27
1 files changed, 1 insertions, 26 deletions
diff --git a/src/app.ts b/src/app.ts
index 06fe16d..c47e5e6 100644
--- a/src/app.ts
+++ b/src/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 @@ export const server = {
         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 @@ export const server = {
           ) >= 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 @@ export const server = {
 
         status = 200;
         metrics.requests.inc({
-          method: request.method,
-          hostname,
-          path: pathname,
           status_code: status,
           content_encoding: contentEncoding,
         });
@@ -231,9 +215,6 @@ export const server = {
         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 @@ export const server = {
         } 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 @@ export const server = {
       }
     } catch (error) {
       metrics.requests.inc({
-        method: request.method,
-        hostname,
-        path: pathname,
         status_code: status,
         content_encoding: "identity",
       });