Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

dd-instrument-test-optimization

БесплатноБез исполняемых скриптовНе проверен

Sets up Datadog Test Optimization (CI test visibility, per-test traces, flaky test detection) in a repo's CI pipeline for Node.js, Python, Java/JVM, Go, Ruby…

datadog-labsот datadog-labs★ 188 звёзд на GitHub

Об этом скилле

Datadog Test Optimization

Test Optimization collects per-test traces, failure reasons, and git metadata from CI test runs so Datadog can detect flaky tests and run Test Impact Analysis. No application resource has to be created in Datadog beforehand: the test service appears automatically when a test run sends spans with a valid API key and site.

How it works

  • What turns Test Optimization on: the CI test job must either run the Datadog Test Optimization CI step (datadog/test-visibility-github-action@v3, the GitLab script, or the CircleCI orb), run the language tracer in CI Visibility mode (DD_CIVISIBILITY_ENABLED=true and DD_CIVISIBILITY_AGENTLESS_ENABLED=true with the test runner hook), or upload JUnit XML reports (datadog-ci junit upload). Having dd-trace or ddtrace installed for APM or Code Coverage does not turn Test Optimization on.
  • GitHub Actions cannot mutate NODE_OPTIONS across steps: for JavaScript and TypeScript on GitHub Actions, datadog/test-visibility-github-action@v3 exports DD_TRACE_PACKAGE (and DD_TRACE_ESM_IMPORT for Vitest), which the test step itself must wire into NODE_OPTIONS. Without that env line on the test step, no test spans are collected.
  • Containers cross an execution boundary: when a CI step runs tests through docker run or docker compose, host-level environment variables do not enter the container automatically. The Datadog variables, the runtime injection variable, and the CI provider's git/pipeline variables must be passed into the container, and prebuilt test images must use manual instrumentation inside the container.
  • Credentials: Test Optimization uses DD_API_KEY in agentless mode. Reference it from the CI provider's secret store (${{ secrets.DD_API_KEY }}, $DD_API_KEY, or $(DD_API_KEY)); never write a literal key into a workflow or config file.

Set up

Copy these steps into your reply and tick them off as you go.

  1. Inspect. In a collection of independent projects, ask which one to instrument. Read dependency manifests, test configs, and CI workflow files (.github/workflows/*.yml, .gitlab-ci.yml, .circleci/config.yml, Jenkinsfile, .buildkite/pipeline.yml, buildkite/pipeline.yml, bitbucket-pipelines.yml, .travis.yml, azure-pipelines.yml) to record:

    • Runtime and language: nodejs (JS/TS), python, java (Java/Kotlin/Scala + maven/gradle/sbt), go, ruby, dotnet, swift, or other.
    • Test framework and version: Jest (>=24.8.0 with jest-circus), Vitest (>=1.6.0), Mocha (>=5.2.0), Playwright (>=1.18.0), Cypress (>=6.7.0), Cucumber, pytest (>=3.0.0), unittest, JUnit 4 (>=4.10) / JUnit 5 (>=5.3), TestNG, Spock, Scalatest, RSpec (>=3.0.0), Minitest (>=5.0.0), go test, xUnit (>=2.2), NUnit (>=3.0), MSTest v2 (>=14), BenchmarkDotNet, or XCTest.
    • CI provider and test jobs: which workflow/job runs the tests, and whether the test command crosses into a container (docker run or docker compose).
    • Repository name (<REPO>): normalized lowercase host/owner/repo without scheme or .git (from git remote get-url origin, package.json, go.mod, pyproject.toml, or pom.xml).
    • Datadog site (<SITE>): from DD_SITE or existing Datadog config (default datadoghq.com when unset; if an invalid site is supplied, stop and ask).
    • Existing Test Optimization setup: whether the test job already runs auto-instrumentation, manual CI Visibility (DD_CIVISIBILITY_ENABLED / ddtrace-run / --ddtrace / orchestrion go test / dd-trace ci run), or datadog-ci junit upload.
  2. Check prerequisites and stop conditions.

    • Already instrumented with auto-instrumentation: make no changes and proceed to Verify and view.
    • No test runner or no CI workflow found: stop before editing, report what is missing, and ask which test command or CI provider to configure.
    • Unsupported test runner (such as Node's built-in node --test or an older framework version): stop before editing unless the user explicitly requested JUnit XML upload. Explain the two options—migrating to a supported runner (such as Vitest for Node tests) for full tracing and flaky-test management, or uploading JUnit XML reports via references/junit-xml.md—and ask which path to take.
  3. Choose the instrumentation mode.

    • When the Datadog Onboarding MCP server is connected, call Datadog:test_optimization_onboarding with the substantiated runtime, language, test_framework, build_tool (for Java), ci_provider, repo_name, instrumentation (auto by default, manual or junitxml when required), and tests_run_in_containers. When the MCP server is not connected or the tool fails, follow the bundled reference files below for the exact setup steps.
    • Whether or not the MCP tool is available, apply the exact rules in the matching reference:
      • Auto-instrumentation (recommended for GitHub Actions, GitLa
Полный SKILL.md на GitHub

Установить dd-instrument-test-optimization в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/ci-autoinstrumentation.mdreferences/junit-xml.mdreferences/manual-by-runtime.md

FAQ

Что делает скилл dd-instrument-test-optimization?

Sets up Datadog Test Optimization (CI test visibility, per-test traces, flaky test detection) in a repo's CI pipeline for Node.js, Python, Java/JVM, Go, Ruby, .NET, Swift, or JUnit XML. Configures CI auto-instrumentation or manual test tracers, forwards container variables, and checks that test events arrive. Use when asked to add, set up, enable or verify Test Optimization or CI test visibility. Not for triaging flaky tests or unblocking a failing PR; use triage-flaky-test or unblock-pr.

Как установить скилл dd-instrument-test-optimization?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dd-instrument-test-optimization запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить dd-instrument-test-optimization с