Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/briankopp/prometheus-express
https://github.com/briankopp/prometheus-express
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/briankopp/prometheus-express
- Owner: BrianKopp
- Created: 2019-09-28T15:55:11.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:46:34.000Z (almost 2 years ago)
- Last Synced: 2024-01-30T12:09:16.514Z (10 months ago)
- Language: TypeScript
- Size: 181 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prometheus-Express
`prometheus-express` is a simple to use, extensible express plugin to serve
request statistics through prometheus.## Getting Started
### Installation
```bash
npm install --save prometheus-express
```### Usage
Using with JavaScript:
```js
const express = require('express');
const promExpress = require('prometheus-express');
const app = express();
app.use(promExpress.instrumentExpress());// ... your code
```Using with TypeScrypt:
```ts
import express from 'express';
import promExpress from 'prometheus-express';
const app = express();
app.use(promExpress.instrumentExpress());// ... your code
```Expose metrics on different port, different express app.
```js
const express = require('express');
const promExpress = require('prometheus-express');
const mainApp = express();
mainApp.use(promExpress.instrumentExpress({exposeMetrics: false}));
mainApp.listen(3000, (e) => {
console.log('listening on a friendly 3000 port serving public traffic');
});const metricsApp = express();
metricsApp.use(promExpress.exposeMetrics());
metricsApp.listen(3001, (e) => {
console.log('exposing metrics for mainApp on port 3001, which isn\'t serving public traffic');
});
```