Join us from October 8-10 in New York City to learn the latest tips, trends, and news about GraphQL Federation and API platform engineering.Join us for GraphQL Summit 2024 in NYC
Docs
Start for Free

Monitoring a Federated Graph

Learn about operation metrics and monitoring strategies


As with any distributed architecture, a federated introduces more complexity than its monolithic counterpart. To help address this complexity and improve reliability, you should make sure that your federated graph has proper observability, monitoring, and automation in place.

This article describes Apollo features that help you monitor and debug your graph.

Metrics and observability

Federated can push metrics to to enable many powerful tools, including:

With a federated graph, your pass trace data (timing and error information for each resolved schema ) to the gateway for every operation. The gateway then pushes that data to Studio:

Pushes traces
Passes traces
Passes traces
Passes traces
Gateway
Products subgraph
Reviews subgraph
Inventory subgraph
GraphOS Studio

NOTE

Individual subgraphs do not push trace data directly to Studio.

Traces are displayed in Studio in the shape of the , with each unique fetch to a reporting timing and error data.

-level statistics are still collected for operations sent by clients, and those operations are validated as part of .

Setup

To enable federated tracing, you set the APOLLO_KEY environment variable in your gateway's environment. Do not set this environment variable for your .

If other features require you to set APOLLO_KEY in your subgraph servers, disable usage reporting in those servers.

Also ensure that all instances of in your graph are using an up-to-date version of the @apollo/server library.

Inspecting your subgraphs

View basic details for the subgraphs that make up your federated graph with the Rover CLI's rover subgraph list command:

$ rover subgraph list docs-example-graph@production
Listing subgraphs for docs-example-graph@production using credentials from the default profile.
┌──────────┬───────────────────────────────┬────────────────────────────┐
│ Name │ Routing Url │ Last Updated │
├──────────┼───────────────────────────────┼────────────────────────────┤
│ products │ http://localhost:4001/graphql │ 2020-12-18 10:29:14 -08:00 │
├──────────┼───────────────────────────────┼────────────────────────────┤
│ reviews │ http://localhost:4002/graphql │ 2020-12-18 10:28:59 -08:00 │
└──────────┴───────────────────────────────┴────────────────────────────┘
View full details at https://studio.apollographql.com/graph/docs-example-graph/service-list

This command includes a link to an GraphOS Studio page that provides additional information about your subgraphs.

If you're using the Apollo CLI, run apollo service:list instead.

Previous
Caching
Next
Query Plans
Rate articleRateEdit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc., d/b/a Apollo GraphQL.

Privacy Policy

Company