Understanding events and their relationships in Nightwatch
Events are the fundamental building blocks of observability in Nightwatch. Each event captures a single activity, such as a database query, an API call, an email sent, or an exception thrown. Nightwatch connects these events to reveal the complete journey through your application. When debugging an error, you trace its exact path from origin to failure. When investigating slow performance, you identify precisely which queries, cache operations, or external services are the bottleneck. This depth of visibility provides unparalleled insight into improving your application.
Events connect together through an execution context — the origin point that triggered a chain of related activities. When a request enters your application, it becomes the execution context. All subsequent events (queries, cache operations, jobs, API calls, exceptions) are linked as children, creating a complete timeline of what happened.In Laravel applications, there are three types of execution contexts:
HTTP Requests: A user visits a page or an API endpoint is called
Events are captured automatically by the Nightwatch agent once installed in your Laravel application. The agent integrates with Laravel’s internals and transmits event data asynchronously, ensuring minimal performance impact. No code changes or manual instrumentation required.
Every event captured contributes toward your organization’s monthly quota based on your subscription plan.Control your event consumption using sampling to determine which execution contexts to capture, and filtering to exclude specific events within those contexts. To identify optimization opportunities, view your usage breakdown by application, environment, and event type in the usage area of the settings dashboard. Use this data to apply targeted sampling and filtering strategies where they’ll have the most impact.If you would like to collect more events than your plan’s quota provides, you can set a an Additional Event limit in your billing settings. This will allow you to continue collecting events beyond your quota until your limit is reached.