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★ 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=trueandDD_CIVISIBILITY_AGENTLESS_ENABLED=truewith the test runner hook), or upload JUnit XML reports (datadog-ci junit upload). Havingdd-traceorddtraceinstalled for APM or Code Coverage does not turn Test Optimization on. - GitHub Actions cannot mutate
NODE_OPTIONSacross steps: for JavaScript and TypeScript on GitHub Actions,datadog/test-visibility-github-action@v3exportsDD_TRACE_PACKAGE(andDD_TRACE_ESM_IMPORTfor Vitest), which the test step itself must wire intoNODE_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 runordocker 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_KEYin 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.
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, orother. - 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 runordocker compose). - Repository name (
<REPO>): normalized lowercasehost/owner/repowithout scheme or.git(fromgit remote get-url origin,package.json,go.mod,pyproject.toml, orpom.xml). - Datadog site (
<SITE>): fromDD_SITEor existing Datadog config (defaultdatadoghq.comwhen 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), ordatadog-ci junit upload.
- Runtime and language:
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 --testor 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.
Choose the instrumentation mode.
- When the Datadog Onboarding MCP server is connected, call
Datadog:test_optimization_onboardingwith the substantiatedruntime,language,test_framework,build_tool(for Java),ci_provider,repo_name,instrumentation(autoby default,manualorjunitxmlwhen required), andtests_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
- When the Datadog Onboarding MCP server is connected, call
Установить dd-instrument-test-optimization в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic