# Naming Transactions

[introduction-to-blackfire](https://www.youtube-nocookie.com/embed/3LA7BqROq_Q?rel=0&showinfo=0&modestbranding=1&autoplay=0)

From a Monitoring perspective, **a transaction is a group of server-side requests which have been traced by Blackfire**, and for which a name has been defined, according to the supported frameworks.

It may correspond to a controller, a specific action, or a view, depending on whatever is relevant to your application or framework.

Blackfire Monitoring supports all kinds of PHP and Python applications, and provides extended support for various frameworks, such as Symfony, Laravel, Magento, Django, or FastAPI.

![](../images/monitoring/monitoring-transactions-list.png)

The transactions list is designed to ease focusing on code parts that have the highest resource consumption impact.

## Unnamed Transactions

When Blackfire is not able to automatically name transactions, it groups them separately as **Unnamed transactions**.

You may inspect the traces within it to name the transactions manually.

### Naming HTTP Transactions Programmatically

We recommend naming unnamed transaction programmatically using the snippet below:

**PHP Application**

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

**Python Application**

```python
from blackfire import apm

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

### Naming HTTP Transactions Using the UI

You may also configure custom transactions from the user interface (UI).

> **Caution**
>
> Manually named transactions using the UI cannot be [profiled automatically](automatic-profiling#monitoring_automatic_profiling) nor be targeted by the [profile next request](automatic-profiling#monitoring_profile_next_request) CTA.
>
> Transactions need to be [named programmatically](naming-transactions#monitoring_naming_transactions_programmatically) for automatic profiling and *Profile next request* to work.

Click on the **Configure Custom Transaction Names** button from your monitoring settings or from the *Unnamed transaction* view to configure custom transactions names:

![](../images/monitoring/monitoring-configure-transaction-names-button.png)

A panel appears, allowing you to configure the transaction names based on the URI pattern. The pattern can be defined either using a [regular expression](https://en.wikipedia.org/wiki/Regular_expression) or using a [glob pattern](https://en.wikipedia.org/wiki/Glob_(programming)).

For each pattern, you need to define a single name that is to be assigned to the corresponding transaction.

![](../images/monitoring/monitoring-url-patterns.png)

To help you identify the URIs that need to be recognized as transactions, a list of the latest URLs, which did not correspond to any transaction, is provided.

![](../images/monitoring/monitoring-url-list.png)

## Naming CLI Transactions

Monitoring for CLI commands and consumers needs to be manually triggered:

**PHP Application**

```php
// As of Blackfire PHP Probe 1.78.0
\BlackfireProbe::startTransaction('my_transaction_name');

// ...

\BlackfireProbe::stopTransaction();
```

**Python Application**

```python
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();
```
