Skip to main content

Pokeshop API and SigNoz

Tracetest is a testing tool based on OpenTelemetry that allows you to test your distributed application. It allows you to use data from distributed traces generated by OpenTelemetry to validate and assert if your application has the desired behavior defined by your test definitions.

SigNoz is an open-source observability tool. A single tool for all your observability needs - APM, logs, metrics, exceptions, alerts, and dashboards powered by a powerful query builder.

Pokeshop API is a testing ground, the team at Tracetest has implemented a sample instrumented API around the PokeAPI.

Pokeshop API with SigNoz, OpenTelemetry and Tracetest​

This is a simple quick start guide on how to configure a fully instrumented API to be used with Tracetest for enhancing your E2E and integration tests with trace-based testing. The infrastructure will use SigNoz as the trace data store and the Pokeshop API to generate the telemetry data.

Prerequisites​

Tracetest Account:

Docker: Have Docker and Docker Compose installed on your machine.

Run This Quckstart Example​

The example below is provided as part of the Tracetest project. You can download and run the example by following these steps:

Clone the Tracetest project and go to the SigNoz Pokeshop Quickstart:

git clone https://github.com/kubeshop/tracetest
cd tracetest/examples/tracetest-signoz-pokeshop

Follow these instructions to run the quick start:

  1. Copy the .env.template file to .env.
  2. Fill out the TRACETEST_TOKEN and ENVIRONMENT_ID details by editing your .env file.
  3. Run docker compose run tracetest-run.
  4. Follow the links in the output to view the test results.

Follow along with the sections below for an in detail breakdown of what the example you just ran did and how it works.

Project Structure​

The project contains the Tracetest Agent, and the Pokeshop Demo app.

The docker-compose.agent.yaml file in the root directory of the quick start runs the Pokeshop Demo app, SigNoz, and the Tracetest Agent setup.

Configuring the Pokeshop Demo App​

The Pokeshop API is a fully instrumented REST API that makes use of different services to mimic a real life scenario.

It is instrumented using the OpenTelemetry standards for Node.js, sending the data to the ADOT collector that will be pushing the telemetry information to both the AWS X-Ray service.

This is a fragment from the main tracing file from the Pokeshop API repo.

Configure the .env like shown below.

# Get the required information here: https://app.tracetest.io/retrieve-token

TRACETEST_TOKEN="<YOUR_TRACETEST_TOKEN>"
TRACETEST_ENVIRONMENT_ID="<YOUR_ENV_ID>"

Run Pokeshop, SigNoz, and Tracetest​

To execute the tests, run this command:

docker compose run tracetest-run

This will:

  1. Start the Node.js app, the OpenTelemetry Collector, and send the traces to Signoz.
  2. Start the Tracetest Agent.
  3. Configure the SigNoz tracing backend and create tests in your environment.
  4. Run the tests.

The output of the test will look similar to this:

Configuring Tracetest
SUCCESS Successfully configured Tracetest CLI
Running Trace-Based Tests...
✔ RunGroup: #RLG4_lCSR (https://app.tracetest.io/organizations/ttorg_e66318ba6544b856/environments/ttenv_4b0e8945dbe5045a/run/RLG4_lCSR)
Summary: 1 passed, 0 failed, 0 pending
✔ Pokeshop - Import (https://app.tracetest.io/organizations/ttorg_e66318ba6544b856/environments/ttenv_4b0e8945dbe5045a/test/ZVJwkpC4g/run/1/test) - trace id: 538981f2be22430a3ec260772ed00c83
✔ All HTTP Spans: Status code is 200
✔ Validate that this span always exists after the message queue
✔ Validate that Redis is using Charizard.
✔ Validate that the Postgres has Charizard.

View Trace Spans Over Time in SigNoz​

To access a historical overview of all the trace spans the Pokeshop Demo app generates, jump over to SigNoz. With SigNoz and Tracetest, you get the best of both worlds. You can run trace-based tests and automate running E2E and integration tests against real trace data. And, use SigNoz to get a historical overview of all traces your distributed application generates.

honeycomb

Learn More​

Please visit our examples in GitHub and join our Slack Community for more info!