AppSignal  Docs

Visit AppSignal.com
Jump to navigation

Installing AppSignal for Elixir

Installing the AppSignal package in your Elixir application requires a couple manual steps. Currently pure Elixir applications and the Phoenix framework are supported. Both use-cases are described in this guide.

If AppSignal does not support your use-case or if you find a problem with the documentation, don't hesitate to contact us. You can also create a pull-request on our public Elixir repository or documentation repository.

Installing the package

  1. Start by adding appsignal to your list of dependencies in mix.exs.
1
2
3
4
# mix.exs
def deps do
  [{:appsignal, "~> 0.0"}]
end
  1. Ensure appsignal is started before your application.
1
2
3
4
# mix.exs
def application do
  [applications: [:appsignal]]
end
  1. If you use the Phoenix framework, make sure you use the Appsignal.Phoenix module in your endpoint.ex file, just before the line where your router module gets called (which should read something like plug MyApp.Router).
1
2
3
4
# lib/my_app/endpoint.ex
# ...
use Appsignal.Phoenix
plug MyApp.Router

For more information on how to integrate AppSignal fully into your Phoenix application (monitoring for queries, template rendering and channels) see our Phoenix integration

When the AppSignal OTP application starts, it looks for a valid configuration (e.g. an AppSignal push key), and start the AppSignal agent.

If it can't find a valid configuration, a warning will be logged. See the Configuration section on how to fully configure the AppSignal agent.

Configuration

Before the AppSignal package works you need to configure it. To be able to send data to AppSignal you first need to create an account on AppSignal.com.

During the installation process you will receive a hexadecimal Push API key which you will need to place in your application's config.exs.

1
2
3
4
# config/config.exs
config :appsignal, :config,
  name: :my_first_app,
  push_api_key: "your-hex-appsignal-key"

Alternatively, you can configure AppSignal using OS environment variables.

1
2
export APPSIGNAL_APP_NAME=my_first_app
export APPSIGNAL_PUSH_API_KEY=your-hex-appsignal-key

For more information about configuring the AppSignal package for Elixir, please read our configuration documentation.

Application environment and version

Running your application you want to let AppSignal know what state your application is in.

This includes information about the version (revision) of your application and what environment it's running in.

A typical environment configuration file would contain the following.

1
2
3
4
5
6
# config/prod.exs
config :appsignal, :config,
  name: :my_first_app,
  push_api_key: "your-hex-appsignal-key",
  env: :prod,
  revision: Mix.Project.config[:version]

Run your application!

Once you've completed this guide your application is ready to be monitored by AppSignal!

Start your application up and perform some requests on it. By triggering an error or two you'll also test the error reporting.

Contact us if you have questions regarding installation or encountered any problems during the installation.

Optional: Activate more instrumentation in your Phoenix app

Read more about how you can integrate more instrumentation in your Phoenix application in our integrating Phoenix guide.

Optional: Adding custom instrumentation

Add custom instrumentation to your application. Read more about custom instrumentation in our instrumentation documentation.

Want to help us improve this documentation page? Create a pull request