Skip to content

ManuelPalenzuelaDD/test-visibility-circleci-orb

Repository files navigation

Datadog Test Visibility CircleCI Orb

TODO: Test mkdir datadog and api key

CircleCI orb that installs and configures Datadog Test Visibility. Supported languages are .NET, Java, Javascript, and Python.

About Datadog Test Visibility

Test Visibility provides a test-first view into your CI health by displaying important metrics and results from your tests. It can help you investigate and mitigate performance problems and test failures that are most relevant to your work, focusing on the code you are responsible for, rather than the pipelines which run your tests.

Usage

  1. Add the DD_API_KEY environment variable to your CircleCI project settings with the value of your Datadog API key.

  2. Execute this command orb as part of your CircleCI job YAML before running the tests. Set the languages and site parameters:

version: 2.1

orbs:
 test-visibility-circleci-orb: datadog/test-visibility-circleci-orb@1

jobs:
 test:
   docker:
     - image: python:latest
   steps:
     - checkout
     - run: pip install pytest
     - test-visibility-circleci-orb/autoinstrument:
         languages: python
         site: datadoghq.com
     - run: pytest

Configuration

The orb has the following parameters:

Name Description Required Default
languages List of languages to be instrumented. Can be either "all" or any of "java", "js", "python", "dotnet" (multiple languages can be specified as a space-separated list). true
site Datadog site. See https://docs.datadoghq.com/getting_started/site for more information about sites. false datadoghq.com
service The name of the service or library being tested. false
dotnet_tracer_version The version of Datadog .NET tracer to use. Defaults to the latest release. false
java_tracer_version The version of Datadog Java tracer to use. Defaults to the latest release. false
js_tracer_version The version of Datadog JS tracer to use. Defaults to the latest release. false
python_tracer_version The version of Datadog Python tracer to use. Defaults to the latest release. false
java_instrumented_build_system If provided, only the specified build systems will be instrumented (allowed values are gradle and maven). Otherwise every Java process will be instrumented. false

Additional configuration

Any additional configuration values can be added directly to the job that runs your tests:

jobs:
  test:
    docker:
      - image: python:latest
    steps:
      - checkout
      - run: pip install pytest
      - run: |
          echo "export DD_API_KEY=$YOUR_API_KEY_SECRET" >> $BASH_ENV
          echo "export DD_ENV=staging-tests" >> $BASH_ENV
          echo "export DD_TAGS=layer:api,team:intake,key:value" >> $BASH_ENV
      - test-visibility-circleci-orb/autoinstrument:
          languages: python
          site: datadoghq.com
      - run: pytest

Limitations

Tracing vitest tests

ℹ️ This section is only relevant if you're running tests with vitest.

To use this script with vitest you need to modify the NODE_OPTIONS environment variable adding the --import flag with the value of the DD_TRACE_ESM_IMPORT environment variable.

jobs:
  test:
    docker:
      - image: node:latest
    steps:
      - checkout
      - run: pip install pytest
      - test-visibility-circleci-orb/autoinstrument:
          languages: python
          site: datadoghq.com
      - run: echo "export NODE_OPTIONS=\"$NODE_OPTIONS --import $DD_TRACE_ESM_IMPORT\"" >> $BASH_ENV
      - run: npm run test

Important: vitest and dd-trace require Node.js>=18.19 or Node.js>=20.6 to work together.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages