Question

By default, the Symfony2 profiler only saves a few* of the last requests (Don't know how many excactly - something between 25 and 40). I think the list removes the older ones after a cupple of minutes..

I'd like to do a long-time profiling and measuring of some data. Is it possible to configure the max profiling amount? Or maybe store all the data in my (MongoDB) Database? (I'm currently using Symfony 2.2)

Update: I found out, that clearing the cache, also clears the profiler data - so I guess the key issue here is, to save the profiler data somewhere else..

Was it helpful?

Solution

Check this out.

You can override the default profiler.storage service, which is defined here.

You could either define your own class (implementing the ProfilerStorageInterface) or use one of the provided implementations (check here for the whole list).

For example if you want to use the MongoDbProfilerStorage you can redefine the service as follows:

<service id="profiler.storage" class="Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage" public="false">
    <argument>mongodb://[USER:PWD@]HOST/DATABASE/COLLECTION</argument>
    <argument></argument>
    <argument></argument>
    <argument>86400</argument>
</service>

This way you wouldn't delete profiler data whenever you clear the cache.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top