API

Naming Transactions

Blackfire Monitoring supports all PHP applications, with extended support for Symfony, Laravel, Magento, Drupal, TYPO3, Prestashop, and Ibexa DXP.

For supported frameworks, Blackfire automatically detects the controller that handles each URL/transaction. The transactions are listed by controllers to ease focusing on the code parts which have the highest overall resource consumption impact.

When Blackfire is not able to automatically detect transaction names, it groups them in a virtual transaction named “Unnamed transactions”.

You can programmatically set transaction names using the snippet below:

PHP Application

1
2
// As of Blackfire PHP Probe 1.44.0
\BlackfireProbe::setTransactionName('user_model::show');

Python Application

1
2
3
4
from blackfire import apm

# As of Blackfire Python Probe 1.5.5
apm.set_transaction_name('user_model.show');

Ignoring Transactions

In some cases, you might not want Blackfire to instrument some transactions. You can programmatically ignore them using the ignoreTransaction() method:

PHP Application

1
2
// As of Blackfire PHP Probe 1.57.0
\BlackfireProbe::ignoreTransaction();

Python Application

1
2
3
4
from blackfire import apm

# As of Blackfire Python Probe 1.6.1
apm.ignore_transaction();

Managing Transactions

Instrumentation of CLI commands and consumers needs to be manually triggered:

PHP Application

1
2
3
4
5
6
7
8
9
// As of Blackfire PHP Probe 1.62.0
\BlackfireProbe::startTransaction();

// CLI transactions should be manually named
\BlackfireProbe::setTransactionName('user_model::show');

...

\BlackfireProbe::stopTransaction();

Python Application

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from blackfire import apm

# As of Blackfire Python Probe 1.6.1
apm.start_transaction();

# CLI transactions should be manually named
apm.set_transaction_name('user_model.show');

...

apm.stop_transaction();