Skip to content

Commit

Permalink
Restrict metrics call to HTTP protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebouthinon committed Jul 8, 2019
1 parent 4c9ee4a commit 90f81ab
Show file tree
Hide file tree
Showing 4 changed files with 346 additions and 312 deletions.
10 changes: 6 additions & 4 deletions lib/PrometheusPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ class PrometheusPlugin {
* @param {Request} request
*/
async metrics(request) {
const register = await this.syncRegisters();
request.response.setHeader('Content-Type', register.contentType);
request.response.raw = true;
return register.metrics();
if (request.context.connection.protocol === 'http') {
const register = await this.syncRegisters();
request.response.setHeader('Content-Type', register.contentType);
request.response.raw = true;
return register.metrics();
}
}

/**
Expand Down
Loading

0 comments on commit 90f81ab

Please sign in to comment.