mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-07-27 10:42:06 +00:00
Export metric for total ETH RPC count (#528)
* Export metric for total ETH RPC count by methods * Fix endpoint switch on max retries of new block * Upgrade package versions
This commit is contained in:
parent
2217cd3ffb
commit
42cb688921
@ -2,7 +2,7 @@
|
|||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"command": {
|
"command": {
|
||||||
|
2
packages/cache/package.json
vendored
2
packages/cache/package.json
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/cache",
|
"name": "@cerc-io/cache",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"description": "Generic object cache",
|
"description": "Generic object cache",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/cli",
|
"name": "@cerc-io/cli",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -15,13 +15,13 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.7.1",
|
"@apollo/client": "^3.7.1",
|
||||||
"@cerc-io/cache": "^0.2.102",
|
"@cerc-io/cache": "^0.2.103",
|
||||||
"@cerc-io/ipld-eth-client": "^0.2.102",
|
"@cerc-io/ipld-eth-client": "^0.2.103",
|
||||||
"@cerc-io/libp2p": "^0.42.2-laconic-0.1.4",
|
"@cerc-io/libp2p": "^0.42.2-laconic-0.1.4",
|
||||||
"@cerc-io/nitro-node": "^0.1.15",
|
"@cerc-io/nitro-node": "^0.1.15",
|
||||||
"@cerc-io/peer": "^0.2.102",
|
"@cerc-io/peer": "^0.2.103",
|
||||||
"@cerc-io/rpc-eth-client": "^0.2.102",
|
"@cerc-io/rpc-eth-client": "^0.2.103",
|
||||||
"@cerc-io/util": "^0.2.102",
|
"@cerc-io/util": "^0.2.103",
|
||||||
"@ethersproject/providers": "^5.4.4",
|
"@ethersproject/providers": "^5.4.4",
|
||||||
"@graphql-tools/utils": "^9.1.1",
|
"@graphql-tools/utils": "^9.1.1",
|
||||||
"@ipld/dag-cbor": "^8.0.0",
|
"@ipld/dag-cbor": "^8.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/codegen",
|
"name": "@cerc-io/codegen",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"description": "Code generator",
|
"description": "Code generator",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@ -20,7 +20,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cerc-io/util": "^0.2.102",
|
"@cerc-io/util": "^0.2.103",
|
||||||
"@graphql-tools/load-files": "^6.5.2",
|
"@graphql-tools/load-files": "^6.5.2",
|
||||||
"@npmcli/package-json": "^5.0.0",
|
"@npmcli/package-json": "^5.0.0",
|
||||||
"@poanet/solidity-flattener": "https://github.com/vulcanize/solidity-flattener.git",
|
"@poanet/solidity-flattener": "https://github.com/vulcanize/solidity-flattener.git",
|
||||||
|
@ -249,7 +249,7 @@ export class Indexer implements IndexerInterface {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const { block: { number } } = await this._ethClient.getBlockByHash(blockHash);
|
const { block: { number } } = await this.getBlockByHash(blockHash);
|
||||||
const blockNumber = ethers.BigNumber.from(number).toNumber();
|
const blockNumber = ethers.BigNumber.from(number).toNumber();
|
||||||
|
|
||||||
log('{{query.name}}: db miss, fetching from upstream server');
|
log('{{query.name}}: db miss, fetching from upstream server');
|
||||||
@ -679,6 +679,10 @@ export class Indexer implements IndexerInterface {
|
|||||||
return this._baseIndexer.getBlocks(blockFilter);
|
return this._baseIndexer.getBlocks(blockFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getBlockByHash (blockHash?: string): Promise<{ block: any }> {
|
||||||
|
return this._baseIndexer.getBlockByHash(blockHash);
|
||||||
|
}
|
||||||
|
|
||||||
async updateSyncStatusIndexedBlock (blockHash: string, blockNumber: number, force = false): Promise<SyncStatus> {
|
async updateSyncStatusIndexedBlock (blockHash: string, blockNumber: number, force = false): Promise<SyncStatus> {
|
||||||
return this._baseIndexer.updateSyncStatusIndexedBlock(blockHash, blockNumber, force);
|
return this._baseIndexer.updateSyncStatusIndexedBlock(blockHash, blockNumber, force);
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,12 @@
|
|||||||
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.3.19",
|
"@apollo/client": "^3.3.19",
|
||||||
"@cerc-io/cli": "^0.2.102",
|
"@cerc-io/cli": "^0.2.103",
|
||||||
"@cerc-io/ipld-eth-client": "^0.2.102",
|
"@cerc-io/ipld-eth-client": "^0.2.103",
|
||||||
"@cerc-io/solidity-mapper": "^0.2.102",
|
"@cerc-io/solidity-mapper": "^0.2.103",
|
||||||
"@cerc-io/util": "^0.2.102",
|
"@cerc-io/util": "^0.2.103",
|
||||||
{{#if (subgraphPath)}}
|
{{#if (subgraphPath)}}
|
||||||
"@cerc-io/graph-node": "^0.2.102",
|
"@cerc-io/graph-node": "^0.2.103",
|
||||||
{{/if}}
|
{{/if}}
|
||||||
"@ethersproject/providers": "^5.4.4",
|
"@ethersproject/providers": "^5.4.4",
|
||||||
"debug": "^4.3.1",
|
"debug": "^4.3.1",
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/graph-node",
|
"name": "@cerc-io/graph-node",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cerc-io/solidity-mapper": "^0.2.102",
|
"@cerc-io/solidity-mapper": "^0.2.103",
|
||||||
"@ethersproject/providers": "^5.4.4",
|
"@ethersproject/providers": "^5.4.4",
|
||||||
"@graphprotocol/graph-ts": "^0.22.0",
|
"@graphprotocol/graph-ts": "^0.22.0",
|
||||||
"@nomiclabs/hardhat-ethers": "^2.0.2",
|
"@nomiclabs/hardhat-ethers": "^2.0.2",
|
||||||
@ -51,9 +51,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.3.19",
|
"@apollo/client": "^3.3.19",
|
||||||
"@cerc-io/assemblyscript": "0.19.10-watcher-ts-0.1.2",
|
"@cerc-io/assemblyscript": "0.19.10-watcher-ts-0.1.2",
|
||||||
"@cerc-io/cache": "^0.2.102",
|
"@cerc-io/cache": "^0.2.103",
|
||||||
"@cerc-io/ipld-eth-client": "^0.2.102",
|
"@cerc-io/ipld-eth-client": "^0.2.103",
|
||||||
"@cerc-io/util": "^0.2.102",
|
"@cerc-io/util": "^0.2.103",
|
||||||
"@types/json-diff": "^0.5.2",
|
"@types/json-diff": "^0.5.2",
|
||||||
"@types/yargs": "^17.0.0",
|
"@types/yargs": "^17.0.0",
|
||||||
"bn.js": "^4.11.9",
|
"bn.js": "^4.11.9",
|
||||||
|
@ -95,6 +95,10 @@ export class Indexer implements IndexerInterface {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getBlockByHash (blockHash?: string): Promise<{ block: any }> {
|
||||||
|
return { block: undefined };
|
||||||
|
}
|
||||||
|
|
||||||
async getBlocksAtHeight (height: number, isPruned: boolean): Promise<BlockProgressInterface[]> {
|
async getBlocksAtHeight (height: number, isPruned: boolean): Promise<BlockProgressInterface[]> {
|
||||||
assert(height);
|
assert(height);
|
||||||
assert(isPruned);
|
assert(isPruned);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/ipld-eth-client",
|
"name": "@cerc-io/ipld-eth-client",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"description": "IPLD ETH Client",
|
"description": "IPLD ETH Client",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -20,8 +20,8 @@
|
|||||||
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.7.1",
|
"@apollo/client": "^3.7.1",
|
||||||
"@cerc-io/cache": "^0.2.102",
|
"@cerc-io/cache": "^0.2.103",
|
||||||
"@cerc-io/util": "^0.2.102",
|
"@cerc-io/util": "^0.2.103",
|
||||||
"cross-fetch": "^3.1.4",
|
"cross-fetch": "^3.1.4",
|
||||||
"debug": "^4.3.1",
|
"debug": "^4.3.1",
|
||||||
"ethers": "^5.4.4",
|
"ethers": "^5.4.4",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/peer",
|
"name": "@cerc-io/peer",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"description": "libp2p module",
|
"description": "libp2p module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"exports": "./dist/index.js",
|
"exports": "./dist/index.js",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/rpc-eth-client",
|
"name": "@cerc-io/rpc-eth-client",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"description": "RPC ETH Client",
|
"description": "RPC ETH Client",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -19,9 +19,9 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
"homepage": "https://github.com/cerc-io/watcher-ts#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cerc-io/cache": "^0.2.102",
|
"@cerc-io/cache": "^0.2.103",
|
||||||
"@cerc-io/ipld-eth-client": "^0.2.102",
|
"@cerc-io/ipld-eth-client": "^0.2.103",
|
||||||
"@cerc-io/util": "^0.2.102",
|
"@cerc-io/util": "^0.2.103",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"ethers": "^5.4.4",
|
"ethers": "^5.4.4",
|
||||||
"left-pad": "^1.3.0",
|
"left-pad": "^1.3.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/solidity-mapper",
|
"name": "@cerc-io/solidity-mapper",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/test",
|
"name": "@cerc-io/test",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/tracing-client",
|
"name": "@cerc-io/tracing-client",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"description": "ETH VM tracing client",
|
"description": "ETH VM tracing client",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@cerc-io/util",
|
"name": "@cerc-io/util",
|
||||||
"version": "0.2.102",
|
"version": "0.2.103",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/utils.keyvaluecache": "^1.0.1",
|
"@apollo/utils.keyvaluecache": "^1.0.1",
|
||||||
"@cerc-io/nitro-node": "^0.1.15",
|
"@cerc-io/nitro-node": "^0.1.15",
|
||||||
"@cerc-io/peer": "^0.2.102",
|
"@cerc-io/peer": "^0.2.103",
|
||||||
"@cerc-io/solidity-mapper": "^0.2.102",
|
"@cerc-io/solidity-mapper": "^0.2.103",
|
||||||
"@cerc-io/ts-channel": "1.0.3-ts-nitro-0.1.1",
|
"@cerc-io/ts-channel": "1.0.3-ts-nitro-0.1.1",
|
||||||
"@ethersproject/properties": "^5.7.0",
|
"@ethersproject/properties": "^5.7.0",
|
||||||
"@ethersproject/providers": "^5.4.4",
|
"@ethersproject/providers": "^5.4.4",
|
||||||
@ -54,7 +54,7 @@
|
|||||||
"yargs": "^17.0.1"
|
"yargs": "^17.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@cerc-io/cache": "^0.2.102",
|
"@cerc-io/cache": "^0.2.103",
|
||||||
"@nomiclabs/hardhat-waffle": "^2.0.1",
|
"@nomiclabs/hardhat-waffle": "^2.0.1",
|
||||||
"@types/bunyan": "^1.8.8",
|
"@types/bunyan": "^1.8.8",
|
||||||
"@types/express": "^4.17.14",
|
"@types/express": "^4.17.14",
|
||||||
|
@ -71,6 +71,22 @@ export const fetchBlocksAtHeight = async (
|
|||||||
|
|
||||||
// Try fetching blocks from eth-server until found.
|
// Try fetching blocks from eth-server until found.
|
||||||
while (!blocks.length) {
|
while (!blocks.length) {
|
||||||
|
const { block: latestBlock } = await indexer.getBlockByHash();
|
||||||
|
const blockProcessingOffset = jobQueueConfig.blockProcessingOffset ?? 0;
|
||||||
|
|
||||||
|
// Process block if it is blockProcessingOffset blocks behind latest block
|
||||||
|
if (latestBlock.number < blockNumber + blockProcessingOffset) {
|
||||||
|
// Check number of retries for fetching new block
|
||||||
|
if (jobQueueConfig.maxNewBlockRetries && newBlockRetries > jobQueueConfig.maxNewBlockRetries) {
|
||||||
|
throw new Error(NEW_BLOCK_MAX_RETRIES_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
newBlockRetries++;
|
||||||
|
log(`Latest block: ${latestBlock.number}, blockProcessingOffset: ${blockProcessingOffset}; retry block to process: ${blockNumber} after ${jobQueueConfig.blockDelayInMilliSecs}ms`);
|
||||||
|
await wait(jobQueueConfig.blockDelayInMilliSecs);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
console.time(`time:common#_fetchBlocks-eth-server-${blockNumber}`);
|
console.time(`time:common#_fetchBlocks-eth-server-${blockNumber}`);
|
||||||
const ethFullBlocks = await indexer.getBlocks({ blockNumber });
|
const ethFullBlocks = await indexer.getBlocks({ blockNumber });
|
||||||
console.timeEnd(`time:common#_fetchBlocks-eth-server-${blockNumber}`);
|
console.timeEnd(`time:common#_fetchBlocks-eth-server-${blockNumber}`);
|
||||||
@ -84,18 +100,8 @@ export const fetchBlocksAtHeight = async (
|
|||||||
|
|
||||||
// Fitler null blocks
|
// Fitler null blocks
|
||||||
blocks = ethFullBlocks.filter(block => Boolean(block)) as EthFullBlock[];
|
blocks = ethFullBlocks.filter(block => Boolean(block)) as EthFullBlock[];
|
||||||
|
assert(blocks.length, `Blocks at ${blockNumber} should exist as latest block is ${latestBlock}`);
|
||||||
|
|
||||||
if (!blocks.length) {
|
|
||||||
log(`No blocks fetched for block number ${blockNumber}, retrying after ${jobQueueConfig.blockDelayInMilliSecs} ms delay.`);
|
|
||||||
|
|
||||||
// Check number of retries for fetching new block
|
|
||||||
if (jobQueueConfig.maxNewBlockRetries && newBlockRetries > jobQueueConfig.maxNewBlockRetries) {
|
|
||||||
throw new Error(NEW_BLOCK_MAX_RETRIES_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
newBlockRetries++;
|
|
||||||
await wait(jobQueueConfig.blockDelayInMilliSecs);
|
|
||||||
} else {
|
|
||||||
blocks.forEach(block => {
|
blocks.forEach(block => {
|
||||||
blockAndEventsMap.set(
|
blockAndEventsMap.set(
|
||||||
block.blockHash,
|
block.blockHash,
|
||||||
@ -110,7 +116,6 @@ export const fetchBlocksAtHeight = async (
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
assert(blocks.length, 'Blocks not fetched');
|
assert(blocks.length, 'Blocks not fetched');
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import { createPruningJob, processBlockByNumber } from './common';
|
|||||||
import { OrderDirection } from './database';
|
import { OrderDirection } from './database';
|
||||||
import { HistoricalJobData, HistoricalJobResponseData } from './job-runner';
|
import { HistoricalJobData, HistoricalJobResponseData } from './job-runner';
|
||||||
import { JobQueueConfig, ServerConfig } from './config';
|
import { JobQueueConfig, ServerConfig } from './config';
|
||||||
import { wait } from './misc';
|
|
||||||
|
|
||||||
const EVENT = 'event';
|
const EVENT = 'event';
|
||||||
const BLOCK_PROGRESS_EVENT = 'block-progress-event';
|
const BLOCK_PROGRESS_EVENT = 'block-progress-event';
|
||||||
@ -105,7 +104,7 @@ export class EventWatcher {
|
|||||||
// Get latest block in chain and sync status from DB
|
// Get latest block in chain and sync status from DB
|
||||||
// Also get historical-processing queue size
|
// Also get historical-processing queue size
|
||||||
const [{ block: latestBlock }, syncStatus, historicalProcessingQueueSize] = await Promise.all([
|
const [{ block: latestBlock }, syncStatus, historicalProcessingQueueSize] = await Promise.all([
|
||||||
this._ethClient.getBlockByHash(),
|
this._indexer.getBlockByHash(),
|
||||||
this._indexer.getSyncStatus(),
|
this._indexer.getSyncStatus(),
|
||||||
this._jobQueue.getQueueSize(QUEUE_HISTORICAL_PROCESSING, 'completed')
|
this._jobQueue.getQueueSize(QUEUE_HISTORICAL_PROCESSING, 'completed')
|
||||||
]);
|
]);
|
||||||
@ -196,18 +195,7 @@ export class EventWatcher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isComplete) {
|
if (isComplete) {
|
||||||
while (true) {
|
|
||||||
const { block: latestBlock } = await this._ethClient.getBlockByHash();
|
|
||||||
|
|
||||||
// Process block if it is blockProcessingOffset blocks behind latest block
|
|
||||||
if (latestBlock.number >= blockNumber + (this._config.jobQueue.blockProcessingOffset ?? 0)) {
|
|
||||||
await processBlockByNumber(this._jobQueue, blockNumber + 1);
|
await processBlockByNumber(this._jobQueue, blockNumber + 1);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
log(`Latest block: ${latestBlock.number}; retry next block to process: ${blockNumber + 1} after ${this._config.jobQueue.blockDelayInMilliSecs}ms`);
|
|
||||||
await wait(this._config.jobQueue.blockDelayInMilliSecs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -394,6 +394,10 @@ export class Indexer {
|
|||||||
return blocks;
|
return blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getBlockByHash (blockHash?: string): Promise<{ block: any }> {
|
||||||
|
return this._ethClient.getBlockByHash(blockHash);
|
||||||
|
}
|
||||||
|
|
||||||
async getBlockProgress (blockHash: string): Promise<BlockProgressInterface | undefined> {
|
async getBlockProgress (blockHash: string): Promise<BlockProgressInterface | undefined> {
|
||||||
return this._db.getBlockProgress(blockHash);
|
return this._db.getBlockProgress(blockHash);
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,12 @@ export const isSyncingHistoricalBlocks = new client.Gauge({
|
|||||||
});
|
});
|
||||||
isSyncingHistoricalBlocks.set(Number(undefined));
|
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({
|
export const ethRpcErrors = new client.Counter({
|
||||||
name: 'watcher_eth_rpc_errors',
|
name: 'watcher_eth_rpc_errors',
|
||||||
help: 'Number of ETH RPC request errors',
|
help: 'Number of ETH RPC request errors',
|
||||||
|
@ -22,7 +22,7 @@ import { ResultEvent } from './indexer';
|
|||||||
import { EventInterface, EthFullBlock, EthFullTransaction } from './types';
|
import { EventInterface, EthFullBlock, EthFullTransaction } from './types';
|
||||||
import { BlockHeight } from './database';
|
import { BlockHeight } from './database';
|
||||||
import { Transaction } from './graph/utils';
|
import { Transaction } from './graph/utils';
|
||||||
import { ethRpcErrors, ethRpcRequestDuration } from './metrics';
|
import { ethRpcCount, ethRpcErrors, ethRpcRequestDuration } from './metrics';
|
||||||
|
|
||||||
const JSONbigNative = JSONbig({ useNativeBigInt: true });
|
const JSONbigNative = JSONbig({ useNativeBigInt: true });
|
||||||
|
|
||||||
@ -379,6 +379,7 @@ export class MonitoredStaticJsonRpcProvider extends providers.StaticJsonRpcProvi
|
|||||||
// Rethrow the error
|
// Rethrow the error
|
||||||
throw err;
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
|
ethRpcCount.inc({ method, provider: this.connection.url }, 1);
|
||||||
endTimer();
|
endTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,6 +171,7 @@ export interface IndexerInterface {
|
|||||||
getSyncStatus (): Promise<SyncStatusInterface | undefined>
|
getSyncStatus (): Promise<SyncStatusInterface | undefined>
|
||||||
getStateSyncStatus (): Promise<StateSyncStatusInterface | undefined>
|
getStateSyncStatus (): Promise<StateSyncStatusInterface | undefined>
|
||||||
getBlocks (blockFilter: { blockHash?: string, blockNumber?: number }): Promise<Array<EthFullBlock | null>>
|
getBlocks (blockFilter: { blockHash?: string, blockNumber?: number }): Promise<Array<EthFullBlock | null>>
|
||||||
|
getBlockByHash (blockHash?: string): Promise<{ block: any }>
|
||||||
getBlocksAtHeight (height: number, isPruned: boolean): Promise<BlockProgressInterface[]>
|
getBlocksAtHeight (height: number, isPruned: boolean): Promise<BlockProgressInterface[]>
|
||||||
getLatestCanonicalBlock (): Promise<BlockProgressInterface | undefined>
|
getLatestCanonicalBlock (): Promise<BlockProgressInterface | undefined>
|
||||||
getLatestStateIndexedBlock (): Promise<BlockProgressInterface>
|
getLatestStateIndexedBlock (): Promise<BlockProgressInterface>
|
||||||
|
Loading…
Reference in New Issue
Block a user