"use strict"; const prometheusClient = require("prom-client"); module.exports = function createPrometheus() { let prometheusRegistry = new prometheusClient.Registry(); prometheusClient.collectDefaultMetrics({ register: prometheusRegistry }); return { prometheusRegistry: prometheusRegistry, metrics: { storedItems: new prometheusClient.Counter({ registers: [ prometheusRegistry ], name: "srap_stored_items_total", help: "Amount of items that have been created or updated", labelNames: [ "tag" ] }), successfulItems: new prometheusClient.Counter({ registers: [ prometheusRegistry ], name: "srap_successful_items_total", help: "Amount of items that have been successfully processed", labelNames: [ "task" ] }), failedItems: new prometheusClient.Counter({ registers: [ prometheusRegistry ], name: "srap_failed_items_total", help: "Amount of items that have failed during processing", labelNames: [ "task" ] }), taskFetchTime: new prometheusClient.Gauge({ registers: [ prometheusRegistry ], name: "srap_task_fetch_seconds", help: "Time needed for the most recent attempt at fetching new scraping tasks", labelNames: [ "task" ] }), taskFetchResults: new prometheusClient.Gauge({ registers: [ prometheusRegistry ], name: "srap_task_fetch_results_count", help: "Amount of new scraping tasks fetched during the most recent attempt", labelNames: [ "task" ] }), taskRefillTime: new prometheusClient.Gauge({ registers: [ prometheusRegistry ], name: "srap_task_refill_seconds", help: "Time needed for the most recent refill of the task queue", labelNames: [ "task" ] }), taskRefillResults: new prometheusClient.Gauge({ registers: [ prometheusRegistry ], name: "srap_task_refill_results_count", help: "Amount of new scraping tasks added to queue during the most recent attempt", labelNames: [ "task" ] }) } }; };