update: push the job duration of dispatchMilestoneSnapshots to raw
This commit is contained in:
parent
9ba1a0c6f0
commit
3f8f47895c
@ -7,7 +7,7 @@ const exporter = new OTLPMetricExporter({
|
||||
|
||||
const metricReader = new PeriodicExportingMetricReader({
|
||||
exporter: exporter,
|
||||
exportIntervalMillis: 5000
|
||||
exportIntervalMillis: 2000
|
||||
});
|
||||
|
||||
const meterProvider = new MeterProvider({
|
||||
@ -24,6 +24,10 @@ export const queueJobsCounter = meter.createGauge("queue_jobs_count", {
|
||||
description: "Number of jobs in specific BullMQ queue"
|
||||
});
|
||||
|
||||
export const jobDurationRaw = meter.createGauge("job_duration_raw", {
|
||||
description: "Execution duration of BullMQ jobs in milliseconds"
|
||||
});
|
||||
|
||||
export const jobDuration = meter.createHistogram("job_duration", {
|
||||
description: "Execution duration of BullMQ jobs in milliseconds",
|
||||
unit: "ms"
|
||||
|
||||
@ -6,7 +6,7 @@ import { scheduleSnapshot } from "db/snapshotSchedule";
|
||||
import logger from "@core/log";
|
||||
import { HOUR, MINUTE, SECOND } from "@core/lib";
|
||||
import { sql } from "@core/db/dbNew";
|
||||
import { jobCounter, jobDuration } from "metrics";
|
||||
import { jobCounter, jobDuration, jobDurationRaw } from "metrics";
|
||||
|
||||
export const dispatchMilestoneSnapshotsWorker = async (_job: Job) => {
|
||||
const start = Date.now();
|
||||
@ -34,6 +34,6 @@ export const dispatchMilestoneSnapshotsWorker = async (_job: Job) => {
|
||||
const duration = Date.now() - start;
|
||||
|
||||
jobCounter.add(1, { jobName: "dispatchMilestoneSnapshots" });
|
||||
jobDuration.record(duration, { jobName: "dispatchMilestoneSnapshots" });
|
||||
jobDurationRaw.record(duration, { jobName: "dispatchMilestoneSnapshots" });
|
||||
}
|
||||
};
|
||||
|
||||
@ -72,7 +72,7 @@ export async function initMQ() {
|
||||
});
|
||||
|
||||
await MiscQueue.upsertJobScheduler("collectQueueMetrics", {
|
||||
every: 10 * SECOND,
|
||||
every: 3 * SECOND,
|
||||
immediately: true
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user