Skip to content
Snippets Groups Projects
Commit a738be84 authored by kawa.acikgoez's avatar kawa.acikgoez Committed by julian.baeume
Browse files

Add: Gauge for Redis version

parent adab68d1
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,16 @@ export const fileCacheSizeGauge = new Gauge({
help: 'Number of entries in file cache'
})
export const versionCountGauge = new Gauge({
name: 'redis_version_count_gauge',
help: 'Number of cache versions stored in Redis',
async collect () {
const pattern = `${process.env.REDIS_PREFIX}:*:mergedMetadata`
const results = await redis.client.keys(pattern)
this.set(results.length)
}
})
export function set (key, value, timeout) {
logger.debug(`[Cache] Set ${key}`)
if (cache[key] === value) return
......
......@@ -189,7 +189,7 @@ export async function updateVersionProcessor (pubClient) {
await warmCache({ version: fetchedVersionInfo.version, fetchFiles: true })
await redis.client.set(getRedisKey({ name: 'versionInfo' }), stringifiedVersionInfo)
await cache.get(getRedisKey({ version: fetchedVersionInfo.version, name: 'mergedMetadata' }), async () => [await fetchMergedMetadata()])
versionUpdateGauge.setToCurrentTime({ version: fetchVersionInfo.version })
versionUpdateGauge.setToCurrentTime({ version: fetchedVersionInfo.version })
logger.info('[Version] publish update to other nodes.')
pubClient.publish(getRedisKey({ name: 'updateVersionInfo' }), stringifiedVersionInfo)
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment