2 minutes read

POSTED Feb, 2022 dot IN Debugging

Monitor CI/CD Workflows With Thundra Foresight’s Python Support

Gokhan Simsek

Written by Gokhan Simsek


Software Engineer

linkedin-share
 X

We all have known that challenges come with growing your product.  Your active users are increasing, ingested and digested data becomes enormous and etc. This has been driving the companies to divide their infrastructure and source codes into logical small pieces. But, this is just the tip of the iceberg. This solution brings its own issues within and one of the most modern ways to solve it is called continuous integration and continuous delivery.

GitHub is one of the most well-known CI/CD platforms. It supports hosting code, versioning, collaboration, and automation of continuous delivery by using GitHub actions. These are pretty lifesaver features but monitoring multiple repositories and workflows over GitHub could become a hell. You always have to smurf between a lot of pages before getting the valuable information.

That is where Thundra Foresight gets the stage and dazzles you with its pretty-looking beautiful UIs. Thundra Foresight brings all your workflows at your hand to access them easily. In this post, we are going to mention how to smoothly integrate Thundra Foresight with GitHub Actions for Pytest by using Fastapi which has been becoming a very popular web framework among Python developers with its asynchronous endpoint support thanks to Starlette, embedded openapi schema to test your endpoints over web browser easily and well-organized data schema and validation with Pydantic.

Integration of Thundra Foresight

1-) Retrieving THUNDRA_APIKEY and THUNDRA_PROJECT_ID

Adding Thundra Foresight into your GitHub Actions is pretty simple. You only need to add 2 values to add Foresight into your CI pipeline; which are THUNDRA_APIKEY and THUNDRA_PROJECT_ID. After signing up/logging into Thundra and continuing with Thundra Foresight from the following page, just click the “Connect repositories” button and create your project. Then, open the “Repositories” from the top right corner and find the project that has been created. On the right side of your project name, click on the little three dots and navigate to “Get your API Key and Project ID”.

2-)  Update GitHub Action yml with Thundra Foresight GitHub Action

After retrieving your THUNDRA_APIKEY and THUNDRA_PROJECT_ID and setting them as GitHub secrets, there is only one step left to see your workflow on Thundra Foresight. It is adding Thundra Foresight GitHub Actions to the steps in the workflow yml. The following code is the basic GitHub action workflow step to activate Thundra Foresight.


- name: Install Thundra Python Agent
uses: thundra-io/thundra-foresight-python-action@v1
with:
apikey: $
project_id: $

        The default framework option is “Pytest”. That is why the framework option has not been set in this example. For more information about settings parameters, you can visit our documentation. The following screen displays the full yml file.

3-) Navigating Thundra Foresight Web Page

After integrating Thundra Foresight GitHub action with your GitHub workflow and running your tests, The card widget has been shown under your project on the Thundra Foresight console.

Now, you can see the overall latest test run details on the corresponding card widget.

In order to see an overview of your test run, you can click the card and this brings you to “Test Run Overview” screen. This page depicts test run overall execution time, the number of successful, failed, skipped, and aborted tests, the name of the platform where your test ran and pre-aggregated results as “most erroneous test suites” or “Slowest Test Suites”.

Thundra Foresight also supports analyzing test cases and test suites individually. You can search for specific test cases from the search box with the test case name and get whole information about execution in Performance metrics, logs, and screenshots of your test cases.  

For the supporting libraries and frameworks, you can even see the flow of your architecture by smurfing the “Trace Map” web page. You can see which framework or libraries triggered first and on which level your test cases have bugs or flaws. If you need to enrich your observation on your projects, you can also take a glance at Thundra APM.

Summary

Thundra Foresight is not only an application that brings you details of your test runs but also helps you to understand the overall flow of your architecture and detect flaws in your projects. In addition to Python, We also support NodeJs and Java languages. You can visit our documentation to learn more about our products.