Skip to content

Commit

Permalink
update prometheus metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Oct 8, 2023
1 parent e5e9302 commit d4f0456
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/fetch/POST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions src/prometheus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
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');

0 comments on commit d4f0456

Please sign in to comment.