@@ -139,6 +139,18 @@ export const createEffects = async (ctx) => {
139139
140140 const gauge = MetricsClient . gaugeWith ( { } )
141141
142+ const evaluationCounter = MetricsClient . counterWith ( { } ) ( {
143+ name : 'ao_process_total_evaluations' ,
144+ description : 'The total number of evaluations on a CU' ,
145+ labelNames : [ 'stream_type' , 'message_type' , 'process_error' ]
146+ } )
147+
148+ const gatewayCounter = MetricsClient . counterWith ( { } ) ( {
149+ name : 'ao_process_total_graphql_queries' ,
150+ description : 'The total number of GraphQL queries on a CU' ,
151+ labelNames : [ 'query_name' , 'result' ]
152+ } )
153+
142154 const readProcessMemoryFile = AoProcessClient . readProcessMemoryFileWith ( {
143155 DIR : ctx . PROCESS_MEMORY_CACHE_FILE_DIR ,
144156 readFile
@@ -193,6 +205,7 @@ export const createEffects = async (ctx) => {
193205 const saveCheckpoint = AoProcessClient . saveCheckpointWith ( {
194206 address,
195207 readProcessMemoryFile,
208+ gatewayCounter,
196209 queryGateway : ArweaveClient . queryGatewayWith ( { fetch : ctx . fetch , GRAPHQL_URL : ctx . GRAPHQL_URL , logger : ctx . logger } ) ,
197210 queryCheckpointGateway : ArweaveClient . queryGatewayWith ( { fetch : ctx . fetch , GRAPHQL_URL : ctx . CHECKPOINT_GRAPHQL_URL , logger : ctx . logger } ) ,
198211 hashWasmMemory : WasmClient . hashWasmMemoryWith ( { logger : ctx . logger } ) ,
@@ -258,12 +271,6 @@ export const createEffects = async (ctx) => {
258271 const loadMemoryUsage = ( ) => process . memoryUsage ( )
259272 const loadProcessCacheUsage = ( ) => wasmMemoryCache . data . loadProcessCacheUsage ( )
260273
261- const evaluationCounter = MetricsClient . counterWith ( { } ) ( {
262- name : 'ao_process_total_evaluations' ,
263- description : 'The total number of evaluations on a CU' ,
264- labelNames : [ 'stream_type' , 'message_type' , 'process_error' ]
265- } )
266-
267274 /**
268275 * TODO: Gas can grow to a huge number. We need to make sure this doesn't crash when that happens
269276 */
@@ -276,7 +283,7 @@ export const createEffects = async (ctx) => {
276283 const BLOCK_GRAPHQL_ARRAY = ctx . GRAPHQL_URLS . length > 0 ? ctx . GRAPHQL_URLS : [ ctx . GRAPHQL_URL ]
277284
278285 const common = ( logger ) => ( {
279- loadTransactionMeta : ArweaveClient . loadTransactionMetaWith ( { fetch : ctx . fetch , GRAPHQL_URL : ctx . GRAPHQL_URL , logger } ) ,
286+ loadTransactionMeta : ArweaveClient . loadTransactionMetaWith ( { gatewayCounter , fetch : ctx . fetch , GRAPHQL_URL : ctx . GRAPHQL_URL , logger } ) ,
280287 loadTransactionData : ArweaveClient . loadTransactionDataWith ( { fetch : ctx . fetch , ARWEAVE_URL : ctx . ARWEAVE_URL , logger } ) ,
281288 isProcessOwnerSupported : AoProcessClient . isProcessOwnerSupportedWith ( { ALLOW_OWNERS : ctx . ALLOW_OWNERS } ) ,
282289 findProcess : AoProcessClient . findProcessWith ( { db, logger } ) ,
@@ -288,6 +295,7 @@ export const createEffects = async (ctx) => {
288295 findFileCheckpointBefore : AoProcessClient . findFileCheckpointBeforeWith ( { db } ) ,
289296 findRecordCheckpointBefore : AoProcessClient . findRecordCheckpointBeforeWith ( { db } ) ,
290297 address,
298+ gatewayCounter,
291299 queryGateway : ArweaveClient . queryGatewayWith ( { fetch : ctx . fetch , GRAPHQL_URL : ctx . GRAPHQL_URL , logger } ) ,
292300 queryCheckpointGateway : ArweaveClient . queryGatewayWith ( { fetch : ctx . fetch , GRAPHQL_URL : ctx . CHECKPOINT_GRAPHQL_URL , logger } ) ,
293301 PROCESS_IGNORE_ARWEAVE_CHECKPOINTS : ctx . PROCESS_IGNORE_ARWEAVE_CHECKPOINTS ,
@@ -307,12 +315,14 @@ export const createEffects = async (ctx) => {
307315 logger
308316 } ) ,
309317 evaluationCounter,
318+ gatewayCounter,
310319 // gasCounter,
311320 saveProcess : AoProcessClient . saveProcessWith ( { db, logger } ) ,
312321 findEvaluation : AoEvaluationClient . findEvaluationWith ( { db, logger } ) ,
313322 saveEvaluation : AoEvaluationClient . saveEvaluationWith ( { db, logger } ) ,
314323 findBlocks : AoBlockClient . findBlocksWith ( { db, logger } ) ,
315324 saveBlocks : AoBlockClient . saveBlocksWith ( { db, logger } ) ,
325+ getLatestBlock : AoBlockClient . getLatestBlockWith ( { ARWEAVE_URL : ctx . ARWEAVE_URL } ) ,
316326 loadBlocksMeta : AoBlockClient . loadBlocksMetaWith ( { fetch : ctx . fetch , GRAPHQL_URLS : BLOCK_GRAPHQL_ARRAY , pageSize : 90 , logger } ) ,
317327 findModule : AoModuleClient . findModuleWith ( { db, logger } ) ,
318328 saveModule : AoModuleClient . saveModuleWith ( { db, logger } ) ,
@@ -343,6 +353,7 @@ export const createEffects = async (ctx) => {
343353 loadTimestamp : HbClient . loadTimestampWith ( { fetch : ctx . fetch , logger } ) ,
344354 loadProcess : HbClient . loadProcessWith ( { fetch : ctx . fetch , logger } ) ,
345355 loadMessages : HbClient . loadMessagesWith ( {
356+ gatewayCounter,
346357 hashChain : ( ...args ) => hashChainWorker . exec ( 'hashChain' , args ) ,
347358 fetch : ctx . fetch ,
348359 pageSize : 1000 ,
0 commit comments