feat(portal-api): report metrics from hapi

This commit is contained in:
geek 2017-06-20 16:11:47 -05:00 committed by Sérgio Ramos
parent 5e7bec0aa7
commit 32b450c1b6
5 changed files with 58 additions and 25 deletions

View File

@ -96,6 +96,34 @@
name: 'usage',
help: 'Disk usage',
type: 'gauge'
},
{
namespace: 'api',
subsystem: 'request',
name: 'concurrent',
help: 'Number of concurrent requests',
type: 'gauge'
},
{
namespace: 'api',
subsystem: 'process',
name: 'up_time',
help: 'Process up time',
type: 'counter'
},
{
namespace: 'api',
subsystem: 'process',
name: 'mem_rss',
help: 'Process memory RSS usage',
type: 'gauge'
},
{
namespace: 'api',
subsystem: 'process',
name: 'heap_used',
help: 'Process heap usage',
type: 'gauge'
}
]
}

View File

@ -32,6 +32,7 @@
"hoek": "^4.1.1",
"joi": "^10.6.0",
"joyent-cp-gql-schema": "^1.0.4",
"portal-data": "^1.1.0"
"portal-data": "^1.1.0",
"toppsy": "^1.1.0"
}
}

View File

@ -2,9 +2,10 @@
const Brule = require('brule');
const Hapi = require('hapi');
const Inert = require('inert');
const Vision = require('vision');
const HapiSwagger = require('hapi-swagger');
const Inert = require('inert');
const Toppsy = require('toppsy');
const Vision = require('vision');
const Pack = require('./package');
const Portal = require('./lib');
@ -42,7 +43,12 @@ server.register([
{
register: HapiSwagger,
options: swaggerOptions
}],
},
{
register: Toppsy,
options: { namespace: 'portal', subsystem: 'api' }
}
],
(err) => {
handlerError(err);
server.start((err) => {

View File

@ -17,6 +17,6 @@
},
"devDependencies": {
"belly-button": "^3.1.0",
"lab": "^13.1.0"
"lab": "^14.0.1"
}
}

View File

@ -502,10 +502,6 @@ ast-types@0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.0.tgz#c8721c8747ae4d5b29b929e99c5317b4e8745623"
ast-types@0.9.6:
version "0.9.6"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.6.tgz#102c9e9e9005d3e7e3829bf0c4fa24ee862ee9b9"
async-each@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
@ -3502,7 +3498,7 @@ esprima@^2.6.0, esprima@~2.7.1:
version "2.7.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
esprima@^3.1.1, esprima@~3.1.0:
esprima@^3.1.1:
version "3.1.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633"
@ -3712,11 +3708,11 @@ extsprintf@1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.0.2.tgz#e1080e0658e300b06294990cc70e1502235fd550"
extsprintf@1.2.0:
extsprintf@1.2.0, extsprintf@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.2.0.tgz#5ad946c22f5b32ba7f8cd7426711c6e8a3fc2529"
extsprintf@1.3.0, extsprintf@^1.2.0:
extsprintf@1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"
@ -4255,8 +4251,8 @@ graphql-tag@^2.0.0, graphql-tag@^2.4.0:
resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.4.0.tgz#0fe137348d4db2efaf29b52ba4c1cbf84ac138cb"
graphql@^0.10.0, graphql@^0.10.1:
version "0.10.1"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.10.1.tgz#75c93c2ce73aeb5bae2eefb555a8e9e39c36027d"
version "0.10.3"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.10.3.tgz#c313afd5518e673351bee18fb63e2a0e487407ab"
dependencies:
iterall "^1.1.0"
@ -6529,7 +6525,7 @@ ono@^2.0.1, ono@^2.2.1:
version "2.2.5"
resolved "https://registry.yarnpkg.com/ono/-/ono-2.2.5.tgz#daf09488b51174da7a7e4275dfab31b438ffa0e3"
oppsy@1.x.x:
oppsy@1.x.x, oppsy@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/oppsy/-/oppsy-1.0.2.tgz#98014cd6967653a83cfffa554226dc90050baad4"
dependencies:
@ -7126,6 +7122,10 @@ punycode@^1.2.4, punycode@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
putmetric@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/putmetric/-/putmetric-1.0.1.tgz#5b0362732545b4e05c91ef5e087fae075d638a12"
q@^1.1.2, q@^1.4.1:
version "1.5.0"
resolved "https://registry.yarnpkg.com/q/-/q-1.5.0.tgz#dd01bac9d06d30e6f219aecb8253ee9ebdc308f1"
@ -7516,7 +7516,7 @@ readline2@^1.0.1:
is-fullwidth-code-point "^1.0.0"
mute-stream "0.0.5"
recast@0.11.12:
recast@0.11.12, recast@^0.11.5:
version "0.11.12"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.12.tgz#a79e4d3f82d5d72a82ee177aeaa791e793bbe5d6"
dependencies:
@ -7525,15 +7525,6 @@ recast@0.11.12:
private "~0.1.5"
source-map "~0.5.0"
recast@^0.11.5:
version "0.11.23"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3"
dependencies:
ast-types "0.9.6"
esprima "~3.1.0"
private "~0.1.5"
source-map "~0.5.0"
rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
@ -9074,6 +9065,13 @@ topo@2.x.x:
dependencies:
hoek "4.x.x"
toppsy@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/toppsy/-/toppsy-1.1.0.tgz#dd1ef4a15aaa7ef077bc41e9851aa75851610b41"
dependencies:
oppsy "^1.0.2"
putmetric "^1.0.1"
touch@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/touch/-/touch-1.0.0.tgz#449cbe2dbae5a8c8038e30d71fa0ff464947c4de"