> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appsignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GraphQL

[GraphQL](https://graphql-ruby.org/) ist das Ruby-Gem für GraphQL-Server. AppSignal unterstützt das GraphQL-Gem über das integrierte Instrumentation-Modul im GraphQL-Gem.

## Instrumentation

Um Ihre GraphQL-App mit AppSignal zu instrumentieren, laden Sie die AppSignal-Middleware in Ihrem Schema.

<CodeGroup>
  ```ruby Ruby theme={null}
  # TODO: Change the schema class to your schema class
  class MySchema < GraphQL::Schema
    trace_with(GraphQL::Tracing::AppsignalTrace)
  end
  ```
</CodeGroup>

* Referenz: [GraphQL AppSignal docs](https://graphql-ruby.org/queries/tracing.html#appsignal).

## Namespace und Action anpassen

Sie können die Helper-Methoden der AppSignal-Instrumentation verwenden, um Ihre Instrumentation weiter anzupassen. Im folgenden Beispiel gruppieren wir die Anfragen nach [Namespace](/guides/namespaces) und Action-Name:

<CodeGroup>
  ```ruby Ruby theme={null}
  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
  ```
</CodeGroup>
