-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Phoenix 1.7's template telemetry (#54)
* Support Phoenix 1.7's template telemetry Instead of using Appsignal.View, Appsignal.EventHandler subscribes to Phoenix 1.7's new template telemetry to gain template rendering insights. * Add warning for using Phoenix.View on Phoenix 1.7 Phoenix 1.7 apps don't have a :view in their web modules. The closest thing is :html, which is similar, but doesn't have Phoenix.View anymore, which is what Appsignal.Phoenix.View depended on. To make sure users don't move their use Appsignal.Phoenix.View line to the html function in their Phoenix 1.7 web module, this patch makes sure that whatever Appsignal.Phoenix.View is used in has a __templates__/0 and a render/2 function before doing anything. If not, it'll print a warning: > 10:20:44.354 [warning] AppSignal.Phoenix.View NOT attached to Elixir.AppsignalPhoenixExampleWeb.Layouts > > Template rendering instrumentation is now set up automatically, so using > Appsignal.Phoenix.View in your app's web module is no longer needed. This warning is noisy, as it prints for every view module in the app. Also, it's printed using Elixir's regular Logger instead of Appsignal.IntegrationLogger for two reasons. Firstly, since it's run in a __before_compile__/1, the configuration isn't loaded yet, so Appsignal.IntegrationLogger can't function. Also, it's not needed since it's using the warn level, which would be printed anyway. * Add changeset for new template instrumentation > Add template instrumentation for Phoenix 1.7. Phoenix's upcoming > release adds telemetry to templates, so using Appsignal.Phoenix.View > is no longer needed. * Update lib/appsignal_phoenix/event_handler.ex Co-authored-by: Noemi <45180344+unflxw@users.noreply.github.com> * Update event handler tests to match new event keys The merged version of the Phoenix patch uses `[:phoenix, :controller, :render, :start]` instead of the proposed `[:phoenix_template, :render, :start]`. Co-authored-by: Noemi <45180344+unflxw@users.noreply.github.com>
- Loading branch information
1 parent
93873c0
commit 3207e18
Showing
4 changed files
with
118 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
bump: "minor" | ||
type: "add" | ||
--- | ||
|
||
Add automatic template instrumentation for Phoenix 1.7. Phoenix's upcoming release adds telemetry to templates, so using Appsignal.Phoenix.View is no longer needed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters