New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "X-cache: PASS" support in cacheHits module #166
Conversation
|
||
var re = /miss|hit/i; | ||
var re = /miss|hit|pass/i; | ||
|
||
// examples: | ||
// X-Cache:HIT, HIT | ||
// X-Cache:arsenic miss (0) | ||
phantomas.on('recv', function(entry,res) { | ||
var header = entry.headers['X-Cache'] || '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As toLowerCase()
is now called twice on header
I'd move the call here.
Makes perfect sense to me :) Please run JS Lint against your changes by |
@@ -155,6 +155,7 @@ phantomas metrics for <https://github.com/macbre/phantomas>: | |||
* otherSize: 0 | |||
* cacheHits: 9 | |||
* cacheMisses: 0 | |||
* cachePasses: 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update information about number of metrics above (it got ++)
isPass = header.toLowerCase().indexOf('pass') > -1; | ||
if (isPass) { | ||
phantomas.incrMetric('cachePasses'); | ||
phantomas.log('Cache pass: on <' + entry.url + '> (X-Cache: ' + header + ')'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to use offenders (see #140) for reporting requests being passed to the backend. Simply call phantomas.addOffender('cachePasses', entry.url);
Way better :) Thanks, @kennydee! |
Add "X-cache: PASS" support in cacheHits module
Hi,
I don't know if this PR could have some interest for you, but in case ...
This PR add X-cache PASS metrics.
In our Varnish, we have HIT, MISS and PASS.
PASS tell us there is a rule which exclude cache on this request, and tell us which rules.
And PASS request, is a thing that we have to look, because it means that every hit go to the backend !
;) Thanks