Skip to content

Commit

Permalink
Merge pull request #1 from qubitdigital/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
tcolgate authored Aug 1, 2016
2 parents 4cb348f + b8f35d7 commit d0a0ddd
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 449 deletions.
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
# Epimetheus
[![CircleCI](https://img.shields.io/circleci/project/roylines/node-epimetheus.svg)]()
[![Coveralls](https://img.shields.io/coveralls/roylines/node-epimetheus.svg)]()
[![David](https://img.shields.io/david/roylines/node-epimetheus.svg)]()
# Epimetheus - fork
This is a customized fork of https://github.com/roylines/node-epimetheus

[![NPM](https://nodei.co/npm/epimetheus.png)](https://nodei.co/npm/epimetheus/)

Middleware to automatically instrument node applications for consumption by a [Prometheus](https://prometheus.io/) server.

Prometheus is an open source monitoring solution that obtains metrics from servers by querying against the /metrics endpoint upon them.

Once instrumented, Epimetheus automatically serves [response duration](#duration), [event loop lag](#lag) and [memory](#memory) metrics on the /metrics endpoint ready to be consumed by Prometheus.

Epimetheus will instrument websites and webservices that use [http](#http), [express](#express), [hapi](#hapi) and [restify](#restify).
Only express is supported.
Histogram has additional buckets
Summary has the 1.0 quntile added

# Instrumentation
Epimetheus automatically measures a number of metrics once instrumented. There are 3 categories of instrumentation measured: [response duration](#duration), [event loop lag](#lag) and [memory](#memory). See below for details on each.
Expand Down
14 changes: 1 addition & 13 deletions examples/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,10 @@ services:
prometheus:
image: prom/prometheus
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
express:
build: ./express
ports:
- "8000:8000"
restify:
build: ./restify
ports:
- "8001:8001"
hapi:
build: ./hapi
ports:
- "8002:8002"
http:
build: ./http
ports:
- "8003:8003"
10 changes: 0 additions & 10 deletions examples/hapi/Dockerfile

This file was deleted.

22 changes: 0 additions & 22 deletions examples/hapi/hapi.js

This file was deleted.

15 changes: 0 additions & 15 deletions examples/hapi/package.json

This file was deleted.

10 changes: 0 additions & 10 deletions examples/http/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions examples/http/http.js

This file was deleted.

14 changes: 0 additions & 14 deletions examples/http/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions examples/prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,3 @@ scrape_configs:
- job_name: 'express'
target_groups:
- targets: ['express:8000']
- job_name: 'restify'
target_groups:
- targets: ['restify:8001']
- job_name: 'hapi'
target_groups:
- targets: ['hapi:8002']
- job_name: 'http'
target_groups:
- targets: ['http:8003']
10 changes: 0 additions & 10 deletions examples/restify/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions examples/restify/package.json

This file was deleted.

18 changes: 0 additions & 18 deletions examples/restify/restify.js

This file was deleted.

13 changes: 2 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
const hapi = require('./lib/hapi');
const express = require('./lib/express');
const restify = require('./lib/restify');
const http = require('./lib/http');
const eventLoop = require('./lib/event-loop');
const memoryUsage = require('./lib/memory-usage');
const memoryUsage = require('./lib/statistics');

function instrument(app) {
eventLoop.instrument();
memoryUsage.instrument();

if (hapi.instrumentable(app)) {
hapi.instrument(app);
} else if (express.instrumentable(app)) {
if (express.instrumentable(app)) {
express.instrument(app);
} else if (restify.instrumentable(app)) {
restify.instrument(app);
} else if (http.instrumentable(app)) {
http.instrument(app);
}
}

Expand Down
8 changes: 3 additions & 5 deletions lib/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ function middleware(request, response, done) {
var start = process.hrtime();

response.on('finish', function() {
var path = request.path
var handler = "unmatched"
if (typeof request.route !== 'undefined'){
path = "handler:" + request.route.path
} else {
path = "handler:missing"
handler = request.route.path
}
metrics.observe(request.method, path, response.statusCode, start);
metrics.observe(request.method, handler, response.statusCode, start);
});

return done();
Expand Down
49 changes: 0 additions & 49 deletions lib/hapi.js

This file was deleted.

38 changes: 0 additions & 38 deletions lib/http.js

This file was deleted.

24 changes: 0 additions & 24 deletions lib/labels.js

This file was deleted.

Loading

0 comments on commit d0a0ddd

Please sign in to comment.