All Projects → newrelic → Elixir_agent

newrelic / Elixir_agent

Licence: apache-2.0
New Relic's Open Source Elixir Agent

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Elixir agent

Donut
Open source reimplementation of The Simpsons: Hit & Run
Stars: ✭ 179 (-6.28%)
Mutual labels:  open-source
Typescript Book
📚 The definitive guide to TypeScript and possibly the best TypeScript book 📖. Free and Open Source 🌹
Stars: ✭ 16,259 (+8412.57%)
Mutual labels:  open-source
Engine
Cocos Creator is a complete package of game development tools and workflow, including a game engine, resource management, scene editing, game preview, debug and publish one project to multiple platforms.
Stars: ✭ 2,574 (+1247.64%)
Mutual labels:  open-source
Changedetection.io
changedetection.io - The best and simplest self-hosted website change detection monitoring service. An alternative to Visualping, Watchtower etc. Designed for simplicity - the main goal is to simply monitor which websites had a text change. Open source web page change detection.
Stars: ✭ 180 (-5.76%)
Mutual labels:  open-source
No Player
Simplified Player wrapper for MediaPlayer and ExoPlayer
Stars: ✭ 182 (-4.71%)
Mutual labels:  open-source
Titra
titra - modern open source project time tracking for freelancers and small teams
Stars: ✭ 189 (-1.05%)
Mutual labels:  open-source
Quick.db
An easy, open-sourced, Node.js database designed for complete beginners getting into the concept of coding.
Stars: ✭ 177 (-7.33%)
Mutual labels:  open-source
Simple Flashlight
A simple modern flashlight with SOS, stroboscope & bright display, has no ads.
Stars: ✭ 191 (+0%)
Mutual labels:  open-source
Armadito Av
Armadito antivirus main repository
Stars: ✭ 184 (-3.66%)
Mutual labels:  open-source
Opensource.microsoft.com
This is the source code to the Microsoft Open Source site featuring projects, program information, and "get involved" pages. This site is published at opensource.microsoft.com and managed by the Microsoft Open Source Programs Office (OSPO).
Stars: ✭ 189 (-1.05%)
Mutual labels:  open-source
Baldphone
A new accessible interface for your smartphone, suitable for seniors
Stars: ✭ 181 (-5.24%)
Mutual labels:  open-source
Bookmarks
🔖 ⭐️ Collection of public dev bookmarks, shared with ❤️ from www.bookmarks.dev
Stars: ✭ 181 (-5.24%)
Mutual labels:  open-source
Loca
Open source real estate management
Stars: ✭ 189 (-1.05%)
Mutual labels:  open-source
Blocknet
Official Blocknet cryptocurrency wallet
Stars: ✭ 179 (-6.28%)
Mutual labels:  open-source
Open Source Meetup Alternatives
Open-Source Alternatives to Meetup
Stars: ✭ 191 (+0%)
Mutual labels:  open-source
Ultratabsaver
The open source Tab Manager Extension for Safari.
Stars: ✭ 178 (-6.81%)
Mutual labels:  open-source
Tsacdop
Enjoy podcasts with Tsacdop! A podcast player built with flutter.
Stars: ✭ 188 (-1.57%)
Mutual labels:  open-source
Rethink App
DNS over HTTPS / DNS over Tor / DNSCrypt client, firewall, and connection tracker for Android.
Stars: ✭ 188 (-1.57%)
Mutual labels:  open-source
Hacktoberfest
Make your first PR! ~ A beginner-friendly repository made specifically for open source beginners. Add your profile, a blog or any program under any language (it can be anything from a hello-world program to a complex data structure algorithm) or update the existing one. Just make sure to add the file under the correct directory. Happy hacking!
Stars: ✭ 191 (+0%)
Mutual labels:  open-source
Startbootstrap Full Slider
A full page image slider Bootstrap HTML template created by Start Bootstrap
Stars: ✭ 189 (-1.05%)
Mutual labels:  open-source

Community Project header

New Relic's Elixir Agent

Build Status Hex.pm Version Hex Docs License

The Open-Source Elixir Agent allows you to monitor your Elixir applications with New Relic. It helps you track transactions, distributed traces and other parts of your application's behavior and provides an overview of underlying BEAM activity.

View the Documentation

Support Statement

New Relic has open-sourced this project to enable monitoring of Elixir applications. This project is provided AS-IS WITHOUT WARRANTY OR SUPPORT, although you can report issues and contribute to the project here on GitHub.

Contributing

We'd love to get your contributions to improve the elixir agent! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. If you'd like to execute our corporate CLA, or if you have any questions, please drop us an email at [email protected].

Installation

Install the Hex package

Requirements:

  • Erlang/OTP 21
  • Elixir 1.8
defp deps do
  [
    {:new_relic_agent, "~> 1.0"}
  ]
end

Configuration

You need to set a few required configuration keys so we can authenticate properly.

Via Application config

config :new_relic_agent,
  app_name: "My App",
  license_key: "license_key"

Via Environment variables

You can also configure these attributes via ENV vars, which helps keep secrets out of source code.

  • NEW_RELIC_APP_NAME
  • NEW_RELIC_LICENSE_KEY

Telemetry-based Instrumentation

Some common Elixir packages are auto-instrumented via telemetry

Agent Features

There are a few agent features that can be enabled via configuration. Please see the documentation for more information.

Manual Instrumentation

Transactions

The Plug and Phoenix instrumentation automatically report a Transaction for each request.

These Transactions will follow across any process spawned and linked (ex: Task.async), but will not follow a process that isn't linked (ex: Task.Supervisor.async_nolink).

To manually connect a Transaction to an unlinked process, you can use NewRelic.get_transaction and NewRelic.connect_to_transaction. See the docs for those functions for further details.

tx = NewRelic.get_transaction()

spawn(fn ->
  NewRelic.connect_to_transaction(tx)
  # ...
end)

If you are using a Task to spawn work, you can use the pre-instrumented NewRelic.Instrumented.Task convienince module to make this easier. Just alias it in your module and all your Tasks will be instrumented. You may also use the functions directly.

alias NewRelic.Instrumented.Task

Task.Supervisor.async_nolink(MyTaskSupervisor, fn ->
  # This process wil be automatically connected to the Transaction...
end)

Function Tracing

NewRelic.Tracer enables detailed Function tracing. Annotate a function and it'll show up as a span in Transaction Traces / Distributed Traces, and we'll collect aggregate stats about it. Install it by adding use NewRelic.Tracer to any module, and annotating any function with an @trace module attribute

defmodule MyModule do
  use NewRelic.Tracer

  @trace :work
  def work do
    # Will report as `MyModule.work/0`
  end
end

Distributed Tracing

Requests to other services can be traced with the combination of an additional outgoing header and an :external tracer.

defmodule MyExternalService do
  use NewRelic.Tracer

  @trace {:request, category: :external}
  def request(method, url, headers) do
    NewRelic.set_span(:http, url: url, method: method, component: "HttpClient")
    headers = headers ++ NewRelic.distributed_trace_headers(:http)
    HttpClient.request(method, url, headers)
  end
end

Pre-Instrumented Modules

NewRelic.Instrumented.Mix.Task To enable the Agent and record an Other Transaction during a Mix.Task, simply use NewRelic.Instrumented.Mix.Task. This will ensure the agent is properly started, records a Transaction, and is shut down.

defmodule Mix.Tasks.Example do
  use Mix.Task
  use NewRelic.Instrumented.Mix.Task

  def run(args) do
    # ...
  end
end

NewRelic.Instrumented.HTTPoison Automatically wraps HTTP calls in a span, and adds an outbound header to track the request as part of a Distributed Trace.

alias NewRelic.Instrumented.HTTPoison
HTTPoison.get("http://www.example.com")

Other Transactions

You may start an "Other" Transaction for non-HTTP related work. This could used be while consuming from a message queue, for example.

To start an Other Transaction:

NewRelic.start_transaction(category, name)

And to stop the Transaction within the same process:

NewRelic.stop_transaction()

Adapters

There are a few adapters which leverage this agent to provide library / framework specific instrumentation. Note that these will eventually be replaced with telemetry based instrumentation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].