|
| 1 | +import Image from 'next/image'; |
| 2 | +import cloudXrayTrace from './monitoring/cloud-xray-trace.png'; |
| 3 | +import cloudXrayFiltersGeneral from './monitoring/cloud-xray-filters-general.png'; |
| 4 | +import cloudXrayFiltersAnnotations from './monitoring/cloud-xray-filters-annotations.png'; |
| 5 | +import cloudOverview from './monitoring/cloud-overview.png'; |
| 6 | +import cloudLogs from './monitoring/cloud-logs.png'; |
| 7 | + |
| 8 | +# Monitoring |
| 9 | + |
| 10 | +By default, AWS Lambda publishes PHP logs and metrics to [AWS CloudWatch](https://aws.amazon.com/cloudwatch/). These include HTTP response times, code execution duration, error rates, and more. |
| 11 | + |
| 12 | +Here is a summary of recommended tools for monitoring Bref applications: |
| 13 | + |
| 14 | +- **Logs and metrics**: CloudWatch (built-in), [Bref Cloud](/cloud) |
| 15 | +- **Error tracking**: [Sentry](https://sentry.io) and similar services |
| 16 | +- **Performance tracing**: [Bref Cloud](/cloud) with [X-Ray](/xray) |
| 17 | + |
| 18 | +Let's dive into the details of each of them. |
| 19 | + |
| 20 | +## Sentry |
| 21 | + |
| 22 | +[Sentry](https://sentry.io) is a popular error tracking service. It works well out of the box with Bref for HTTP applications: install the [Sentry SDK for PHP](https://docs.sentry.io/platforms/php/) (or the [Laravel](https://docs.sentry.io/platforms/php/guides/laravel/) or [Symfony](https://docs.sentry.io/platforms/php/guides/symfony/) integrations) and errors will be tracked automatically. |
| 23 | + |
| 24 | +For more advanced use cases, such as tracking Lambda errors outside of PHP-FPM (timeouts, oversized responses…), monitoring event-driven handlers (SQS, EventBridge, S3…), or tracking cold starts and AWS SDK calls, the [Bref Sentry package](/sentry) extends Sentry's capabilities for AWS Lambda. It is available as a [separate license](/sentry). |
| 25 | + |
| 26 | +## Bref Cloud |
| 27 | + |
| 28 | +[Bref Cloud](/cloud) provides an all-in-one monitoring experience for serverless PHP applications: |
| 29 | + |
| 30 | +<Image className="mt-3 rounded-lg shadow-md border" src={cloudOverview} alt="Bref Cloud application overview" /> |
| 31 | + |
| 32 | +- **Logs**: view and search CloudWatch logs in a simplified UI. |
| 33 | + |
| 34 | +<Image className="mt-3 rounded-lg shadow-md border" src={cloudLogs} alt="Log viewer in Bref Cloud" /> |
| 35 | + |
| 36 | +- **Metrics**: monitor Lambda invocations, duration, errors, and more. |
| 37 | +- **Traces**: visualize X-Ray traces to understand the performance of your application, including database queries, HTTP calls, and AWS SDK calls. |
| 38 | + |
| 39 | +<Image className="mt-3 rounded-lg shadow-md border" src={cloudXrayTrace} alt="X-Ray trace in Bref Cloud" /> |
| 40 | + |
| 41 | +With the [Bref X-Ray](/xray) package, traces are enriched with annotations that you can use to filter and search. For example, you can filter traces by specific controller, route, CLI command, or job class: |
| 42 | + |
| 43 | +<div className="flex gap-4 mt-3 items-start"> |
| 44 | + <Image className="rounded-lg shadow-md border h-auto" style={{maxHeight: 350, width: 'auto'}} src={cloudXrayFiltersGeneral} alt="X-Ray trace filters in Bref Cloud" /> |
| 45 | + <Image className="rounded-lg shadow-md border h-auto" style={{maxHeight: 350, width: 'auto'}} src={cloudXrayFiltersAnnotations} alt="X-Ray trace annotation filters in Bref Cloud" /> |
| 46 | +</div> |
| 47 | + |
| 48 | +Bref Cloud users get a **free [Bref X-Ray](/xray) license** included in their plan to enable performance tracing. To activate it, contact support via [bref.cloud/support](https://bref.cloud/support) or [Slack](https://bref.sh/slack). |
| 49 | + |
| 50 | +[Learn more about Bref Cloud](/cloud). |
| 51 | + |
| 52 | +## X-Ray |
| 53 | + |
| 54 | +[AWS X-Ray](https://aws.amazon.com/xray/) provides distributed tracing for Lambda applications. The [Bref X-Ray package](/xray) integrates X-Ray with PHP, tracking cold starts, database queries, HTTP calls, AWS SDK calls, and more. It supports both Laravel and Symfony. |
| 55 | + |
| 56 | +The package can be used with or without Bref Cloud. Bref Cloud users get a free license (see above), while others can [purchase a standalone license](/xray). |
| 57 | + |
| 58 | +## Sentry Lambda package |
| 59 | + |
| 60 | +As mentioned above, the standard Sentry SDK works great for HTTP applications. The [Bref Sentry package](/sentry) goes further by adding Lambda-specific capabilities: tracking errors outside of PHP-FPM, monitoring event-driven handlers, and tracking cold starts. |
| 61 | + |
| 62 | +The package can be used with or without Bref Cloud. It is available as a [standalone license](/sentry). |
| 63 | + |
| 64 | +## Bref Dashboard |
| 65 | + |
| 66 | +The [Bref Dashboard](https://dashboard.bref.sh/?ref=bref) is an alternative for projects that do not use Bref Cloud. It fetches data from AWS CloudWatch and provides a simple UI for logs and metrics. It requires no setup in AWS and can be used straight away. |
| 67 | + |
| 68 | +[](https://dashboard.bref.sh/?ref=bref) |
| 69 | + |
| 70 | +## Tideways |
| 71 | + |
| 72 | +[Tideways](https://tideways.com/?ref=bref) is a PHP-specific monitoring and profiling tool that can be used with Bref. It requires setting up a daemon on an EC2 instance in a VPC. |
| 73 | + |
| 74 | +[Learn more about using Tideways with Bref](./monitoring/tideways.md). |
0 commit comments