mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
metrics: remove path from fetch and request metrics
This commit is contained in:
parent
ea15f291b0
commit
e50ba819b9
3 changed files with 5 additions and 5 deletions
|
|
@ -3,13 +3,13 @@ import { Counter } from 'prom-client';
|
|||
export const httpRequestCounter = new Counter({
|
||||
name: 'http_requests_total',
|
||||
help: 'Total number of HTTP requests',
|
||||
labelNames: ['method', 'path'],
|
||||
labelNames: ['method'],
|
||||
});
|
||||
|
||||
export const fetchCounter = new Counter({
|
||||
name: 'fetch_total',
|
||||
help: 'Total number of fetch requests',
|
||||
labelNames: ['method', 'path'],
|
||||
labelNames: ['method'],
|
||||
});
|
||||
|
||||
export const firehoseEventCounter = new Counter({
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import { MiddlewareHandler } from '@hono/hono';
|
|||
import { httpRequestCounter } from '@/metrics.ts';
|
||||
|
||||
export const metricsMiddleware: MiddlewareHandler = async (c, next) => {
|
||||
const { method, path } = c.req;
|
||||
httpRequestCounter.inc({ method, path });
|
||||
const { method } = c.req;
|
||||
httpRequestCounter.inc({ method });
|
||||
|
||||
await next();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const fetchWorker: typeof fetch = async (...args) => {
|
|||
await ready;
|
||||
const [url, init] = serializeFetchArgs(args);
|
||||
const { body, signal, ...rest } = init;
|
||||
fetchCounter.inc({ method: init.method, path: new URL(url).pathname });
|
||||
fetchCounter.inc({ method: init.method });
|
||||
const result = await client.fetch(url, { ...rest, body: await prepareBodyForWorker(body) }, signal);
|
||||
return new Response(...result);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue