Prom2Json SE
Description
This small module is helping with conversion between Prometheus string output and JSON. JSON format is not standard output for Prometheus, but some processors prefer to use that one over any other.
Some snippets are inspired by https://github.com/anasceym/prom2json-stream
Installation
// If you use npmnpm i prom2json-se -S // If you use yarnyarn add prom2json-se
How to use
// Load moduleconst prom2Json = ; // Use moduleconst promString = `...`;const promJson = prom2Json;
Simple example with Prometheus client:
const express = ;const app = ; ... const Prometheus = ;const prom2Json = ; // Default Metrics (every 10s)Prometheus; // Add metrics endpointapp; ... app;
License
This module has MIT license.