Skip to content

Commit 5a1ba7f

Browse files
author
Chris Rees
committed
Add Scout APM monitoring
1 parent bf31b98 commit 5a1ba7f

File tree

5 files changed

+24
-44
lines changed

5 files changed

+24
-44
lines changed

config/prod.exs

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,52 +23,15 @@ config :nermesterts, Nermesterts.Repo,
2323
adapter: Ecto.Adapters.Postgres,
2424
url: System.get_env("DATABASE_URL"),
2525
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
26-
ssl: true
26+
ssl: true,
27+
loggers: [{Ecto.LogEntry, :log, []},
28+
{ScoutApm.Instruments.EctoLogger, :log, []}]
2729

2830
config :comeonin,
2931
bcrypt_log_rounds: 14
3032

3133
# Do not print debug messages in production
3234
config :logger, level: :info
3335

34-
# ## SSL Support
35-
#
36-
# To get SSL working, you will need to add the `https` key
37-
# to the previous section and set your `:url` port to 443:
38-
#
39-
# config :nermesterts, Nermesterts.Endpoint,
40-
# ...
41-
# url: [host: "example.com", port: 443],
42-
# https: [port: 443,
43-
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
44-
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
45-
#
46-
# Where those two env variables return an absolute path to
47-
# the key and cert in disk or a relative path inside priv,
48-
# for example "priv/ssl/server.key".
49-
#
50-
# We also recommend setting `force_ssl`, ensuring no data is
51-
# ever sent via http, always redirecting to https:
52-
#
53-
# config :nermesterts, Nermesterts.Endpoint,
54-
# force_ssl: [hsts: true]
55-
#
56-
# Check `Plug.SSL` for all available options in `force_ssl`.
57-
58-
# ## Using releases
59-
#
60-
# If you are doing OTP releases, you need to instruct Phoenix
61-
# to start the server for all endpoints:
62-
#
63-
# config :phoenix, :serve_endpoints, true
64-
#
65-
# Alternatively, you can configure exactly which server to
66-
# start per endpoint:
67-
#
68-
# config :nermesterts, Nermesterts.Endpoint, server: true
69-
#
70-
# You will also need to set the application root to `.` in order
71-
# for the new static assets to be served after a hot upgrade:
72-
#
73-
# config :nermesterts, Nermesterts.Endpoint, root: "."
74-
36+
# Import Scout APM
37+
import_config "scout_apm.exs"

config/scout_apm.exs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This configuration file is used for Scout APM.
2+
# See our help docs at http://help.apm.scoutapp.com for more information.
3+
# config/scout_apm.exs
4+
use Mix.Config
5+
6+
config :scout_apm,
7+
name: "CoverMyTabletop",
8+
key: "jSFUV5vOHl4BJWefdqoE"
9+
10+
config :phoenix, :template_engines,
11+
eex: ScoutApm.Instruments.EExEngine,
12+
exs: ScoutApm.Instruments.ExsEngine

mix.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ defmodule Nermesterts.Mixfile do
1919
def application do
2020
[mod: {Nermesterts, []},
2121
applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
22-
:phoenix_ecto, :postgrex, :ex_machina, :httpotion, :boardgamegeek_client]]
22+
:phoenix_ecto, :postgrex, :ex_machina, :httpotion, :boardgamegeek_client,
23+
:scout_apm]]
2324
end
2425

2526
# Specifies which paths to compile per environment.
@@ -43,6 +44,7 @@ defmodule Nermesterts.Mixfile do
4344
{:phoenix_live_reload, "~> 1.0", only: :dev},
4445
{:phoenix_pubsub, "~> 1.0"},
4546
{:postgrex, ">= 0.0.0"},
47+
{:scout_apm, "~> 0.0"},
4648
{:timex, "~> 3.0"}]
4749
end
4850

mix.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
%{"boardgamegeek_client": {:git, "https://github.com/ElixirCLE/boardgamegeek_client.git", "78b8e7b235f4002037fb0639bbb7fc3fa3bc59c6", []},
1+
%{"approximate_histogram": {:hex, :approximate_histogram, "0.1.1", "198eb36681e763ed4baab6ca0682acec4ef642f60ba272f251d3059052f4f378", [:mix], [], "hexpm"},
2+
"boardgamegeek_client": {:git, "https://github.com/ElixirCLE/boardgamegeek_client.git", "78b8e7b235f4002037fb0639bbb7fc3fa3bc59c6", []},
23
"canada": {:hex, :canada, "1.0.1", "da96d0ff101a0c2a6cc7b07d92b8884ff6508f058781d3679999416feacf41c5", [:mix], [], "hexpm"},
34
"canary": {:hex, :canary, "1.1.1", "4138d5e05db8497c477e4af73902eb9ae06e49dceaa13c2dd9f0b55525ded48b", [:mix], [{:canada, "~> 1.0.1", [hex: :canada, repo: "hexpm", optional: false]}, {:ecto, ">= 1.1.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
45
"certifi": {:hex, :certifi, "1.2.1", "c3904f192bd5284e5b13f20db3ceac9626e14eeacfbb492e19583cf0e37b22be", [:rebar3], [], "hexpm"},
@@ -34,6 +35,7 @@
3435
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [], [], "hexpm"},
3536
"postgrex": {:hex, :postgrex, "0.13.3", "c277cfb2a9c5034d445a722494c13359e361d344ef6f25d604c2353185682bfc", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm"},
3637
"ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], [], "hexpm"},
38+
"scout_apm": {:hex, :scout_apm, "0.3.2", "605c6edd3f06a51ef6f81326510efbd884ebd76b6bd0c45ac064ae091f5b8bba", [:mix], [{:approximate_histogram, "~>0.1.1", [hex: :approximate_histogram, repo: "hexpm", optional: false]}, {:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~>1.0", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, ">= 0.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
3739
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"},
3840
"timex": {:hex, :timex, "3.1.17", "d830b2c82589c2a0b51e63185551965e73b4d9e9dda5804c7ffb8a1212e460a9", [:mix], [{:combine, "~> 0.7", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"},
3941
"tzdata": {:hex, :tzdata, "0.5.12", "1c17b68692c6ba5b6ab15db3d64cc8baa0f182043d5ae9d4b6d35d70af76f67b", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},

web/web.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ defmodule Nermesterts.Web do
2929
def controller do
3030
quote do
3131
use Phoenix.Controller
32+
use ScoutApm.Instrumentation
3233

3334
alias Nermesterts.Repo
3435
import Ecto

0 commit comments

Comments
 (0)