GraphQL Business Transactions
GraphQL is a query and schema definition language that allows servers to expose an API over a HTTP endpoint. You specify the required data in the request payload and send all the requests from the client to a server endpoint.
AppDynamics supports GraphQL when used with the
express-graphql module, view GraphQL HTTP Server Middleware.
- On the server side, you define a schema that describes the data and available operations on said data.
- Then, you invoke operations defined by the schema to retrieve data (through URL requests that receive GraphQL queries) and mutate it.
In the current model, the Node.js Agent identifies an individual Business Transaction from the various requests coming to the server, but the agent does not capture the request payload.
GraphQL Business Transactions determines the business transaction through the incoming endpoint and incoming GraphQL payload, allowing further visibility into the GraphQL Node.js applications. Every GraphQL query that matches this URL is aggregated into one Business Transaction. With GraphQL Business Transactions, the Node.js Agent can be configured in the Controller to identify if an incoming business transaction matches a specific URI (for example, starting with
/QL) and split that transaction with an operation into multiple transactions.
By default, GraphQL Business Transactions is disabled. To configure the Node.js Agent to enable GraphQL Business Transactions, set
true in the call to
Once GraphQL Business Transactions is enabled, you can configure a GraphQL custom match rule for a Node.js application:
- In the Controller, select Configuration > Instrumentation > Transaction Detection.
- Click Add Rule > Summary > Custom Match Rule.
- Select Node.js in the Agent Type dropdown. Click Next.
- Enter a name for the match rule and ensure that the enabled checkbox is checked.
- Click Select Scope and select the desired scope for the rule. Click OK.
Next, navigate to Rule Configuration > HTTP Request Match Criteria and click Add.
Select URI as the criteria and choose the desired operation from the dropdown list. Then, enter the desired value for the GraphQL incantation (for example, the URL prefix).
- Navigate to Split Transactions Using Request Data and click the Split Transactions Using Request Data checkbox.
- Select the graphql operation name from the dropdown and select Save.
Upon configuring the rule and sending a GraphQL queries in your application, the Business Transactions page displays separate transactions.