Pushing trace data to Graph Manager

Apollo Graph Manager can ingest operation traces from your GraphQL server to provide performance metrics for your data graph. A trace corresponds to the execution of a single GraphQL operation, including a breakdown of the timing and error information for each field that's resolved as part of the operation.

Trace reporting enables you to visualize:

  • Which operations are being executed
  • Which clients are executing which operations
  • Which parts of the schema are used most
  • Which of your resolvers in the server are acting as bottlenecks

Pushing traces from Apollo Server

Apollo Server has built-in support for pushing traces to Graph Manager. To set it up, you provide it a graph API key from Graph Manager.

A graph API key is different from a personal API key. It grants access only to the graph it's associated with. Personal API keys do not allow trace reporting.

How to obtain a graph API key

Graph API keys are secret credentials. Never share them outside your organization or commit them to version control. Delete and replace API keys that you believe are compromised.

  1. Go to engine.apollographql.com and select the graph you want to generate an API key for.
  2. Open the graph's Settings page and scroll down to the API Keys section. Click Create New Key.
  3. Optionally click the ?? " button to the right of the API key to give it a name, such as Production. This helps you keep track of each API key's use.

After you obtain a graph API key, assign it to the ENGINE_API_KEY environment variable in your production server's environment.

Now the next time you start your production server, it will automatically begin pushing trace data to Graph Manager as shown in the screenshot attached:

apollo graphql: pushing trace data to graph manager image

You can also push trace data from environments besides production, such as a staging or beta server.

Previous: Schema validation
Next: Segmenting metrics by client

Follow us on Facebook and Twitter for latest update.