0.1.1 • Published 3 years ago

eyebeam v0.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

Eyebeam

Dashboard for prometheus metrics

Example

Result

example

Simple express server with prometheus metrics

const express = require('express');
const { collectDefaultMetrics, register, Counter } = require('prom-client');
const eyebeam = require('../dist');

const PORT = 3000;

collectDefaultMetrics();

const app = express();
const counter = new Counter({ name: "metrics_counter", help: "Total metrics calls" });

app.get('/', (req, res) => {
    res.send('Hello World!');
});


app.get('/metrics', (req, res) => {
    counter.inc();
    res.setHeader('Content-Type', register.contentType);
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.send(register.metrics());
});

app.get('/eyebeam', eyebeam.handler({ url: `/metrics`, interval: 1500 }));

app.listen(PORT, () => {
    console.log(`Express server http://localhost:${PORT}`);
    console.log(`Prometheus metrics http://localhost:${PORT}/metrics`);
    console.log(`Eyebeam dashboard http://localhost:${PORT}/eyebeam`);
});

Run

npm run example
0.1.1

3 years ago

0.1.0

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago