Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

X-Cache headers in list.html.twig #242

Open
fnash opened this issue Jan 23, 2019 · 1 comment
Open

X-Cache headers in list.html.twig #242

fnash opened this issue Jan 23, 2019 · 1 comment

Comments

@fnash
Copy link

fnash commented Jan 23, 2019

It would be interesting displaying Varnish headers (or custom headers) in the profiler with bootstrap badges. I make many GET requests in my app and it would be nice to easily know which requests made hit/miss from Varnish, with Age and Total-Hits.

Any guidelines to make a PR?

Make a new default middleware available

class VarnishCacheMiddleware extends CacheMiddleware
{
    const DEBUG_HEADER = 'X-Cache';
}

with

# GuzzleCollector

                if ($response->hasHeader('X-Cache') && 'HIT' === $response->getHeaderLine('X-Cache')) {
                    if ($response->hasHeader('Age')) {
                        $req['varnish']['age'] = $response->getHeaderLine('Age');
                    }

                    if ($response->hasHeader('X-Cache-Hits')) {
                        $req['varnish']['hits'] = $response->getHeaderLine('X-Cache-Hits');
                    }
                }
@csarrazi
Copy link
Owner

Hi @fnash. I guess the better approach might be to provide extension capabilities to the collector, in order to provide means to extend the current one. We could consider registering services associated to a tag, which would extract some additional information from the request, and let one extend the bundle that way.

What could be great would be to have the possibility to add new sections in the profiler page for each "extension".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants