GraphQL Schema Registry
The Stellate Schema Registry is a collection of Dashboard pages that give you metrics information, but from a schema perspective. By selecting the Schema Registry tab in the Dashboard, you can actually understand how your users are using your graph or how your operations use your schema specifically.
Just like GraphQL Metrics, the Schema Registry operates out-of-the-box. As soon as you begin using the metrics plugin and start sending data, you’ll be able to observe your requests flowing in and your metrics. At this point, you should also be able to see Schema Registry data.
Schema Registry Benefits
As a centralized schema repository, the Schema Registry makes it simple to track changes and ensure consistency across different versions of the schema. It provides a comprehensive view of the schema structure, including types, fields, and relationships, allowing you to understand and analyze the schema evolution over time.
The Stellate Schema Registry offers several benefits that make it a valuable tool for understanding GraphQL schemas:
- Centralized Repository: The Schema Registry serves as a centralized location to store and organize your GraphQL schema definitions. It provides a single source of truth for your schema, making it easier to track changes.
- Schema Diffs: With the Schema Registry, you can understand what changed between different schema versions. You can track changes made to the schema, such as adding or removing fields, introducing new types, or deprecating existing ones. This allows you to track and compare changes over time, ensuring that you have a clear understanding of how your schema has evolved.
- Collaboration and Consistency: The Schema Registry promotes collaboration among teams working on the same GraphQL schema. Teams can easily see the current schema, changes to it, and see a list of prior schemas.
Use the Schema Registry in the Dashboard
You can use the Stellate Dashboard UI to perform tasks such as viewing metrics, schema versions, and viewing your schema elements. To use the Stellate Schema Registry:
- Sign in to your Stellate account: Go to the Stellate website and sign in using your credentials.
- Navigate to your Stellate Services and click on your Service.
- Click on the Schema tab.
- Click on one of the following Schema Registry options in the left navigation bar:
- Insights - Displays information about your schema operations, types, and fields.
- Versions - Shows a list of your schema versions.
- Explorer - Provides views of your schema elements by type or field with filters for least and most used, least and most errors, and lowest and highest CHR.
All of these options include the following controls, located on the right side of the page:
- Filter menu. Click this menu to filter by Cache Name, Operation Name, Scopes and many more filter options.
- Time Frame menu. Click the time frame menu to see data from the last 15 minutes to the last 30 days.
If you encounter any difficulties or have specific questions, reach out to customer service for further assistance.
Schema Insights
Once you have navigated to the Schema Registry, click schema Insights (in the left Nav) to get the schema metrics highlights. You can view these metrics to improve your understanding of your schema usage.
Insight Views for Types, Fields, and Operations
Select the Types tab to view a list of schema types. This view lets you analyze types by Most used, Highest latency, Highest error rate and what Types are used or unused in the schema.
In the following illustration, we see that the Order type has the highest latency. You can leverage this information to see what to optimize. By going through the type metrics, you can reduce latency, analyze and fix types with high error rates, and track what types are most used.
You can also click on an items such as Order to drill down and get more granular information. For example, in the following illustration, we can view details about the Order type in our schema and discover if we need to modify it.
You can drill down again into the information and get deeper insights by clicking on the items under Fields. This gives you the ability to understand your schema at a very deep level of detail. Take the time to click various entries and labels to discover different views of the data.
You can view and analyze similar information for schema fields and operations. Just select each tab to see the metrics. These schema-based metrics views, give you the power to optimize your schema and queries.
The Fields view provides a similar details view as Types providing a granular look at the metrics for a particular field.
When you drill down on an operation in the the Operations view, it displays a Query panel containing the query in the Config Editor, so you can see the query structure.
Note: The Operations detail page also allows you to purge the cache. Use care when selecting that option.
Schema Version Information
In the left navigation bar, click schema Versions to view and different versions of your schema. You can track changes and compare versions to see the differences in each version over time.
Schema Versions - in this panel you can view a schema and click on another schema to see the changes in that schema. For each schema version there is an associated schema change panel providing change information about that version. You can check a specific schema to see a breaking change and when it occurred.
Schema Changes - this panel lets you see breaking changes, schema updates, and fields added on various types.
Detail Views with Schema Explorer
In the Schema Registry, click the schema Explorer (in the left Nav) to get detailed views of your GraphQL schema, allowing you to navigate and understand the structure and usage of your API.
The Schema Explorer includes both types and fields pages to allow you to easily see and dive deep into your schema’s types, fields, and operations. It provides insights into how each element is used and how they perform. Use the insights gathered to make informed decisions about schema optimizations and changes. The Schema Explorer includes the Filter menu and Time Frame menu as described in the prior section. The Schema Explorer also includes the Search field to enable you to search both by type and by field.
Explore your schema by clicking on types and fields to see detailed information, including request counts, error counts, and operations that use specific types or fields.
Explore Schema Type Details
In the context of GraphQL, types define the shape and capabilities of the data you can query from your API. Types can be objects, scalars, enums, interfaces, or unions. Each type is made up of fields that you can query or that define the data structure.
In the left navigation bar, click schema Explorer to view all of your schema types and get detailed schema information. The Types view lets you look at Type information to see Errors, Cache Hit Rates (CHR), Requests and what operations are using those requests.
Details - The Details panel provides an overview ofthe following options:
- Last Seen.
- Origin Response time in milliseconds.
- Cache Response time in milliseconds.
The Details panel also includes lists of Fields, Operations, Mutations. Click on entries for any of these items to get finer grained information about that entry.** The Details panel also includes Requests and **Errors** graphs.
Request Counts
Request counts refer to the number of times a particular field or type is requested in GraphQL operations. It is a metric that indicates the frequency of use for different parts of the schema. Request counts are important for several reasons:
- Performance Optimization: High request counts might indicate fields or types that are critical for the client-side application and may need optimization for better performance.
- Schema Evolution: Understanding which fields or types are most frequently accessed can inform decisions about evolving the schema, such as adding indexes to databases or considering the impact of deprecating certain fields.
- Resource Allocation: It helps in allocating server resources efficiently by identifying which parts of the schema are under heavy load and may require scaling.
Error Counts
The Error counts metric tracks the number of errors that occur when querying specific fields or types within a GraphQL API. Error counts are a crucial metric for maintaining the health and reliability of a GraphQL API. They help in:
- Identifying Issues: High error counts can signal problems in the resolver functions, data sources, or schema definitions that need to be addressed.
- Improving User Experience: By monitoring and reducing error rates, developers can enhance the overall user experience of the client applications consuming the API.
- Alerting and Monitoring: Setting up alerts based on error thresholds can help teams respond quickly to issues and maintain the API’s uptime.
Explore Schema Field Views
Field Search is a feature within the Stellate Schema Explorer that allows you to quickly find and analyze specific fields within your schema. It shows you key data points such as field name, type, and request count. Clicking on a field takes you to a detailed panel (as described in the prior section) where you can see more information, helping you to understand the impact and usage of that field across your API.
Fields: Fields are the individual data points within a type that you can request in a GraphQL query. They represent the properties or attributes of a type and can themselves be of a scalar type (like String
, Int
, etc.) or an object type (which has its own sub-fields).
Field search makes it easier to explore your schema. You can search for the product by specific terms such as slug on the query. For example: