---
title: "Automatic Instrumentation"
description: "Learn which transactions and spans the Bref integration captures automatically: event handlers, cold starts, and restarts."
url: https://docs.sentry.io/platforms/php/guides/bref/tracing/automatic-instrumentation/
---

# Automatic Instrumentation for Bref

Once [tracing is enabled](https://docs.sentry.io/platforms/php/guides/bref/tracing.md), the integration traces event handlers and cold starts without any additional code.

## [Event Handlers](https://docs.sentry.io/platforms/php/guides/bref/tracing/automatic-instrumentation.md#event-handlers)

[Event handlers](https://bref.sh/docs/runtimes/function) process SQS messages, EventBridge events, S3 notifications, and more. There's no HTTP request around them, so the Sentry SDK doesn't start transactions on its own. The integration creates a transaction for each invocation, named after the Lambda function.

With Laravel, the Sentry SDK for Laravel already creates a transaction for each queued job and Octane request, named after the job or the route. The integration adds the cold start to these transactions instead of creating its own.

## [Cold Starts](https://docs.sentry.io/platforms/php/guides/bref/tracing/automatic-instrumentation.md#cold-starts)

On a cold start, Lambda creates a new instance before it handles the request, and your users wait for it. The integration adds this time to the first transaction of each instance, as two spans:

* `lambda.cold-start`: from the start of PHP to the start of the request
* `bref.startup`: the startup of Bref, inside the cold start

The cold start span begins when PHP starts, so it doesn't include the time Lambda spends creating the instance before PHP starts.

Lambda sometimes [initializes an instance proactively](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtime-environment.html), before a request arrives. Because no request waits for this initialization to finish, these cold starts aren't included in transactions.

## [Event Handler Restarts](https://docs.sentry.io/platforms/php/guides/bref/tracing/automatic-instrumentation.md#event-handler-restarts)

By default, Bref restarts the PHP process of event handlers after each invocation (see [`BREF_LOOP_MAX`](https://bref.sh/docs/environment/performances#bref-for-event-driven-functions)). The restart happens after the invocation's response, so it's not part of its transaction. The integration reports it as a separate `bref.startup` transaction, in the same trace as the previous invocation.
