From bb05e47f6022227c64aad94677f8da9ef8ae227c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 12 Apr 2024 14:02:33 +0200 Subject: Simplify metrics --- src/app.ts | 27 +-------------------------- 1 file changed, 1 insertion(+), 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", }); -- cgit 1.4.1