From 00b514448b20f7d6fd845346419cba73087f461e Mon Sep 17 00:00:00 2001 From: Aleksandr Tereshchenko Date: Wed, 6 Nov 2024 15:47:52 +0200 Subject: [PATCH] Remove prom-client, prometheus metric collection and exporer's /metrics endpoint --- importer-api/package-lock.json | 26 -------------------------- importer-api/package.json | 1 - importer-api/src/explorer/index.js | 9 +-------- importer-api/src/importer.js | 2 -- importer-api/src/prom.js | 15 --------------- importer-api/src/scheduler.js | 3 --- 6 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 importer-api/src/prom.js diff --git a/importer-api/package-lock.json b/importer-api/package-lock.json index aa6bf6e0..ac3650ab 100644 --- a/importer-api/package-lock.json +++ b/importer-api/package-lock.json @@ -17,7 +17,6 @@ "node-cron": "^3.0.1", "node-nats-streaming": "^0.3.0", "pg": "^8.12.0", - "prom-client": "^14.0.0", "redis": "^3.1.1", "winston": "^3.2.1", "winston-gelf-transporter": "^1.0.2" @@ -169,11 +168,6 @@ "node": ">=8" } }, - "node_modules/bintrees": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bintrees/-/bintrees-1.0.1.tgz", - "integrity": "sha1-DmVcm5wkNeqraL9AJyJtK1WjRSQ=" - }, "node_modules/body-parser": { "version": "1.20.3", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", @@ -1477,18 +1471,6 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, - "node_modules/prom-client": { - "version": "14.2.0", - "resolved": "https://registry.npmjs.org/prom-client/-/prom-client-14.2.0.tgz", - "integrity": "sha512-sF308EhTenb/pDRPakm+WgiN+VdM/T1RaHj1x+MvAuT8UiQP8JmOEbxVqtkbfR4LrvOg5n7ic01kRBDGXjYikA==", - "license": "Apache-2.0", - "dependencies": { - "tdigest": "^0.1.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -1875,14 +1857,6 @@ "node": ">=8.0.0" } }, - "node_modules/tdigest": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/tdigest/-/tdigest-0.1.1.tgz", - "integrity": "sha1-Ljyyw56kSeVdHmzZEReszKRYgCE=", - "dependencies": { - "bintrees": "1.0.1" - } - }, "node_modules/text-hex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", diff --git a/importer-api/package.json b/importer-api/package.json index 91b60f81..f4916594 100644 --- a/importer-api/package.json +++ b/importer-api/package.json @@ -19,7 +19,6 @@ "node-cron": "^3.0.1", "node-nats-streaming": "^0.3.0", "pg": "^8.12.0", - "prom-client": "^14.0.0", "redis": "^3.1.1", "winston": "^3.2.1", "winston-gelf-transporter": "^1.0.2" diff --git a/importer-api/src/explorer/index.js b/importer-api/src/explorer/index.js index 3d1e2454..8e321748 100644 --- a/importer-api/src/explorer/index.js +++ b/importer-api/src/explorer/index.js @@ -7,8 +7,6 @@ const { IS_DEV } = require('../config') const { logger } = require('../utils/logger') const { del: redisDel } = require('../utils/redis') -const { prom } = require('../prom') - const { DB_USERNAME, DB_PASSWORD, DB_PORT, DB_HOST, DB_DATABASE } = process.env const knex = require('knex')({ @@ -20,7 +18,7 @@ const knex = require('knex')({ password: DB_PASSWORD, database: DB_DATABASE, port: DB_PORT, - ssl: !IS_DEV ? { rejectUnauthorized: false } : false, + ssl: !IS_DEV ? { rejectUnauthorized: false } : false }, pool: { min: 0, @@ -28,11 +26,6 @@ const knex = require('knex')({ } }) -app.get('/metrics', async (req, res) => { - res.setHeader('content-type', 'text/plain') - res.send(await prom.register.metrics()) -}) - app.use((req, res, next) => { const { EXPLORER_TOKEN } = process.env diff --git a/importer-api/src/importer.js b/importer-api/src/importer.js index 2f526ee9..ceaea112 100644 --- a/importer-api/src/importer.js +++ b/importer-api/src/importer.js @@ -6,7 +6,6 @@ const { SONIC, IS_DEV, CURRENT_EXECUTION_HASH, UPDATE_RETRY_LIMIT } = require('. const { sleep } = require('./utils') const postUpdate = require('./utils/postUpdate') const { logger } = require('./utils/logger') -const { errorCounter } = require('./prom') const forbiddenServiceIds = [] let isImporting = false @@ -58,7 +57,6 @@ const serviceUpdateFun = serviceId => { } catch (err) { logger.error({ message: err.message, meta: err.stack }) logger.error({ message: 'Importing failed', meta: err.stack }) - errorCounter.inc({ service: serviceId }) if (resourceWasForbidden(serviceId, err)) return if (attempt > UPDATE_RETRY_LIMIT) return diff --git a/importer-api/src/prom.js b/importer-api/src/prom.js deleted file mode 100644 index 7e8e0f71..00000000 --- a/importer-api/src/prom.js +++ /dev/null @@ -1,15 +0,0 @@ -const prom = require('prom-client') - -const successCounter = new prom.Counter({ - name: 'imported', - help: 'how much stuff is imported', - labelNames: ['service'] -}) - -const errorCounter = new prom.Counter({ - name: 'errors', - help: 'how much errors when importing', - labelNames: ['service'] -}) - -module.exports = { prom, successCounter, errorCounter } diff --git a/importer-api/src/scheduler.js b/importer-api/src/scheduler.js index fd422353..d59ce0fc 100644 --- a/importer-api/src/scheduler.js +++ b/importer-api/src/scheduler.js @@ -13,8 +13,6 @@ const { FETCH_AMOUNT, MAX_CHUNK_SIZE, APIS, PANIC_TIMEOUT } = require('./config' const { logger } = require('./utils/logger') const chunkify = require('./utils/chunkify') -const { successCounter } = require('./prom') - const API_MAPPING = { [APIS.ori]: oriRequest, [APIS.kori]: koriRequest, @@ -91,7 +89,6 @@ const initializeStatusChannel = (channel, ordinalKey, executionHash, handleFinis total: amountScheduled, serviceId }) - successCounter.inc({ service: serviceId }, amount) } if (result === Number(amountScheduled)) { handleFinish()