binaryseed / new_relic_absinthe

Absinthe Instrumentation for the New Relic Elixir Agent
https://hex.pm/packages/new_relic_absinthe
Apache License 2.0
19 stars 13 forks source link

New Relic Absinthe

Hex.pm Version Build Status

This package adds Absinthe specific instrumentation on top of the new_relic_agent package. You may use all the built-in capabilities of the New Relic Agent!

Check out the agent for more:

Installation

Install the Hex package

defp deps do
  [
    {:new_relic_absinthe, "~> 0.1"},
    {:absinthe, "~> 1.4"},
    {:plug_cowboy, "~> 2.0"}
  ]
end

Configuration

Instrumentation

1) Setup the agent's Plug instrumentation

2) Add the Absinthe middleware

defmodule MyApp.Schema do
  use Absinthe.Schema

  def middleware(middleware, _field, _object) do
    [NewRelic.Absinthe.Middleware | middleware]
  end

  # ...
end

Tips

query MyOperationName {
  user {
    id
  }
}
resolve {MyMod, :function}
resolve &MyMod.function/3

Instead of:

resolve fn args, res ->
  MyMod.function(args, res)
end

Anonymous functions in Elixir do have a name, but they look like this: -__absinthe_type__/1-fun-1-