Skip to content

documentation for configuring the profiler storage #3344

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

Merged
merged 1 commit into from
Dec 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cookbook/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@

* :doc:`/cookbook/profiler/data_collector`
* :doc:`/cookbook/profiler/matchers`
* :doc:`/cookbook/profiler/storage`

* :doc:`/cookbook/request/index`

Expand Down
1 change: 1 addition & 0 deletions cookbook/profiler/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Profiler

data_collector
matchers
storage
69 changes: 69 additions & 0 deletions cookbook/profiler/storage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
.. index::
single: Profiling; Storage Configuration

Switching the Profiler Storage
==============================

By default the profile stores the collected data in a file in the cache directory.
You can control the storage being used through the ``dsn``, ``username``,
``password`` and ``lifetime`` options. For example, the following configuration
uses MySQL as the storage for the profiler with a lifetime of one hour:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
framework:
profiler:
dsn: "mysql:host=localhost;dbname=%database_name%"
username: "%database_user%"
password: "%database_password%"
lifetime: 3600

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
>
<framework:config>
<framework:profiler
dsn="mysql:host=localhost;dbname=%database_name%"
username="%database_user%"
password="%database_password%"
lifetime="3600"
/>
</framework:config>
</container>

.. code-block:: php

// app/config/config.php

// ...
$container->loadFromExtension('framework', array(
'profiler' => array(
'dsn' => 'mysql:host=localhost;dbname=%database_name%',
'username' => '%database_user',
'password' => '%database_password%',
'lifetime' => 3600,
),
));

The :doc:`HttpKernel component </components/http_kernel/introduction>` currently
supports the following profiler storage implementations:

* :class:`Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage`