Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace block wait metric with Histogram #424

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion runner/src/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import express from 'express';
import { Gauge, Histogram, Counter, AggregatorRegistry } from 'prom-client';

const BLOCK_WAIT_DURATION = new Gauge({
const BLOCK_WAIT_DURATION = new Histogram({
name: 'queryapi_runner_block_wait_duration_milliseconds',
help: 'Time an indexer function waited for a block before processing',
labelNames: ['indexer', 'type'],
buckets: [1, 10, 100, 300, 500, 1000, 3000, 5000, 10000, 30000],
});

const CACHE_HIT = new Counter({
Expand Down
2 changes: 1 addition & 1 deletion runner/src/stream-handler/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async function blockQueueConsumer (workerContext: WorkerContext, streamKey: stri
console.error('Block failed to process or does not have block height', block);
continue;
}
METRICS.BLOCK_WAIT_DURATION.labels({ indexer: indexerName, type: workerContext.streamType }).set(performance.now() - blockStartTime);
METRICS.BLOCK_WAIT_DURATION.labels({ indexer: indexerName, type: workerContext.streamType }).observe(performance.now() - blockStartTime);
await indexer.runFunctions(block, functions, isHistorical, { provision: true });

await workerContext.redisClient.deleteStreamMessage(streamKey, streamMessageId);
Expand Down