Skip to content

Metrics support and cache status header

Latest
Compare
Choose a tag to compare
@rjyo rjyo released this 22 Dec 01:59
· 10 commits to master since this release

In 0.15.x, two new features are added

  • Prometheus metrics
  • Cache status in HTTP header

Prometheus metrics

You can enable metrics in the config

// in .next-boost.js
{
 ...
  metrics: true,
}

And by requesting __nextboost_metrics, you'll get Prometheus style metrics

$ curl http://localhost:3000/__nextboost_metrics
next_boost_requests_total{status='stale'} 1
next_boost_requests_total{status='bypass'} 32
next_boost_requests_total{status='hit'} 2

Cache status in HTTP header

Also, a x-next-boost-status header is now returned in all requests

$ curl -I  http://localhost:3000/
HTTP/1.1 200 OK
x-next-boost-status: hit
x-powered-by: Next.js
etag: "f5274-diDR3qXA2Yvq7BYsnHn3HjQ3Qq8"
content-type: text/html; charset=utf-8
content-length: 262875
cache-control: private, no-cache, no-store, max-age=0, must-revalidate
date: Wed, 22 Dec 2021 01:57:00 GMT
connection: close
content-encoding: gzip