mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-07-30 19:52:07 +00:00
Export metric for total ETH RPC count by methods
This commit is contained in:
parent
2217cd3ffb
commit
e4192e7f77
@ -82,6 +82,12 @@ export const isSyncingHistoricalBlocks = new client.Gauge({
|
||||
});
|
||||
isSyncingHistoricalBlocks.set(Number(undefined));
|
||||
|
||||
export const ethRpcCount = new client.Counter({
|
||||
name: 'watcher_eth_rpc_total',
|
||||
help: 'Total number of ETH RPC requests',
|
||||
labelNames: ['method', 'provider']
|
||||
});
|
||||
|
||||
export const ethRpcErrors = new client.Counter({
|
||||
name: 'watcher_eth_rpc_errors',
|
||||
help: 'Number of ETH RPC request errors',
|
||||
|
@ -22,7 +22,7 @@ import { ResultEvent } from './indexer';
|
||||
import { EventInterface, EthFullBlock, EthFullTransaction } from './types';
|
||||
import { BlockHeight } from './database';
|
||||
import { Transaction } from './graph/utils';
|
||||
import { ethRpcErrors, ethRpcRequestDuration } from './metrics';
|
||||
import { ethRpcCount, ethRpcErrors, ethRpcRequestDuration } from './metrics';
|
||||
|
||||
const JSONbigNative = JSONbig({ useNativeBigInt: true });
|
||||
|
||||
@ -379,6 +379,7 @@ export class MonitoredStaticJsonRpcProvider extends providers.StaticJsonRpcProvi
|
||||
// Rethrow the error
|
||||
throw err;
|
||||
} finally {
|
||||
ethRpcCount.inc({ method, provider: this.connection.url }, 1);
|
||||
endTimer();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user