Merge pull request #4152 from specklesystems/iain/fix-prometheus-summary
fix(server): prometheus summary should be over rolling window
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { TIME } from '@speckle/shared'
|
||||
import Bull from 'bull'
|
||||
import { type Registry, Counter, Summary, Gauge } from 'prom-client'
|
||||
|
||||
@@ -107,8 +108,10 @@ export const initializeMetrics = (params: {
|
||||
)
|
||||
const previewJobsProcessedSummary = new Summary<'status'>({
|
||||
name: 'speckle_server_preview_jobs_processed_duration_seconds',
|
||||
help: 'Duration of preview job processing, in seconds',
|
||||
labelNames: ['status']
|
||||
help: 'Duration of preview job processing, in seconds, as sampled over a period of 1 minute.',
|
||||
labelNames: ['status'],
|
||||
maxAgeSeconds: 1 * TIME.minute,
|
||||
ageBuckets: 5
|
||||
})
|
||||
|
||||
return { previewJobsProcessedSummary }
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Logger } from 'pino'
|
||||
import { toNDecimalPlaces } from '@/modules/core/utils/formatting'
|
||||
import { omit } from 'lodash'
|
||||
import { getRequestContext } from '@/observability/components/express/requestContext'
|
||||
import { collectLongTrace } from '@speckle/shared'
|
||||
import { collectLongTrace, TIME } from '@speckle/shared'
|
||||
|
||||
let metricQueryDuration: Summary<string>
|
||||
let metricQueryErrors: Counter<string>
|
||||
@@ -134,7 +134,9 @@ export const initKnexPrometheusMetrics = async (params: {
|
||||
registers,
|
||||
labelNames: ['sqlMethod', 'sqlNumberBindings', 'region'],
|
||||
name: 'speckle_server_knex_query_duration',
|
||||
help: 'Summary of the DB query durations in seconds'
|
||||
help: 'Summary of the DB query durations in seconds, as computed over the last 1 minute.',
|
||||
maxAgeSeconds: 1 * TIME.minute,
|
||||
ageBuckets: 5
|
||||
})
|
||||
|
||||
registers.forEach((r) => r.removeSingleMetric('speckle_server_knex_query_errors'))
|
||||
|
||||
Reference in New Issue
Block a user