March 2018
Intermediate to advanced
244 pages
6h 10m
English
The heart of a Phoenix application is the endpoint module. It is the entry point for web requests and it encapsulates the supervision tree of our web application. In our app, it is called DemoWeb.Endpoint. This module also contains a function named instrument/3, which we can use to instrument any event inside our web stack:
| | require DemoWeb.Endpoint |
| | DemoWeb.Endpoint.instrument(:long_operation_in_controller, |
| | %{metadata: "foobar"}, fn -> |
| | # code to be instrumented |
| | end) |
Phoenix itself instruments a handful of events, listed here:
phoenix_controller_call measures how long the controller takes to process your request.
phoenix_controller_render measures the time the controller takes to render your view.
Read now
Unlock full access