Introducing Tracing for AWS AppSync


Microservices have become the answer to the many challenges faced when building reliable, robust, and scalable applications. However, visibility through event-driven microservices is difficult to achieve due to the asynchronous nature of such architectures. Thundra’s goal is to help customers cope with the observability problem with distributed architecture composed of VMs, containers, and serverless functions – and we’re already helping hundreds of users all over the world do just that. But Thundra is continuing to search for even more improvements to make the jobs of our users even easier.

AWS AppSync is a managed service that uses GraphQL queries to query or mutate the data according to the needs of developers. It turns building scalable cloud applications into a simple process by letting developers manage data on relational or NoSQL databases, APIs, or any other data sources. Many of our customers over the years have asked Thundra to create an integration with this service to our end-to-end distributed tracing mechanism. Today, we are proud to announce that Thundra is finally able to utilize AppSync requests end-to-end, integrated with our existing distributed tracing capabilities.

In this blog, we’ll take a look at the steps you need to take to activate Thundra’s AppSync tracing, review its benefits, and share our future plans for this feature.

How to Integrate AWS AppSync with Thundra

There are different ways to activate this service. The method you need to take will depend on if you’re just starting with Thundra, or (if you already have an account) when you last updated your CloudFormation stack.

New Users

Thundra is a powerful and easy-to-start solution for achieving observability on serverless architectures. To begin,  you first need to create a new Thundra account. Our quick start guide makes the process very easy. When you create a new account, Thundra will automatically detect the new AppSync APIs after installation is complete, and will list your existing AppSync APIs in just five minutes. If you don’t want to detect your APIs automatically, you can indicate this during onboarding.

Existing Users

For existing customers, the method you should take to turn on AppSync tracing depends on how long it’s been since you updated your Thundra CloudFormation (CF) stack.

The process is a lot simpler for customers who already have a recent version of Thundra’s CF stack. If you have an older CF template version, you see a notification on Thundra Console.

 You can easily update your Thundra CF stack with one click of your mouse on the AWS Settings page. You can find details under the Update part of AWS Settings page.

If you don’t see the update button as shown in the image above, you should follow the manual update steps.  To manually update the Thundra CF stack Manual CF Stack Update document helps you.

If you have a Thundra account but haven’t created a Thundra stack before, you must create a new Thundra CloudFormation stack by following the steps described here.

How to Use Thundra to Monitor AppSync APIs

AWS AppSync has lots of impressive features thanks to the power of GraphQL and AWS. However, these useful features also came with some problems of their own. Successful monitoring is a common issue for GraphQL users, which makes it a massive problem for AppSync APIs. When you use an AppSync API, you have only one endpoint that handles all your requests, so you cannot use standard REST API tracing methods for AppSync APIs. Thundra observes your AppSync operations separately and aggregates by operation name and type, it helps to find the problematic operation and focus the problem with time-saving.

Thundra provides a useful tracing and troubleshooting solution for AppSync APIs. Using the Thundra console, you can monitor HTTP status, Requests (Schema mapping), and Resolver (Action) layers. With these useful metrics and request-based distributed tracing information, you can detect the root cause of issues that arise in your APIs.

You can easily find a problematic API or endpoint with aggregated information on average or p99 duration, or with an error count for a specific error type. You can also watch your API performance, 4XX/5XX errors, and request counts in our time graph feature.

Let’s examine how to use Thundra to achieve better AppSync APIs monitoring, step by step. In the example below, we find a DynamoDB exception; Thundra supports all resolver types, including AWS Lambda, RDS (Aurora DB), HTTP, and Elasticsearch.

To start using Thundra’s new AppSync tracing feature, open the APIs page from the left menu.

On this page, you can see details for all AppSync APIs, such as request and error counts, and AVG, P90, and P99 durations. You can easily filter or sort your AppSync APIs using the query bar or  predefined queries. Clicking on an API in the table will navigate you to its details, where you can dive deeper into endpoints and individual requests. Let’s navigate to “problematic API,” since its spans have errors.

The first place you’ll land is the endpoint list of the selected API, where you can see all endpoints of your API listed with general performance metrics, allowing you to pinpoint the endpoints with issues. To see the requests of an endpoint, you can click on its name and be navigated to the “Requests” tab, where you can see all the individual requests coming to that endpoint. In the image below, the createPersons endpoint has errors, so we’ll navigate to it.

This tab shows all API requests of the selected endpoint with its details, including time, error information, response code, and duration. You can sort and/or query these requests using properties such as error type, duration, or response code. When you click on a request, you can see the distributed trace of that request, which represents its whole life cycle.

When the trace map opens, you can see the request and related resources with duration and call count. On the right side of the map, you can see the span timeline and related information about the request, response, and error (if there is one). As you can see in the image below, the trace map has a red arrow for DynamoDB, meaning our DynamoDB operation has an error. If you click on the arrow, you will see that “DynamoDB:DynamoDBException” has occurred for this operation. To see the whole error stack, you can find the error message field under “Tags.”

You can also track your metrics via the Metrics tab.

Wrapping Up

Thundra’s AWS AppSync integration has the potential to unlock many different use cases, and is served under a new menu called “APIs.” In the future, Thundra will improve its API integration by adding request tracing for other API resources, such as API-Gateway or any type of application that resolves requests coming to a REST or GraphQL API. In addition, we’ll continue to come up with more product updates that will make observability through modern architectures even easier. Sign up with Thundra here or follow us on Twitter to tune in for upcoming news.

*** This is a Security Bloggers Network syndicated blog from Thundra blog authored by Oguzhan Gencel. Read the original post at: