
Prometheus Has a Free API That Gives You Time-Series Metrics for Any Application
Prometheus is the open-source monitoring system. Its client libraries let you instrument any Node.js app with custom metrics. prom-client: The Node.js SDK import { Registry , Counter , Histogram , Gauge , Summary , collectDefaultMetrics } from " prom-client " ; const register = new Registry (); collectDefaultMetrics ({ register }); // CPU, memory, event loop, etc. // Counter — monotonically increasing const scrapeCounter = new Counter ({ name : " scrapes_total " , help : " Total number of scrape operations " , labelNames : [ " source " , " status " ], registers : [ register ], }); scrapeCounter . inc ({ source : " amazon " , status : " success " }); scrapeCounter . inc ({ source : " amazon " , status : " error " }); // Histogram — request durations, response sizes const scrapeDuration = new Histogram ({ name : " scrape_duration_seconds " , help : " Scrape operation duration in seconds " , labelNames : [ " source " ], buckets : [ 0.1 , 0.5 , 1 , 2 , 5 , 10 , 30 ], registers : [ register
Continue reading on Dev.to DevOps
Opens in a new tab



