Scout APM supports multiple Phoenix template engines through conditional compilation:
- EEx (
.eex) - Standard Embedded Elixir templates - ExS (
.exs) - ExScript templates - HEEx (
.heex) - HTML-aware Embedded Elixir (Phoenix LiveView)
mix deps.get
mix testAll template engine modules use conditional compilation via Code.ensure_loaded?/1:
if Code.ensure_loaded?(Phoenix.LiveView.HTMLEngine) do
defmodule ScoutApm.Instruments.HEExEngine do
# ... only compiled when phoenix_live_view is available
end
endThis means:
- Engines are only compiled when their dependencies are available
- Users only install the template engines they actually use
- No runtime errors for missing optional dependencies
- Scout APM "just works" with whatever template engines the user has installed
# Test HEEx engine
mix test test/scout_apm/instruments/heex_engine_test.exs
# Test EEx engine
mix test test/scout_apm/instruments/eex_engine_test.exs
# Test ExS engine
mix test test/scout_apm/instruments/exs_engine_test.exsUsers of Scout APM add template engines to their config/config.exs:
config :phoenix, :template_engines,
eex: ScoutApm.Instruments.EExEngine,
exs: ScoutApm.Instruments.ExsEngine,
heex: ScoutApm.Instruments.HEExEngine # Only if phoenix_live_view is installedThe appropriate engines are automatically available based on the user's dependencies.
Tests run on GitHub Actions with the latest Elixir and OTP versions. See .github/workflows/ci.yml for configuration.