Skip to content

Latest commit

 

History

History

quick-start-sumologic-nodejs

Quick Start - Node.js app with Sumo Logic and Tracetest

Read the detailed recipe for setting up Sumo Logic with Tractest in our documentation.

This is a simple quick start on how to configure a Node.js app to use OpenTelemetry instrumentation with traces and Tracetest for enhancing your e2e and integration tests with trace-based testing. The infrastructure will use Sumo Logic as the trace data store, and the Sumo Logic distribution of the OpenTelemetry Collector to receive traces from the Node.js app and send them to Sumo Logic.

Steps to run Tracetest

1. Start the Tracetest Agent locally

  • Sign up on app.tracetest.io.
  • Create a new environment.
  • Copy the start command under Settings > Agent.
tracetest start --api-key <YOUR_API_KEY>

Once started, Tracetest Agent will:

  • Expose OTLP ports 4317 (gRPC) and 4318 (HTTP) for trace ingestion.
  • Be able to trigger test runs in the environment where it is running.
  • Be able to connect to a trace data store that is not accessible outside of your environment. Eg. a Sumo Logic OpenTelemetry Collector instance running in the cluster without an ingress controller.

Configure Sumo Logic as a Tracing Backend:

  • Configure the Tracetest CLI by creating an environment token under Settings > Tokens.
tracetest configure -t <YOUR_API_TOKEN>
  • Add your Sumo Logic AccessID and AccessKey to tracetest.datastore.yaml
  • Apply the tracing backend configuration
tracetest apply datastore -f ./tracetest.datastore.yaml
  • Configure the OpenTelemetry Collector (collector.config.yaml) with a Sumo Logic installation token.

Note: Here's a guide which Sumo Logic API endpoint to use: https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use

2. Start Node.js App

You can run the example with Docker.

Docker Compose

Set the env vars in docker-compose.yaml as follows:

  • OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4317
docker compose up --build

3. Run tests

tracetest run test -f ./test-api.yaml

Steps to run Tracetest Core

1. Start Node.js App and Tracetest Core with Docker Compose

Set the env vars in docker-compose.yaml as follows:

  • OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4317
docker compose -f ./docker-compose.yaml -f ./tracetest/docker-compose.yaml up --build

2. Run tests

Once started, you will need to make sure to trigger tests with correct service names since both the Node.js app and Tracetest Core are running in the same Docker Network. In this example the Node.js app would be at http://app:8080. View the ./test-api.yaml for reference.


Feel free to check out the docs, and join our Slack Community for more info!