Skip to content

Commit

Permalink
Merge pull request #174 from firstandthird/prom-defaults
Browse files Browse the repository at this point in the history
working
  • Loading branch information
orthagonal authored Oct 16, 2018
2 parents 845c50c + 11430bb commit 12a3151
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/default-envs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ envVars:
routePrefix: "{{ getEnv('ROUTE_PREFIX', getEnv('PATH_PREFIX', '')) }}"
healthToken: "{{ getEnv('HEALTH_TOKEN', false) }}"
enableProm: '{{ truthy(ENV.ENABLE_PROM)}}'
promDefaults: '{{ truthy(ENV.PROM_DEFAULTS)}}'
promPath: "{{ getEnv('PROM_PATH', '/metrics') }}"
forceHttps: '{{ truthy(getEnv("FORCE_HTTPS", false)) }}'
logRequests: '{{ truthy(ENV.ACCESS_LOGS) }}'
Expand Down
1 change: 1 addition & 0 deletions conf/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ plugins:
hapi-prom:
_enabled: "{{ envVars.enableProm }}"
metricsPath: "{{ envVars.promPath }}"
defaultMetrics: "{{ envVars.promDefaults}}"
hapi-logr:
unhandledRejection: true
uncaughtException: true
Expand Down
2 changes: 2 additions & 0 deletions test/initialize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ tap.test('server stops when SIGTERM event is emitted ', async t => {

tap.test('be able to conditionally load hapi-prom', async t => {
process.env.ENABLE_PROM = true;
process.env.PROM_DEFAULTS = true;
const rapptor = new Rapptor({
cwd: __dirname,
});
Expand All @@ -94,6 +95,7 @@ tap.test('be able to conditionally load hapi-prom', async t => {
url: '/metrics'
});
t.equal(response.statusCode, 200, 'registers hapi-prom route');
t.match(response.result, 'nodejs_heap_space_size_total_bytes', 'ENV.PROM_DEFAULTS registers default metrics');
await rapptor.stop();
t.end();
});
Expand Down

0 comments on commit 12a3151

Please sign in to comment.