@@ -7,16 +7,31 @@ defmodule PhoenixApp.Application do
77
88 @ impl true
99 def start ( _type , _args ) do
10+ :ok = Application . ensure_started ( :inets )
11+
12+ :logger . add_handler ( :my_sentry_handler , Sentry.LoggerHandler , % {
13+ config: % { metadata: [ :file , :line ] }
14+ } )
15+
16+ OpentelemetryBandit . setup ( )
17+ OpentelemetryPhoenix . setup ( adapter: :bandit )
18+ OpentelemetryOban . setup ( )
19+ OpentelemetryEcto . setup ( [ :phoenix_app , :repo ] , db_statement: :enabled )
20+
1021 children = [
1122 PhoenixAppWeb.Telemetry ,
23+ PhoenixApp.Repo ,
24+ { Ecto.Migrator ,
25+ repos: Application . fetch_env! ( :phoenix_app , :ecto_repos ) , skip: skip_migrations? ( ) } ,
1226 { DNSCluster , query: Application . get_env ( :phoenix_app , :dns_cluster_query ) || :ignore } ,
1327 { Phoenix.PubSub , name: PhoenixApp.PubSub } ,
1428 # Start the Finch HTTP client for sending emails
1529 { Finch , name: PhoenixApp.Finch } ,
16- # Start a worker by calling: PhoenixApp.Worker.start_link(arg)
17- # {PhoenixApp.Worker, arg },
30+ # Start Oban
31+ { Oban , Application . fetch_env! ( :phoenix_app , Oban ) } ,
1832 # Start to serve requests, typically the last entry
19- PhoenixAppWeb.Endpoint
33+ PhoenixAppWeb.Endpoint ,
34+ Sentry.OpenTelemetry.SpanStorage
2035 ]
2136
2237 # See https://hexdocs.pm/elixir/Supervisor.html
@@ -25,12 +40,15 @@ defmodule PhoenixApp.Application do
2540 Supervisor . start_link ( children , opts )
2641 end
2742
28- # TODO: Uncomment if we ever move the endpoint from test/support to the phoenix_app dir
2943 # Tell Phoenix to update the endpoint configuration
3044 # whenever the application is updated.
31- # @impl true
32- # def config_change(changed, _new, removed) do
33- # PhoenixAppWeb.Endpoint.config_change(changed, removed)
34- # :ok
35- # end
45+ @ impl true
46+ def config_change ( changed , _new , removed ) do
47+ PhoenixAppWeb.Endpoint . config_change ( changed , removed )
48+ :ok
49+ end
50+
51+ defp skip_migrations? ( ) do
52+ System . get_env ( "RELEASE_NAME" ) != nil
53+ end
3654end
0 commit comments