ponder 0.8.25 → 0.8.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2413,6 +2413,7 @@ var MetricsService = class {
2413
2413
  ponder_historical_cached_blocks;
2414
2414
  ponder_historical_completed_blocks;
2415
2415
  ponder_realtime_reorg_total;
2416
+ ponder_realtime_latency;
2416
2417
  ponder_database_method_duration;
2417
2418
  ponder_database_method_error_total;
2418
2419
  ponder_http_server_port;
@@ -2511,10 +2512,17 @@ var MetricsService = class {
2511
2512
  });
2512
2513
  this.ponder_realtime_reorg_total = new prometheus.Counter({
2513
2514
  name: "ponder_realtime_reorg_total",
2514
- help: "Count of how many re-orgs have occurred.",
2515
+ help: "Count of how many re-orgs have occurred",
2515
2516
  labelNames: ["network"],
2516
2517
  registers: [this.registry]
2517
2518
  });
2519
+ this.ponder_realtime_latency = new prometheus.Histogram({
2520
+ name: "ponder_realtime_latency",
2521
+ help: "Time elapsed between receiving a block and fully processing it",
2522
+ labelNames: ["network"],
2523
+ buckets: httpRequestDurationMs,
2524
+ registers: [this.registry]
2525
+ });
2518
2526
  this.ponder_database_method_duration = new prometheus.Histogram({
2519
2527
  name: "ponder_database_method_duration",
2520
2528
  help: "Duration of database operations",
@@ -9300,7 +9308,8 @@ var createRealtimeSync = (args) => {
9300
9308
  factoryLogs,
9301
9309
  traces,
9302
9310
  transactions,
9303
- transactionReceipts
9311
+ transactionReceipts,
9312
+ endClock
9304
9313
  }) => {
9305
9314
  args.common.logger.debug({
9306
9315
  service: "realtime",
@@ -9457,7 +9466,8 @@ var createRealtimeSync = (args) => {
9457
9466
  logs,
9458
9467
  traces,
9459
9468
  transactions,
9460
- transactionReceipts
9469
+ transactionReceipts,
9470
+ endClock
9461
9471
  });
9462
9472
  const blockMovesFinality = hexToNumber6(block.number) >= hexToNumber6(finalizedBlock.number) + 2 * args.network.finalityBlockCount;
9463
9473
  if (blockMovesFinality) {
@@ -9870,9 +9880,10 @@ var createRealtimeSync = (args) => {
9870
9880
  });
9871
9881
  return;
9872
9882
  }
9883
+ const endClock = startClock();
9873
9884
  const blockWithEventData = await fetchBlockEventData(block);
9874
9885
  consecutiveErrors = 0;
9875
- return queue.add(blockWithEventData);
9886
+ return queue.add({ ...blockWithEventData, endClock });
9876
9887
  } catch (_error) {
9877
9888
  if (isKilled)
9878
9889
  return;
@@ -10590,6 +10601,19 @@ var createSync = async (args) => {
10590
10601
  msg: `Indexed ${events.length} events`
10591
10602
  });
10592
10603
  }
10604
+ for (const network2 of args.networks) {
10605
+ for (const { block, endClock } of perNetworkSync.get(network2).unfinalizedBlocks) {
10606
+ const checkpoint = encodeCheckpoint(
10607
+ blockToCheckpoint(block, network2.chainId, "up")
10608
+ );
10609
+ if (checkpoint > from && checkpoint <= to && endClock) {
10610
+ args.common.metrics.ponder_realtime_latency.observe(
10611
+ { network: network2.name },
10612
+ endClock()
10613
+ );
10614
+ }
10615
+ }
10616
+ }
10593
10617
  });
10594
10618
  }
10595
10619
  break;
@@ -10976,7 +11000,7 @@ async function* localHistoricalSyncGenerator({
10976
11000
  }
10977
11001
  const duration = endClock();
10978
11002
  common.metrics.ponder_sync_block.set(
10979
- { network: network.name },
11003
+ label,
10980
11004
  hexToNumber7(syncProgress.current.number)
10981
11005
  );
10982
11006
  common.metrics.ponder_historical_duration.observe(label, duration);