Skip to content

An easy-to-run playground for exporting Prometheus metrics from Node.js and querying them with Grafana.

Notifications You must be signed in to change notification settings

leventebalogh/playground-nodejs-prometheus-grafana

Repository files navigation

Node.js + Prometheus + Grafana

This is a simple playground for exposing metrics from a Node.js service to Prometheus and then querying Prometheus from Grafana.

 Node.JS      (:8080)        Prometheus   (:9090)       Grafana        (:3000)
+-------------------+       +-------------------+      +---------------------+
|                   |       |                   |      |                     |
|                   |       |   Scrape          |      |  Query with         |
|     /metrics      <-------+   every           <------+  PromQL             |
|                   |       |   1s              |      |                     |
|                   |       |                   |      |                     |
+-------------------+       +-------------------+      +---------------------+

Exposed metrics:

  • metric_gauge - A gauge type metric. More info
  • metric_counter - A counter type metric. More info
  • metric_histogram - A histogram type metric. More info

Start

# Starts the following services:
# - Node.js - http://localhost:8080 
# - Prometheus - http://localhost:9090 
# - Grafana - http://localhost:3000 
$ docker-compose up

Visit http://localhost:3000/explore for playing around with the metrics. (The service is scraped for random metrics every 1s for more frequent data)


Development

# Starts the Node.js service and restarts it on changes
$ yarn dev

# Starts Prometheus and Grafana
$ docker-compose up prometheus grafana

About

An easy-to-run playground for exporting Prometheus metrics from Node.js and querying them with Grafana.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published