Join us for GraphQL Summit, October 10-12 in San Diego. Use promo code ODYSSEY for $400 off your pass.
Launch GraphOS Studio
Apollo Server 2 is officially deprecated, with end-of-life scheduled for 22 October 2023. Additionally, certain features are end-of-life as of 31 December 2023. Learn more about these deprecations and upgrading.

API Reference: Inline trace plugin

Using the plugin

This API reference documents the ApolloServerPluginInlineTrace plugin.

This plugin enables your GraphQL server to include encoded performance and usage traces inside responses. This is primarily designed for use with Apollo Federation. Federated s use this plugin and include a trace in the ftv1 GraphQL response extension if requested to do so by the Apollo gateway. The gateway requests this trace by passing the HTTP header apollo-federation-include-trace: ftv1.

Apollo Server installs this plugin by default in all federated s, with its default configuration. (Apollo Server decides that it is a federated subgraph if the it is serving includes a _Service.sdl: String.) You typically do not have to install this plugin yourself; you only need to do so if you want to provide non-default configuration.

If you want to configure this plugin (or if you want to use it in a graph that is not a federated ), import it from the apollo-server-core package and pass it to your ApolloServer in the plugins array:

import { ApolloServer } from "apollo-server";
import { ApolloServerPluginInlineTrace } from "apollo-server-core";
const server = new ApolloServer({
plugins: [
rewriteError: (err) => err.message.match(SENSTIVE_REGEX) ? null : err,

If you don't want to use the inline trace plugin even though your defines _Service.sdl: String, you can explicitly disable it with the ApolloServerPluginInlineTraceDisabled plugin:

import { ApolloServer } from "apollo-server";
import { ApolloServerPluginInlineTraceDisabled } from "apollo-server-core";
const server = new ApolloServer({
plugins: [ApolloServerPluginInlineTraceDisabled()],

Note that when this plugin is installed in your app, any client can request a trace for any they run, which may reveal information about your server that you consider sensitive (such as how long each individual takes to execute). Federated s generally should not be directly exposed to the public Internet.

(Note: in addition to this plugin (which adds a base64-encoded trace to the ftv1 extension of responses), Apollo Server also contains support for an older JSON-based format which is enabled if you pass tracing: true to the ApolloServer constructor. This format was designed for use with a no longer supported tool called engineproxy, and also is recognized by graphql-playground. This format was more verbose due to its use of JSON and the way that it represented trace node IDs. Enabling it is not recommended.)

This plugin was introduced in Apollo Server 2.18. In previous versions, inline tracing was configured using the engine option to the ApolloServer constructor. That option continues to work; see the migration guide for details.


Name /


By default, all errors from this service get included in the trace. You can specify a filter function to exclude specific errors from being reported by returning an explicit null, or you can mask certain details of the error by modifying it and returning the modified error. This function has type (GraphQLError) => GraphQLError | null.

Schema reporting plugin
Edit on GitHubEditForumsDiscord