Indiana is a plugin for Elixir and Phoenix apps that reports response times to New Relic since they haven't released an Elixir SDK yet.
Available in Hex, the package can be installed as:
- Add
indiana
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:indiana, "~> 0.1.4"}]
end
```
- Ensure
indiana
is started before your application:
```elixir
def application do
[applications: [:indiana]]
end
```
First make sure that you have the environment setup properly. Indiana needs several env vars to work.
# config
config :indiana,
new_relic_license_key: "some-key",
app_name: "my-awesome-app"
# by default, Indiana always sends to new relic so to turn it off in dev.exs or test.exs
send_to_new_relic: "false"
Indiana is designed to work with Phoenix applications first and foremost so to get started add it to your endpoint.
# lib/my_awesome_app/endpoint.ex
defmodule MyAwesomeApp.Endpoint do
use Phoenix.Endpoint, otp_app: :my_awesome_app
plug Indiana.Integrations.Phoenix
end
If you are using Ecto and want to add query time to your stats, add it to your Repo.
# lib/my_awesome_app/repo.ex
defmodule MyAwesomeApp.Repo do
use Ecto.Repo, otp_app: :my_awesome_app
use Indiana.Integrations.Ecto
end
That's it! Stats will show up under the plugin tabs in your New Relic under indiana. You'll need to customize the data in a way that makes sense for you.
Things that need to be added for this library to be most useful:
- Find a way to get response times for external calls
- stuff I haven't thought of yet
New Relic is a powerful and complex tool. I need help if we are going to make this work. I started this project in an effort to learn Elixir so I'm sure there are many improvements in the existing codebase that can be made. There are probably bugs and generally bad Elixir patterns. Feel free to submit issues, fork, or submit pull requests for anything you think can be improved.
This software is licensed under the MIT license.