Skip to content

Instantly share code, notes, and snippets.

@ryancurtin
ryancurtin / scout_apm_absinthe_plug.ex
Last active December 18, 2021 14:52 — forked from percygrunwald/scout_apm_absinthe_plug.ex
Scout Absinthe (GraphQL) Instrumentation
defmodule ReaperWeb.Plugs.ScoutApmAbsinthe do
@moduledoc """
This plug allows us to add context to our GraphQL requests in Scout.
We are intuiting the operation name from the query itself and attaching it
to a Scout layer
"""
alias ScoutApm.Internal.Layer
alias Reaper.MetaLogger, as: Logger
class CustomersController < ApplicationController
include CustomersHelper
def lookup_phone
customer_data = Customer.customer_data_by_type('phone', params[:PhoneNumber])
reset_device(customer_data)
Customer.customer_data_to_json(customer_data)
end
def lookup_account_id