Add metrics to monitor errors and duration for ETH RPC requests (#507)

* Add metrics to monitor errors and duration for ETH RPC requests

* Check for server error

* Add a metric with configured upstream ETH RPC endpoints

* Use Gauge for RPC requests duration metric

* Filter out unknown events while loading event count on start

* Update package versions

* Rethrow errors in overridden send provider method
This commit is contained in:
prathamesh0
2024-05-15 19:11:22 +05:30
committed by GitHub
parent c9696c3d9f
commit c7e6baa263
18 changed files with 109 additions and 45 deletions
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@cerc-io/cli",
"version": "0.2.86",
"version": "0.2.87",
"main": "dist/index.js",
"license": "AGPL-3.0",
"scripts": {
@@ -15,13 +15,13 @@
},
"dependencies": {
"@apollo/client": "^3.7.1",
"@cerc-io/cache": "^0.2.86",
"@cerc-io/ipld-eth-client": "^0.2.86",
"@cerc-io/cache": "^0.2.87",
"@cerc-io/ipld-eth-client": "^0.2.87",
"@cerc-io/libp2p": "^0.42.2-laconic-0.1.4",
"@cerc-io/nitro-node": "^0.1.15",
"@cerc-io/peer": "^0.2.86",
"@cerc-io/rpc-eth-client": "^0.2.86",
"@cerc-io/util": "^0.2.86",
"@cerc-io/peer": "^0.2.87",
"@cerc-io/rpc-eth-client": "^0.2.87",
"@cerc-io/util": "^0.2.87",
"@ethersproject/providers": "^5.4.4",
"@graphql-tools/utils": "^9.1.1",
"@ipld/dag-cbor": "^8.0.0",
+4 -1
View File
@@ -23,7 +23,8 @@ import {
startMetricsServer,
Config,
UpstreamConfig,
NEW_BLOCK_MAX_RETRIES_ERROR
NEW_BLOCK_MAX_RETRIES_ERROR,
setActiveUpstreamEndpointMetric
} from '@cerc-io/util';
import { BaseCmd } from './base';
@@ -138,6 +139,8 @@ export class JobRunnerCmd {
const { ethClient, ethProvider } = await initClients(config, this._currentEndpointIndex);
indexer.switchClients({ ethClient, ethProvider });
setActiveUpstreamEndpointMetric(config, this._currentEndpointIndex.rpcProviderEndpoint);
log(`RPC endpoint ${oldRpcEndpoint} is not working; failing over to new RPC endpoint ${ethProvider.connection.url}`);
}
});