Skip to content

Commit

Permalink
add histograms for upload statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
rassokhin-s committed Mar 21, 2024
1 parent 549fa91 commit 77ac5cd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions services/rfcx/ingest.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const audioService = require('../audio')
const dirUtil = require('../../utils/dir')
const segmentService = require('../rfcx/segments')
const { chunks } = require('../../utils/array')
const { getKeyByValue } = require('../../utils/obj')
const { PROMETHEUS_ENABLED, registerHistogram, pushHistogramMetric } = require('../../services/prometheus')
const path = require('path')
const moment = require('moment-timezone')
Expand Down Expand Up @@ -34,6 +35,9 @@ if (PROMETHEUS_ENABLED) {
const name = ext.substr(1)
registerHistogram(name, `Processing metric for ${name} format.`)
})
Object.keys(db.status).forEach((s) => {
registerHistogram(s, `${s} upload status.`)
})
}

/**
Expand Down Expand Up @@ -285,6 +289,9 @@ async function ingest (fileStoragePath, fileLocalPath, streamId, uploadId) {
const message = err instanceof IngestionError ? err.message : 'Server failed with processing your file. Please try again later.'
const status = err instanceof IngestionError ? err.status : db.status.FAILED
await db.updateUploadStatus(uploadId, status, message)
if (PROMETHEUS_ENABLED) {
pushHistogramMetric(getKeyByValue(db.status, status), 1)
}
for (const file of outputFiles) {
try {
if (file.remotePath) {
Expand Down

0 comments on commit 77ac5cd

Please sign in to comment.