Naar hoofdinhoud gaan
GraphQL is de Ruby-gem voor GraphQL-servers. AppSignal ondersteunt de GraphQL-gem via de ingebouwde instrumentatiemodule in de GraphQL-gem.

Instrumentatie

Om uw GraphQL-app te instrumenteren met AppSignal, laadt u de AppSignal-middleware in uw schema.
# TODO: Change the schema class to your schema class
class MySchema < GraphQL::Schema
  trace_with(GraphQL::Tracing::AppsignalTrace)
end

Namespace en actie aanpassen

U kunt de instrumentatiehelpermethoden van AppSignal gebruiken om uw instrumentatie verder aan te passen. In het onderstaande voorbeeld groeperen we de requests op namespace en actienaam:
class GraphqlController < ApplicationController
  def create
    result = MySchema.execute(params[:query], :variables => params[:variables], :context => {})
    render :json => result
  ensure
    # Customize the namespace
    Appsignal::Transaction.current.set_namespace("graphql")
    # Customize the action name based on the operationName, if any
    Appsignal::Transaction.current.set_action(params[:operationName] || "Unknown")
  end