NewrelicInsights
Why? We are used to NewRelic custom dashboards to monitor our integrations system, but elixir does not have an official package, and the ones that are out there cant do what we need. I hope we can give this awesome community something back! We still learning elixir so be kind :)
What this isn’t
It’s not a NewRelic monitoring tool
What is this?
A way to publish custom events data to New Relic Insights data explorer. With this we can create great graphic’s to help with the monitoring of our integrations.
Installation
The package can be installed
by adding newrelic_insights to your list of dependencies in mix.exs:
def deps do
[
{:newrelic_insights, "~> 1.0.5"}
]
end
Configuration
Leave it at your config.ex while developing.
In deployed apps place it at prod.ex
config :newrelic_insights,
api_key: "NEWRELIC_API_KEY",
account_id: "NEW_RELIC_ACCOUNT_ID"
Usage
NewrelicInsights.send_event(data)
Sample Data
data = [ %{ "eventType": "Workers/MyWorker", "account": 3, "amount": 259.54 }, %{ "eventType": "Sample", "account": 5, "amount": 12309, "product": "Item" }]
IMPORTANT
- Every map inside the list MUST HAVE the key:
eventType - The value of
eventTypecan’t be blank. - Use something useful to identify your event on the
eventType, like your module/class.
The docs can be found at https://hexdocs.pm/newrelic_insights.
Newrelic references
- Data Reference and Sample
- To generate an
API KEYhttps://insights.newrelic.com/accounts/YOUR_ACCOUNT_HERE/manage/api_keys - To see the event data you’re sending
https://insights.newrelic.com/accounts/YOUR_ACCOUNT_HERE/explorer/eventsclick on thePAGE VIEWdrop down and select theEVENT TYPEyou’ve sended.