Apr 3

Enhancing Context with Clients and Users

Blog post's hero image

When operating an API, maximizing event context is crucial. Whether you’re investigating errors, slow performance, or traffic patterns, the more context you have, the quicker you can draw conclusions and take action.

Often you only have event volume. How many errors there are, how many requests are slow, and how many times a query is being made. On its own, however, event volume isn’t indicative of the impact because it doesn’t tell you the scale. A flood of errors impacting all of your users is likely worse than a flood of events impacting a single user

Maximizing context for GraphQL API events is no different. That’s why today we’re bringing clients and users to Stellate, two of the most effective datapoints at helping you understand event scale.

Clients

There’s no shortage of use cases where it’s important to understand where an API is being used. This includes which clients are requesting a field, which clients are seeing errors, which clients are seeing performance issues, and more. Perhaps even more importantly, especially for orgs with mobile apps, is the client version.

To populate the client name and version in the Stellate dashboard, include x-graphql-client-name and x-graphql-client-version headers when instantiating your GraphQL client, as shown in our docs.

const client = createClient({
url: "your-graphql-url",
fetchOptions: {
headers: {
"x-graphql-client-name": CLIENT_NAME,
"x-graphql-client-version": CLIENT_VERSION,
},
},
});

Once you begin providing the client version, you’ll see it across the Stellate dashboard, such as in operations, errors, schema insights, and more.

Users

When diagnosing an issue, you immediately want to know whether users are impacted and at what scale. Now with Stellate, you can. With the user property in the Stellate config, you can indicate how a user is represented requests, whether it be a header value or a JWT claim. We use the unique value to determine things such as what % of users are seeing a specific error or experiencing high latency.

Similar to clients versions, once you configure user tracking, you’ll see it across the Stellate dashboard.

The Big Picture

When you combine users and clients, you can take it even further. You’ll be able to understand things like what % of users on v5 of your iOS client are still requesting a field you’d like to deprecate. There’s no shortage of ways that bringing this data together can bring more context into operating your API.