From d4f04567aba36f92d7efa6afc7d94801936964c3 Mon Sep 17 00:00:00 2001 From: Denis Carriere Date: Sun, 8 Oct 2023 14:24:11 -0400 Subject: [PATCH] update prometheus metrics --- src/fetch/POST.ts | 4 ++-- src/prometheus.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fetch/POST.ts b/src/fetch/POST.ts index e867f5d..513b6dc 100644 --- a/src/fetch/POST.ts +++ b/src/fetch/POST.ts @@ -48,12 +48,12 @@ export default async function (req: Request, server: Server) { // -1 if backpressure was applied // or the number of bytes sent. if ( bytes > 0 ) { - prometheus.bytes_published.inc(bytes); + prometheus.published_messages_bytes.inc(bytes); prometheus.published_messages.inc(1); } // Metrics for incoming WebHook prometheus.webhook_messages.labels({moduleHash, chain}).inc(1); - prometheus.trace_id.labels({traceId}).inc(1); + prometheus.webhook_trace_id.labels({traceId, chain}).inc(1); // Upsert moduleHash into SQLite DB sqlite.replace(db, "chain", chain, timestamp); diff --git a/src/prometheus.ts b/src/prometheus.ts index 74f4acd..25ad1d9 100644 --- a/src/prometheus.ts +++ b/src/prometheus.ts @@ -30,13 +30,13 @@ export async function getSingleMetric(name: string) { // Webhook metrics export const webhook_messages = registerCounter('webhook_messages', 'Total Webhook messages received', ['moduleHash', 'chain']); -export const trace_id = registerGauge('trace_id', 'Total trace ids', ['traceId']); +export const webhook_trace_id = registerCounter('trace_id', 'Total Webhook Substreams trace ids', ['traceId', 'chain']); // WebSocket metrics -export const active_connections = registerGauge('active_connections', 'All active connections'); -export const connected = registerCounter('connected', 'Total connected clients'); -export const published_messages = registerCounter('published_messages', 'Total published messages'); -export const bytes_published = registerCounter('bytes_published', 'Total bytes published'); -export const disconnects = registerCounter('disconnects', 'Total disconnects'); -export const received_message = registerCounter('received_messages', 'Total messages received', ['method']); -export const received_message_errors = registerCounter('received_messages_errors', 'Total errors from messages received'); \ No newline at end of file +export const active_connections = registerGauge('active_connections', 'All WebSocket active connections'); +export const connected = registerCounter('connected', 'Total WebSocket connected clients'); +export const disconnects = registerCounter('disconnects', 'Total WebSocket disconnects'); +export const published_messages = registerCounter('published_messages', 'Total WebSocket published messages'); +export const published_messages_bytes = registerCounter('published_messages_bytes', 'Total WebSocket published messages in bytes'); +export const received_message = registerCounter('received_messages', 'Total WebSocket messages received', ['method']); +export const received_message_errors = registerCounter('received_messages_errors', 'Total WebSocket errors from messages received'); \ No newline at end of file