A metric is a collection of costs (memory, network, CPU, ...) associated with some function calls. Blackfire offers some built-in metrics, but you can also create your own custom metrics.
You can define the performance expectations of your projects by setting an
expected metric value, on a given metric dimension, in assertions. To write an assertion on a specific dimension, append the
dimension name to the metric name, separated with a ..
For instance, for the sql.queries metric, the number of calls is stored in
the metrics.sql.queries.count and the memory usage in
metrics.sql.queries.peak_memory. To check that you don't have more than 10
SQL queries in an assertion, you would write metrics.sql.queries.count <= 10.
The available dimensions for metrics are the following ones.
countwall_timecpu_timememorypeak_memorynetwork_innetwork_outioHere is the list of built-in metrics that are always available in assertions:
metrics.amqp
- AMQP
metrics.amqp.config
- AMQP Configuration
metrics.amqp.connections
- AMQP Connections
metrics.amqp.messages
- AMQP Messages
metrics.amqp.phpamqp.config
- AMQP Configuration (pdezwart/php-amqp)
metrics.amqp.phpamqp.connections
- AMQP Connections (pdezwart/php-amqp)
metrics.amqp.phpamqp.messages
- AMQP Messages (pdezwart/php-amqp)
metrics.amqp.phpamqplib.config
- AMQP Configuration (videlalvaro/php-amqplib)
metrics.amqp.phpamqplib.connections
- AMQP Connections (videlalvaro/php-amqplib)
metrics.amqp.phpamqplib.messages
- AMQP Messages (videlalvaro/php-amqplib)
metrics.api_platform.installed
- API Platform installed?
metrics.api_platform2.installed
- API Platform 2 installed?
metrics.assetic.controller.calls
- Assetic Asset Renderer
metrics.aura.installed
- Aura PHP installed
metrics.blackfire.add_marker
- Blackfire Markers
metrics.blackfire.sdk.probe
- Blackfire SDK Instrumentation
metrics.bolt.application.construct
- Bolt CMS Application Construct
metrics.bolt.application.initialize
- Bolt CMS Application Initialize
metrics.bolt.providers
- Bolt CMS Service Providers Registration
metrics.cache
- Cache
metrics.cache.delete
- Cache Delete
metrics.cache.flush
- Cache Flush
metrics.cache.get
- Cache Get
metrics.cache.has
- Cache Has
metrics.cache.set
- Cache Set
metrics.code_igniter.installed
- Code Igniter installed?
metrics.commonmark.parse.parsedown
- Markdown Parser (thephpleague/commonmark)
metrics.compile
- Compiled Scripts
metrics.composer.autoload.find_file
- Composer ClassLoader File Finder
metrics.crypto
- Cryptographic functions and classes
metrics.crypto.defuse
- Defuse crypto library
metrics.crypto.defuse.decrypt
- Defuse crypto library decryption
metrics.crypto.defuse.encrypt
- Defuse crypto library encryption
metrics.crypto.mcrypt
- Mcrypt Functions
metrics.cs_cart.installed
- CS-Cart installed?
metrics.doctrine.annotations.parsed
- Doctrine Annotation Parser
metrics.doctrine.annotations.read
- Doctrine Annotation Reader
metrics.doctrine.cache.delete
- Doctrine Cache Delete
metrics.doctrine.cache.flush
- Doctrine Cache Clear
metrics.doctrine.cache.get
- Doctrine Cache Get
metrics.doctrine.cache.has
- Doctrine Cache Has
metrics.doctrine.cache.set
- Doctrine Cache Set
metrics.doctrine.dql.parsed
- Doctrine DQL Parser
metrics.doctrine.entities.created
- Doctrine Entities Creation
metrics.doctrine.entities.hydrated
- Doctrine Entities Hydration
metrics.doctrine.entities.metadata
- Doctrine Metadata Loader
metrics.doctrine.event_manager.dispatch
- Doctrine Event Dispatcher
metrics.doctrine.orm.flush
- Doctrine EntityManager Flushes
metrics.doctrine.paginator.dql.parsed
- Doctrine Paginator using the Doctrine DQL Parser
metrics.doctrine.proxies.generated
- Doctrine Proxy Generator
metrics.doctrine.proxies.loaded
- Doctrine Proxy Lazy-Loader
metrics.drupal7.block.access
- Drupal Block Viewer
metrics.drupal7.block_cache.construct
- Drupal Block Cache
metrics.drupal7.cache.fake
- Drupal Fake Cache
metrics.drupal7.cron.automated
- Drupal Cron Run via Web
metrics.drupal7.cron.drush
- Drupal Cron Run via Drush
metrics.drupal7.cron.run
- Drupal Cron Run
metrics.drupal7.dblog
- Drupal Database Logger
metrics.drupal7.drush
- Drupal Drush
metrics.drupal7.entity_load.any
- Drupal Entity Loader
metrics.drupal7.fast_404
- Drupal Fast 404
metrics.drupal7.fast_cache
- Drupal APC Cache
metrics.drupal7.installed
- Is Drupal 7 installed?
metrics.drupal7.module.contrib.loaded
- Drupal Contrib Module Loader
metrics.drupal7.module.panels.installed
- Panels Module Installed
metrics.drupal7.page_cache_anonymous.construct
- Drupal Page Cache anonymous
metrics.drupal7.page_cache_authenticated.construct
- Drupal Page Cache authenticated
metrics.drupal7.panels.cached
- Cached Panels
metrics.drupal7.panels.render
- Panels Renderer
metrics.drupal7.php.load
- Drupal PHP File Loader
metrics.drupal7.preprocess.css
- Drupal CSS Aggregator
metrics.drupal7.preprocess.js
- Drupal JS Aggregator
metrics.drupal7.session.anonymous
- Drupal Anonymous Session
metrics.drupal7.theme.debug
- Drupal Theme Debugger
metrics.drupal7.views.uncached
- Drupal Uncached Views
metrics.drupal8.block.access
- Drupal Block Access Checker
metrics.drupal8.cache.null
- Drupal Null Cache
metrics.drupal8.cache.views
- Drupal Uncached Views
metrics.drupal8.cron.drush
- Drupal Cron Run via Drush
metrics.drupal8.cron.requested
- Drupal Cron Run via Web
metrics.drupal8.cron.run
- Drupal Cron Run
metrics.drupal8.dblog
- Drupal Database Logger
metrics.drupal8.drush
- Drupal Drush
metrics.drupal8.dynamic_page_cache.construct
- Dynamic drupal Page Cache
metrics.drupal8.entity_load.content
- Drupal Content Entities Loader
metrics.drupal8.fast_cache
- Drupal APCu Cache
metrics.drupal8.help_module.construct
- Help module
metrics.drupal8.installed
- Is Drupal 8 installed?
metrics.drupal8.module.loaded.contrib
- Drupal Contrib Module Loader
metrics.drupal8.page_cache.construct
- Drupal Page Cache
metrics.drupal8.php.load
- Drupal PHP File Loader
metrics.drupal8.preprocess.css
- Drupal CSS Asset Resolver
metrics.drupal8.preprocess.js
- Drupal JavaScript Asset Resolver
metrics.drupal8.twig.debug
- Drupal Twig Debugger
metrics.drupal8.twig_cache.construct
- Twig Cache
metrics.drupal8.update_module.construct
- Update manager module
metrics.elasticsearch
- Elasticsearch
metrics.elasticsearch.elastica.logs
- Elastica Logs
metrics.elasticsearch.elastica.queries
- Elastica Queries
metrics.elasticsearch.elasticsearch.queries
- Elasticsearch Queries
metrics.elasticsearch.queries
- Elasticsearch Queries
metrics.emails
- Mailer
metrics.emails.sent
- Mails Sent
metrics.emails.sent.mandrill
- Mandrill Emails Sent
metrics.emails.sent.php
- PHP Emails Sent
metrics.emails.sent.php_mailer
- PHPMailer Emails Sent
metrics.emails.sent.swiftmailer
- Swiftmailer Emails Sent
metrics.ezplatform.controller.view_controller
- eZ Platform [MVC] View Controller
metrics.ezplatform.controller.view_controller_deprecated_calls
- eZ Platform [MVC] View Controller
metrics.ezplatform.core.persistence.content_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache ContentHandler - read-only uncached calls
metrics.ezplatform.core.persistence.content_language_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache ContentLanguageHandler - read-only uncached calls
metrics.ezplatform.core.persistence.content_type_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache ContentTypeHandler - read-only uncached calls
metrics.ezplatform.core.persistence.handlers
- eZ Platform [SPI] Persistence Cache Handlers
metrics.ezplatform.core.persistence.legacy.handlers
- eZ Platform [SPI] Persistence Legacy (Database) Handlers
metrics.ezplatform.core.persistence.location_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache LocationHandler - read-only uncached calls
metrics.ezplatform.core.persistence.object_state_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache ObjectStateHandler - read-only uncached calls
metrics.ezplatform.core.persistence.section_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache SectionHandler - read-only uncached calls
metrics.ezplatform.core.persistence.trash_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache TrashHandler - read-only uncached calls
metrics.ezplatform.core.persistence.url_alias_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache UrlAliasHandler - read-only uncached calls
metrics.ezplatform.core.persistence.url_wildcard.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache UrlWildcard - read-only uncached calls
metrics.ezplatform.core.persistence.user_handler.read_only_uncached_calls
- eZ Platform [SPI] Persistence Cache UserHandler - read-only uncached calls
metrics.ezplatform.core.repository.services
- eZ Platform [API] Repository Service method calls
metrics.ezplatform.installed
- eZ Platform installed?
metrics.ezplatform.signal_slot_dispatcher.emit
- eZ Platform [API] Repository Signal Slot Dispatcher
metrics.ezplatform.template.fields
- eZ Platform [MVC] Content Field Render
metrics.fos_elastica_bundle
- FOS Elastica bundle installed?
metrics.fos_http_cache_bundle
- FOS HttpCache Bundle installed?
metrics.fos_message_bundle
- FOS Message bundle installed?
metrics.fos_rest_bundle
- FOS Rest Bundle installed?
metrics.fos_user_bundle
- FOS User bundle installed?
metrics.graph_ql
- GraphQL is used
metrics.http.curl.requests
- cURL HTTP Requests
metrics.http.php_stream.requests
- PHP Stream HTTP Requests
metrics.http.requests
- HTTP Requests
metrics.http.soap.requests
- SOAP HTTP Requests
metrics.http.socket.requests
- Socket HTTP Requests
metrics.hwi_oauth_bundle
- HWI OAuth Bundle installed?
metrics.jms.serializer.deserialize
- JMS Serializer deserialize
metrics.jms.serializer.serialize
- JMS Serializer serialize
metrics.kohana.installed
- Kohanna framework installed?
metrics.laravel
- Laravel framework
metrics.laravel.database.hydration
- Laravel Database hydration
metrics.laravel.debug_bar.enable
- Laravel enable debug bar
metrics.laravel.debug_bar.middleware
- Laravel debug bar middleware
metrics.laravel.event_dispatcher
- Laravel Event Dispatcher
metrics.laravel.installed
- Laravel installed?
metrics.laravel.kernel.bootstrap
- Laravel kernel bootstrap
metrics.laravel.middleware.add_queued_cookies_to_response
- Laravel add queued cookies to response middleware
metrics.laravel.middleware.authenticate
- Laravel authenticate middleware
metrics.laravel.middleware.authenticate_basic
- Laravel authenticate basic middleware
metrics.laravel.middleware.authorize
- Laravel authorize middleware
metrics.laravel.middleware.check_for_maintenance
- Laravel check for maintenance middleware
metrics.laravel.middleware.csrf
- Laravel CSRF middleware
metrics.laravel.middleware.encrypt_cookie
- Laravel encrypt cookie middleware
metrics.laravel.middleware.session
- Laravel session middleware
metrics.laravel.middleware.share_errors
- Laravel share errors from session middleware
metrics.laravel.middleware.substiture_bindings
- Laravel binding substitution middleware
metrics.laravel.middleware.throttle_requests
- Laravel throttle requests middleware
metrics.laravel.router.dispatch
- Laravel router dispatch
metrics.laravel.router.prepare_response
- Laravel router prepare response
metrics.laravel.router.route_run
- Laravel route run
metrics.laravel.view.render
- Laravel view render
metrics.laravel.workbench_starter
- Laravel Workbench starter
metrics.logs.browser
- Logs sent to the browser
metrics.logs.log_call
- Log Calls
metrics.magento1.all.installed
- Is Magento 1 installed?
metrics.magento1.ee.installed
- Is Magento 1 EE installed?
metrics.magento2.all.installed
- Is Magento 2 installed?
metrics.magento2.ee.installed
- Is Magento 2 EE installed?
metrics.main
- Main node
metrics.markdown
- Markdown
metrics.markdown.parse
- Markdown Parser
metrics.markdown.parse.parsedown
- Markdown Parser (erusev/parsedown)
metrics.memcache
- Memcache
metrics.memcache.connection
- Memcache Connections
metrics.memcache.queries
- Memcache Queries
metrics.memcached
- Memcached
metrics.memcached.queries
- Memcached Queries
metrics.michelf.parse.parsedown
- Markdown Parser (michelf/php-markdown)
metrics.mongodb
- MongoDB
metrics.mongodb.config
- MongoDB Configuration Operations
metrics.mongodb.connections
- MongoDB Connections
metrics.mongodb.queries
- MongoDB Queries
metrics.monolog.browser_console
- Monolog calls to BrowserConsole
metrics.monolog.calls
- Monolog calls for warning, notice, info, or debug
metrics.monolog.chromephp
- Monolog calls to ChromePHP
metrics.monolog.firephp
- Monolog calls to FirePHP
metrics.monolog.php_console
- Monolog calls to PHPConsole
metrics.nette.installed
- Nette framework installed?
metrics.output
- HTTP Response
metrics.oxid.rendered.article.widgets
- Oxid Article Widgets Rendered
metrics.oxid.rendered.categorytree
- Oxid CategoryTree Rendered
metrics.oxid.seo.link.generate
- Oxid Generate SEO Link
metrics.oxid.seo.link.uncached
- Oxid Uncached SEO Link
metrics.pear.firephp
- PEAR log calls to FirePHP
metrics.pear.log.log_call
- PEAR log calls for warning, notice, info, or debug
metrics.php
- PHP Functions
metrics.php.autoloaded
- Autoloaded Classes
metrics.php.eval
- eval calls
metrics.php.gc
- Garbage Collector
metrics.php.shell_exec
- Spawn shell commands
metrics.php.uniqid
- uniqid calls
metrics.php.uniqid_with_entropy
- uniqid with entropy calls
metrics.php_markdown.parse.parsedown
- Markdown Parser (dflydev/markdown)
metrics.phpfastcache.cache.delete
- phpFastCache Delete
metrics.phpfastcache.cache.flush
- phpFastCache Clear
metrics.phpfastcache.cache.get
- phpFastCache Get
metrics.phpfastcache.cache.has
- phpFastCache Has
metrics.phpfastcache.cache.set
- phpFastCache Set
metrics.phpqa.deprecated
- Calls to deprecated functions
metrics.phpqa.die
- Calls to die or exit
metrics.phpqa.dump
- Calls to var_dump(), print_r(), var_export() on STDOUT
metrics.phpqa.e_user_deprecated
- Calls to deprecated libraries functions
metrics.phpqa.eval
- Calls to eval
metrics.phpqa.ini_settings
- Calls to ini_set(), ini_alter(), or ini_restore()
metrics.phpqa.set_time_limit
- Calls to set_time_limit
metrics.phpqa.sleep
- Calls to sleep or usleep
metrics.propel2
- Propel2 is used
metrics.psr3.calls
- PSR3 Logger logs
metrics.redis
- Redis
metrics.redis.config
- Redis Configuration Operations
metrics.redis.connections
- Redis Connections
metrics.redis.phpredis.config
- PHPRedis Configuration Calls
metrics.redis.phpredis.connections
- PHPRedis Connections
metrics.redis.phpredis.queries
- PHPRedis Queries
metrics.redis.predis.connections
- Predis Connections
metrics.redis.predis.queries
- Predis Queries
metrics.redis.queries
- Redis Queries
metrics.riak
- Riak
metrics.riak.basho.queries
- Riak Queries with basho/riak
metrics.riak.php_riak.queries
- Riak Queries with php_riak
metrics.riak.queries
- Riak Queries
metrics.run
- Run Scripts
metrics.serializer
- Serializers
metrics.serializer.deserialize
- Deserialize
metrics.serializer.serialize
- Serialize
metrics.shopware.events
- Shopware Events
metrics.shopware.filtered_events
- Shopware Filtered Events
metrics.shopware.get_resources
- Shopware Resources
metrics.shopware.link_generations
- Shopware Link Generations
metrics.shopware.rendering
- Shopware Templates Rendering
metrics.shopware.routing
- Shopware Routing
metrics.silex.application.boot
- Silex Application Boot
metrics.silex.application.flush
- Silex Application Flush Controllers collection
metrics.silex.application.mount
- Silex Application Mount Controllers
metrics.silex.application.terminate
- Silex Application Terminate
metrics.silex.installed
- Silex installed
metrics.silex.providers
- Silex Providers
metrics.slim.installed
- Slim installed
metrics.smarty
- Smarty
metrics.smarty.compile
- Smarty Templates Compilations
metrics.smarty.is_cached
- Smarty Templates cache verification
metrics.smarty.read_file
- Smarty Templates read cached file
metrics.smarty.template_base
- Smarty Templates render template
metrics.solarium.queries
- Solarium Queries
metrics.sql
- SQL
metrics.sql.connections
- SQL Connections
metrics.sql.db2.connections
- DB2 Connections
metrics.sql.db2.queries
- DB2 queries
metrics.sql.msql.connections
- mSQL Connections
metrics.sql.msql.queries
- mSQL Queries
metrics.sql.mssql.connections
- MSSQL Connections
metrics.sql.mssql.queries
- MSSQL Queries
metrics.sql.mysql.connections
- MySQL Connections
metrics.sql.mysql.queries
- MySQL Queries
metrics.sql.mysqli.connections
- MySQLi Connections
metrics.sql.mysqli.queries
- MySQLi Queries
metrics.sql.oci.connections
- OCI8 Connections
metrics.sql.oci.queries
- OCI8 Queries
metrics.sql.odbc.connections
- ODBC Connections
metrics.sql.odbc.queries
- ODBC Queries
metrics.sql.pdo.connections
- PDO Connections
metrics.sql.pdo.queries
- PDO Queries
metrics.sql.postgres.connections
- PostgreSQL Connections
metrics.sql.postgres.queries
- PostgreSQL Queries
metrics.sql.queries
- SQL Queries
metrics.sql.sqlite.connections
- SQLite Connections
metrics.sql.sqlite.queries
- SQLite Queries
metrics.sql.sqlsrv.connections
- SQL Server Connections
metrics.sql.sqlsrv.queries
- SQL Server Queries
metrics.sql.sybase.connections
- Sybase Connections
metrics.sql.sybase.queries
- Sybase Queries
metrics.stash.driver.black_hole
- Stash Driver BlackHole
metrics.stash.driver.file_system
- Stash Driver FileSystem
metrics.stash.installed
- Stash installed?
metrics.symfony.authentication_provider_manager
- Symfony Authentication Provider Manager
metrics.symfony.config_check
- Symfony Config Cache Freshness Checks
metrics.symfony.console
- Symfony Console
metrics.symfony.console.application_run
- Symfony Console Application run
metrics.symfony.controllers
- Symfony Controllers
metrics.symfony.controllers.action
- Symfony Controller Action
metrics.symfony.controllers.argument_resolver
- Symfony Argument Resolving
metrics.symfony.controllers.controller_resolver
- Symfony Controller Resolving
metrics.symfony.debug
- Symfony Debug
metrics.symfony.dotenv
- Symfony Dotenv
metrics.symfony.dotenv.parse
- Symfony Dotenv Parsing
metrics.symfony.events
- Symfony Dispatched Events
metrics.symfony.firewall
- Symfony Firewall
metrics.symfony.http_cache
- Symfony HTTP Cache
metrics.symfony.http_cache_esi
- Symfony HTTP Cache ESI
metrics.symfony.kernel
- Symfony Kernel
metrics.symfony.kernel.boot
- Symfony Kernel Boot
metrics.symfony.kernel.debug
- Symfony Kernel Debug
metrics.symfony.kernel.handle
- Symfony Kernel Handle
metrics.symfony.kernel.initialize_bundles
- Symfony Kernel bundles initialization
metrics.symfony.kernel.initialize_container
- Symfony Kernel container initialization
metrics.symfony.kernel.load_class_cache
- Symfony load classes cache
metrics.symfony.kernel.shutdown
- Symfony Kernel shutdown
metrics.symfony.kernel.terminate
- Symfony Kernel terminate
metrics.symfony.logger.console
- Symfony Console Logger
metrics.symfony.logger.monolog_bridge
- Symfony Monolog Bridge
metrics.symfony.param_converter
- Symfony Param Converter
metrics.symfony.polyfill
- Symfony Polyfills
metrics.symfony.polyfill.apcu
- Symfony apcu Polyfill
metrics.symfony.polyfill.iconv
- Symfony iconv Polyfill
metrics.symfony.polyfill.intl
- Symfony Intl Polyfill
metrics.symfony.polyfill.mbstring
- Symfony Mbstring Polyfill
metrics.symfony.polyfill.php54
- Symfony PHP 5.4 Polyfill
metrics.symfony.polyfill.php55
- Symfony PHP 5.5 Polyfill
metrics.symfony.polyfill.php56
- Symfony PHP 5.6 Polyfill
metrics.symfony.polyfill.php70
- Symfony PHP 7.0 Polyfill
metrics.symfony.polyfill.php71
- Symfony PHP 7.1 Polyfill
metrics.symfony.polyfill.php72
- Symfony PHP 7.2 Polyfill
metrics.symfony.polyfill.php73
- Symfony PHP 7.3 Polyfill
metrics.symfony.polyfill.xml
- Symfony XML Polyfill
metrics.symfony.process.cmds
- Process Commands
metrics.symfony.processes
- Process Calls
metrics.symfony.routing.loader
- Symfony Routing loader
metrics.symfony.routing.route_collection
- Symfony Routing route collection
metrics.symfony.routing.router
- Symfony Routing router
metrics.symfony.security.access_decision_manager
- Symfony Access Decision Manager
metrics.symfony.security.authorization_checker
- Symfony Authorization Checker
metrics.symfony.serializer.decode
- Symfony Serializer decode
metrics.symfony.serializer.denormalize
- Symfony Serializer denormalize
metrics.symfony.serializer.deserialize
- Symfony Serializer deserialize
metrics.symfony.serializer.encode
- Symfony Serializer encode
metrics.symfony.serializer.normalize
- Symfony Serializer normalize
metrics.symfony.serializer.serialize
- Symfony Serializer serialize
metrics.symfony.session_listener
- Symfony Session listener
metrics.symfony.subrequests
- Symfony Subrequests
metrics.symfony.yaml.reads
- YAML Reads
metrics.symfony_framework
- Symfony Full Stack Framework
metrics.threshold
- Significant calls
metrics.twig.attributes.ext.get
- Twig Attributes Calls with the C Extension
metrics.twig.attributes.get
- Twig Attributes Calls
metrics.twig.attributes.php.get
- Twig Attributes Calls from PHP
metrics.twig.compile
- Twig Template Compilations
metrics.twig.display
- Twig Template Displays
metrics.twig.render
- Twig Template Explicit Renders
metrics.typo3.application_run
- TYPO3 Application Runner
metrics.typo3.cache.flush
- TYPO3 Cache flush
metrics.typo3.cache.get
- TYPO3 Cache get
metrics.typo3.cache.has
- TYPO3 Cache has
metrics.typo3.cache.remove
- TYPO3 Cache remove
metrics.typo3.cache.set
- TYPO3 Cache set
metrics.typo3.cache.set_cache
- TYPO3 Cache cache initialization
metrics.typo3.content_object_renderer
- TYPO3 Content Object Renderer
metrics.typo3.controller
- TYPO3 controller
metrics.typo3.deprecation_log
- TYPO3 deprecationLog calls
metrics.typo3.dev_log
- TYPO3 devLog calls
metrics.typo3.dispatcher
- TYPO3 MVC dispatcher
metrics.typo3.fe_condition_matcher_match
- TYPO3 Condition Matcher
metrics.typo3.installed
- Is TYPO3 installed?
metrics.typo3.int_object
- TYPO3 *_INT rendered
metrics.typo3.load.configuration
- TYPO3 configuration load
metrics.typo3.load.ext_loaded
- TYPO3 extension loaded
metrics.typo3.load.extension_tables
- TYPO3 extension tables load
metrics.typo3.load.table_configuration_array_load
- TYPO3 table configuration array load
metrics.typo3.logger
- TYPO3 Logger
metrics.typo3.mvc_dispatcher
- TYPO3 MVC dispatcher
metrics.typo3.set_no_cache
- Disabling of complete frontend cache
metrics.typo3.sql.count
- TYPO3 Database Connection count
metrics.typo3.sql.delete
- TYPO3 Database Connection delete
metrics.typo3.sql.insert
- TYPO3 Database Connection insert
metrics.typo3.sql.select
- TYPO3 Database Connection select
metrics.typo3.sql.truncate
- TYPO3 Database Connection truncate
metrics.typo3.sql.update
- TYPO3 Database Connection query
metrics.typo3.user_object
- TYPO3 extensions / plugins rendered
metrics.woocommerce.installed
- Woocommerce installed?
metrics.wordpress
- WordPress
metrics.wordpress.apply_filters
- WordPress apply_filters
metrics.wordpress.do_action
- WordPress do_action
metrics.wordpress.get_footer
- WordPress get_footer
metrics.wordpress.get_header
- WordPress get_header
metrics.wordpress.get_sidebar
- WordPress get_sidebar
metrics.wordpress.get_the_excerpt
- WordPress get_the_excerpt
metrics.wordpress.i18n.import_i18n
- WordPress import i18n
metrics.wordpress.load_all_options
- WordPress load_all_options
metrics.wordpress.load_template
- WordPress load_template
metrics.wordpress.rewrite_flush_rules
- WordPress Rewrite flush rules
metrics.wordpress.wp_cache_delete
- WordPress wp_cache_delete
metrics.wordpress.wp_cache_flush
- WordPress wp_cache_flush
metrics.wordpress.wp_cache_get
- WordPress wp_cache_get
metrics.wordpress.wp_cache_set
- WordPress wp_cache_set
metrics.wordpress.wp_head
- WordPress wp_head
metrics.wordpress.wp_nav_menu
- WordPress wp_nav_menu
metrics.wordpress.wp_print_footer_scripts
- WordPress wp_print_footer_scripts
metrics.wordpress.wp_print_head_scripts
- WordPress wp_print_head_scripts
metrics.wordpress.wp_print_styles
- WordPress wp_print_styles
metrics.xdebug
- XDebug functions
metrics.yii.installed
- Yii framework installed?
metrics.zend.config_items
- Zend Config Reads
metrics.zend.front_controller
- Zend Front Controller
metrics.zend.log.chromephp
- Zend Log calls to ChromePHP
metrics.zend.log.firephp
- Zend Log calls to FirePHP
metrics.zend.log.log_call
- Zend Log Calls for development levels
metrics.zend.reflection
- Zend Reflection Uses
metrics.zend.resources
- Zend Resources Boot
metrics.zend.routes
- Zend Route Matches
metrics.zend.search.lucene.find
- ZendSearch Lucene find
metrics.zend.table_metadata
- Zend Table Metadata Reads
metrics.zend.view_renderer
- Zend View renderer
Magento Metrics are only available to Blackfire's Magento Add-on subscribers.
The following metrics are Magento specific and are only available to Magento Enterprise Cloud for Business and Blackfire's Magento Add-on subscribers.
metrics.magento1.action.catalog_category_view
- Action catalog_category_view (category page)
metrics.magento1.action.catalog_product_view
- Action catalog_product_view (product page)
metrics.magento1.action.checkout_cart_index
- Action checkout_cart_index (cart page)
metrics.magento1.action.cms_index_index
- Action cms_index_index (homepage)
metrics.magento1.action.cms_page_view
- Action cms_page_view (any CMS page)
metrics.magento1.block.cache.load.get_cache_key
- Get block's cache key during cache load
metrics.magento1.collection.cache.load
- Load the collection cache
metrics.magento1.collection.cache.unserialize
- Unserialize the collection cache
metrics.magento1.collection.load
- Collection load
metrics.magento1.collection.product.load
- Collection Product load
metrics.magento1.config.read
- Read the configuration
metrics.magento1.controller.checkout_onepage
- Any action on the checkout's onepage
metrics.magento1.controller.customer_account
- Any action on the customer's account
metrics.magento1.customer.logged_in
- Load the customer of the current session
metrics.magento1.events
- Fire Magento event
metrics.magento1.layout.update.save_cache
- Load layout updates by handles
metrics.magento1.model.load
- Model load
metrics.magento1.model.product.load
- Model Product load
metrics.magento1.translate.cache.load
- Load the translation cache
metrics.magento1.translate.cache.unserialize
- Unserialize the translation cache
metrics.magento2.all.action.catalog_category_view
- Action catalog_category_view (category page)
metrics.magento2.all.action.catalog_product_view
- Action catalog_product_view (product page)
metrics.magento2.all.action.checkout_cart_index
- Action checkout_cart_index (cart page)
metrics.magento2.all.action.cms_index_index
- Action cms_index_index (homepage)
metrics.magento2.all.action.cms_page_view
- Action cms_page_view (any CMS page)
metrics.magento2.all.cache.any.save
- Any cache save
metrics.magento2.all.cache.block.save.action
- Save (and not ask to) a block in cache
metrics.magento2.all.cache.block.save.call
- Ask to save a block in cache
metrics.magento2.all.cache.clean.action
- Clean a cache, only if it's enabled
metrics.magento2.all.cache.clean.call
- Ask to clean a cache, even if it's not enabled
metrics.magento2.all.cache.ddl.read
- Read in DB information which should be in cache
metrics.magento2.all.cache.eav.read
- Read EAV entity types in database
metrics.magento2.all.cache.full_page.builtin.hit
- Hit full page cache using builtin
metrics.magento2.all.cache.layout.read
- Read of Layout files
metrics.magento2.all.cache.reflection.read
- Read Reflection data
metrics.magento2.all.cache.translate.read
- Read Translation file
metrics.magento2.all.collection.load
- Collection load
metrics.magento2.all.collection.product.load
- Collection Product load
metrics.magento2.all.config.css.merge_css_files.enabled
- Merge of CSS files is enabled
metrics.magento2.all.config.di.read
- Configuration DI read [from disk]
metrics.magento2.all.config.js.enable_js_bundling.enabled
- The config dev/js/enable_js_bundling is enabled
metrics.magento2.all.config.js.merge_js_files.enabled
- Merge of JS files is enabled
metrics.magento2.all.controller.checkout
- Any action on the checkout's onepage
metrics.magento2.all.controller.customer_account
- Any action on the customer's account (logged in)
metrics.magento2.all.frontend.blocks.load_cache.hit
- Load cache hit for blocks
metrics.magento2.all.frontend.blocks.to_html
- Number of blocks displayed
metrics.magento2.all.frontend.blocks.with_lifetime
- Blocks which have a lifetime
metrics.magento2.all.logger.db
- DB Logger
metrics.magento2.all.mode.default
- Application Mode default
metrics.magento2.all.mode.developer
- Application Mode developer
metrics.magento2.all.mode.production
- Application Mode production
metrics.magento2.all.model.cms_page.load
- Model CMS Page load
metrics.magento2.all.model.load
- Model load
metrics.magento2.all.model.product.load
- Model Product load
metrics.magento2.all.profiler
- Profiler
metrics.magento2.events
- Fire Magento event
metrics.magento2.interceptors
- Magento interceptors
metrics.magento2.template.render
- Template rendering
By default, Blackfire gives access to a large number of built-in metrics, most of them being specific to the language or popular Open-Source libraries. Based on project requirements, custom metrics can also be defined for a project.
Let's create the cache.write metric. It will aggregate the costs of the
Cache::write() calls, an hypothetical class of my project that is memory
intensive.
Besides a name (cache.write), a metric must be associated with some
function calls, via a metric selector; here we want
to match all calls to Cache::write(), so the selector would be
=Cache::write.
Custom metrics can be used in assertions like any other metrics: the name is
made of the metrics. prefix, then the metric name (cache.write in our
example), and it ends with one of the available dimensions (.peak_memory in
the example):
1 | "metrics.cache.write.peak_memory < 10mb"
|
Note
As a matter of fact, built-in metrics are defined in the exact same way as custom ones.
Custom metrics can be defined in a .blackfire.yaml file or via the PHP SDK.
Defining a metric is all about selecting a sub-set of the profile function calls. A selector first character defines how to interpret the rest of the expression:
=: Matches the expression exactly;^: Matches everything starting with the expression;/: Interprets the expression as a regex that should match;!: Interprets the expression as a regex that should not match;|: Similar to =, but matches any object that is an instance of the class;The second part of the selector defines which function calls to match.
Here are some selector examples:
=Class::method: Matches the method function calls on Class;=func: Matches the func function calls;^ArrayObject::: Matches all function calls from the ArrayObject class;^exif_: Matches all function calls for which the function starts with
exif_;/^Class::(method1|method2)$/: Matches method1 and method2 calls
from Class;!^spl_autoload_call$!: Matches any function/method calls but
spl_autoload_call ones.|Psr\Log\LoggerInterface::log: Matches any calls to log on objects
that are an instance of Psr\Log\LoggerInterface.Besides matching nodes, a metric can also be used to gather function call arguments (to be precise, you can get at most one argument for a function call).
Blackfire aggregates all calls to a function into one node to make it easy to reason about resources consumed by it. But sometimes, being able to have different nodes for a function call depending on one argument can help if the argument makes the function behave very differently (think of a database function call that is very sensitive to the SQL statement that needs to be executed for instance).
When defining argument capturing, you determine which argument you want to
capture (1-based index) and when to capture it (^ means that Blackfire
needs to always get the argument; ^http would only get the argument if it
starts with the http string, all other calls would be aggregated into one
node).
Argument capturing is only available in .blackfire.yaml file.
Caution
Argument capturing works only with the = (equals) selector.
Tip
Arguments are displayed in the function call table and in the call graph. As Blackfire displays separate nodes for each unique argument, it's also a great way to better understand how the code behaves (for instance, one node per event for an event dispatcher handle method instead of one big node for all events).
1 2 3 4 5 6 7 8 | metrics:
cache.write: # metric name
label: "Cache::write() calls"
matching_calls:
php:
- callee:
selector: '=Cache::write' # aggregate the costs of all Cache::write calls
argument: { 1: "^" } # but create separate nodes by the first argument value
|