Skip to content

POC - Triggerable SMP experiments - #53646

Closed
cmetz100 wants to merge 1 commit into
mainfrom
cmetz/test_comment
Closed

POC - Triggerable SMP experiments#53646
cmetz100 wants to merge 1 commit into
mainfrom
cmetz/test_comment

Conversation

@cmetz100

@cmetz100 cmetz100 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Modifies SMP experiment structure and adds the ability to select additional experiments to run

Motivation

Gives users the ability to run suites of experiments on demand but not by default on all PRs

Describe how you validated your changes

Additional Notes

No need for review, using this PR to test

@github-actions

Copy link
Copy Markdown
Contributor

@codex review

@dd-octo-sts dd-octo-sts Bot added the internal Identify a non-fork PR label Jul 14, 2026
@github-actions github-actions Bot added the short review PR is simple enough to be reviewed quickly label Jul 14, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 3a084fb1ad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Files inventory check summary

File checks results against ancestor c3617ab2:

Results for datadog-agent_7.83.0~devel.git.98.47f1234.pipeline.126898258-1_amd64.deb:

No change detected

@github-actions github-actions Bot added medium review PR review might take time and removed short review PR is simple enough to be reviewed quickly labels Jul 14, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Gitlab CI Configuration Changes

Updated: .gitlab-ci.yml

Added Jobs

smp-experiment-selection-comment
smp-experiment-selection-comment:
  allow_failure: true
  artifacts:
    expire_in: 1 day
    paths:
    - comment_body.md
    when: always
  id_tokens:
    DDOCTOSTS_ID_TOKEN:
      aud: dd-octo-sts
  image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$CI_IMAGE_DOCKER_X64_SUFFIX:$CI_IMAGE_DOCKER_X64
  needs: []
  rules:
  - if: $E2E_COVERAGE_PIPELINE == "true"
    when: never
  - if: $CI_COMMIT_BRANCH == "main"
    when: never
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\.[0-9]+\.x$/
    when: never
  - if: $CI_COMMIT_BRANCH =~ /^mq-working-branch-/
    when: never
  - if: $CI_COMMIT_TAG != null
    when: never
  - changes:
      compare_to: $COMPARE_TO_BRANCH
      paths:
      - go.mod
      - go.sum
      - cmd/**/*
      - comp/**/*
      - internal/**/*
      - pkg/**/*
      - rtloader/**/*
      - tasks/**/*.py
      - omnibus/**/*
      - release.json
      - test/regression/**/*
      - Dockerfiles/**/*
      - .gitlab/test/functional_test/regression_detector.yml
      - .gitlab/childs/smp-regression-child-pipeline.yml
  - changes:
      compare_to: $COMPARE_TO_BRANCH
      paths:
      - '**/*.bazel*'
      - deps/**/*
      - bazel/**/*
      - tasks/build_tags.bzl
  - changes:
      compare_to: main
      paths:
      - test/regression/**/*
  script:
  - "set +e\nMARKER=\"<!-- smp-experiment-selection -->\"\nROOT=\"test/regression\"\
    \n# --- Resolve PR + read the existing selection comment (best effort) ---\nGITHUB_TOKEN=$(dd-octo-sts\
    \ token --scope DataDog/datadog-agent --policy self.gitlab.comment-pr 2>/dev/null)\n\
    PR_NUMBER=\"\"\nif [ -n \"${GITHUB_TOKEN}\" ]; then\n  PR_NUMBER=$(curl -s -H\
    \ \"Authorization: Bearer ${GITHUB_TOKEN}\" \\\n    \"https://api.github.com/repos/DataDog/datadog-agent/commits/${CI_COMMIT_SHA}/pulls\"\
    \ \\\n    | jq -r '.[0].number // empty')\nfi\nif [ -z \"${PR_NUMBER}\" ]; then\n\
    \  echo \"No PR for ${CI_COMMIT_SHA}; nothing to post (dev branch without a PR).\"\
    \n  exit 0\nfi\n# Our comment is the one whose body STARTS WITH the marker (the\
    \ CI-config\n# diff comment only contains the marker inside a fenced code block).\
    \ Grab\n# its id (to edit in place) and body (to feed the CLI merge).\nCOMMENTS=$(curl\
    \ -s -H \"Authorization: Bearer ${GITHUB_TOKEN}\" \\\n  \"https://api.github.com/repos/DataDog/datadog-agent/issues/${PR_NUMBER}/comments?per_page=100\"\
    )\nCOMMENT_ID=$(printf '%s' \"${COMMENTS}\" | jq -r --arg m \"${MARKER}\" 'map(select(.body\
    \ | startswith($m))) | last | .id // empty')\nprintf '%s' \"${COMMENTS}\" | jq\
    \ -r --arg m \"${MARKER}\" 'map(select(.body | startswith($m))) | last | .body\
    \ // empty' > prev_comment.md\nset -e\n# --- Fetch the smp CLI (needs the single-machine-performance\
    \ AWS creds) ---\nAWS_NAMED_PROFILE=\"single-machine-performance\"\nSMP_BOT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh\
    \ $SMP_ACCOUNT $BOT_LOGIN) || exit $?\nSMP_BOT_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh\
    \ $SMP_ACCOUNT $BOT_TOKEN) || exit $?\naws configure set aws_access_key_id \"\
    $SMP_BOT_ID\" --profile ${AWS_NAMED_PROFILE}\naws configure set aws_secret_access_key\
    \ \"$SMP_BOT_KEY\" --profile ${AWS_NAMED_PROFILE}\naws configure set region us-west-2\
    \ --profile ${AWS_NAMED_PROFILE}\naws --profile ${AWS_NAMED_PROFILE} s3 cp s3://smp-cli-releases/${SMP_VERSION}/x86_64-unknown-linux-musl/smp\
    \ smp\nchmod +x smp\n# --- Codeowners-based preselection (best effort, POC) ---\n\
    # Pre-tick a folder when THIS PR changes files owned by that folder's\n# CODEOWNERS\
    \ team (e.g. the PR touches logs-pipeline code -> pre-tick\n# test/regression/logs).\
    \ The intersect (changed files -> teams, folder ->\n# team, using the checked-out\
    \ CODEOWNERS on both sides) lives in the\n# reusable, tested `owners.smp-preselect`\
    \ task; this job just fetches the\n# PR's changed files and calls it. Depends\
    \ only on the PR, never on main.\n# --default-select only affects rows that are\
    \ NEW in this render, so it acts\n# as a first-appearance default the developer\
    \ can still untick; the merge\n# preserves their choice thereafter. Any failure\
    \ here degrades to no\n# preselection (all folders unticked) -- never blocks the\
    \ comment.\nDEFAULT_SELECT=\"\"\nset +e\n# Fetch the PR's changed files (paginated,\
    \ up to GitHub's 3000-file cap).\n: > changed_files.txt\npage=1\nwhile :; do\n\
    \  resp=$(curl -s -H \"Authorization: Bearer ${GITHUB_TOKEN}\" \\\n    \"https://api.github.com/repos/DataDog/datadog-agent/pulls/${PR_NUMBER}/files?per_page=100&page=${page}\"\
    )\n  count=$(printf '%s' \"${resp}\" | jq 'if type==\"array\" then length else\
    \ 0 end' 2>/dev/null || echo 0)\n  printf '%s' \"${resp}\" | jq -r 'if type==\"\
    array\" then .[].filename else empty end' 2>/dev/null >> changed_files.txt\n \
    \ [ \"${count:-0}\" -lt 100 ] && break\n  page=$((page + 1)); [ \"${page}\" -gt\
    \ 30 ] && break\ndone\n# </dev/null: dda reads stdin; without it it would swallow\
    \ the block's input.\nDEFAULT_SELECT=$(dda inv owners.smp-preselect --config-dir\
    \ \"${ROOT}\" --changed-files changed_files.txt --exclude quality_gates,ebpf </dev/null\
    \ 2>/dev/null)\nset -e\necho \"Codeowners-preselected folders: ${DEFAULT_SELECT:-<none>}\"\
    \nDEFAULT_SELECT_ARG=\"\"\nif [ -n \"${DEFAULT_SELECT}\" ]; then DEFAULT_SELECT_ARG=\"\
    --default-select ${DEFAULT_SELECT}\"; fi\n# --- Render the comment. The CLI owns\
    \ discovery, the flat checkbox format,\n# and the state-preserving merge (via\
    \ --previous-comment). Only pass\n# --previous-comment when a prior comment exists\
    \ (else it's a fresh render).\nPREV_ARG=\"\"\nif [ -n \"${COMMENT_ID}\" ]; then\
    \ PREV_ARG=\"--previous-comment prev_comment.md\"; fi\n# quality_gates always\
    \ runs (force-included by the run job), so it is\n# excluded from the checklist\
    \ alongside ebpf (separate metal-runner jobs).\n# --link-base makes each folder\
    \ label a link to that folder on GitHub and\n# enables the experiment-name hover\
    \ tooltip.\n./smp experiments list \\\n  --target-config-dir \"${ROOT}\" \\\n\
    \  --exclude-path quality_gates,ebpf \\\n  --format github-comment \\\n  --link-base\
    \ \"https://github.com/DataDog/datadog-agent/tree/${CI_COMMIT_SHA}/test/regression\"\
    \ \\\n  ${PREV_ARG} \\\n  ${DEFAULT_SELECT_ARG} \\\n  --instructions \"$(printf\
    \ '%s\\n\\n%s' '\u2705 **Quality gates always run.**' 'Tick any additional suites\
    \ below; selecting a folder runs its whole subtree. Re-run the single-machine-performance-regression_detector\
    \ job to apply.')\" \\\n  > comment_body.md\ncat comment_body.md\n# --- Edit in\
    \ place if the comment exists, else create it ---\nPAYLOAD=$(jq -Rs '{body: .}'\
    \ comment_body.md)\nif [ -n \"${COMMENT_ID}\" ]; then\n  echo \"Updating existing\
    \ selection comment ${COMMENT_ID}\"\n  curl -s -X PATCH -H \"Authorization: Bearer\
    \ ${GITHUB_TOKEN}\" \\\n    \"https://api.github.com/repos/DataDog/datadog-agent/issues/comments/${COMMENT_ID}\"\
    \ \\\n    -d \"${PAYLOAD}\" -o /dev/null -w \"HTTP %{http_code}\\n\"\nelse\n \
    \ echo \"Creating selection comment on PR #${PR_NUMBER}\"\n  curl -s -X POST -H\
    \ \"Authorization: Bearer ${GITHUB_TOKEN}\" \\\n    \"https://api.github.com/repos/DataDog/datadog-agent/issues/${PR_NUMBER}/comments\"\
    \ \\\n    -d \"${PAYLOAD}\" -o /dev/null -w \"HTTP %{http_code}\\n\"\nfi\n"
  stage: functional_test
  tags:
  - arch:amd64
  - specific:true
  variables:
    BOT_LOGIN: bot_login
    BOT_TOKEN: bot_token
    SMP_VERSION: dev-pr4640-2299f1770

Changes Summary

Removed Modified Added Renamed
0 0 1 0

Updated: .gitlab/childs/smp-regression-child-pipeline.yml

Modified Jobs

.single-machine-performance-run_regression_detector
  .single-machine-performance-run_regression_detector:
    artifacts:
      expire_in: 1 weeks
      paths:
      - submission_metadata
      - outputs/report.md
      - outputs/regression_signal.json
      - outputs/bounds_check_signal.json
      - outputs/junit.xml
      - outputs/report.json
      - outputs/decision_record.md
      when: always
    before_script:
    - echo "BASELINE_SHA=${BASELINE_SHA}" > regression_detector.env
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$CI_IMAGE_DOCKER_X64_SUFFIX:$CI_IMAGE_DOCKER_X64
    retry:
      exit_codes:
      - 42
      max: 2
      when:
      - runner_system_failure
      - stuck_or_timeout_failure
      - unknown_failure
      - api_failure
      - scheduler_failure
      - stale_schedule
      - data_integrity_failure
    script:
    - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2"
      token)" || exit $?; export DATADOG_API_KEY
    - datadog-ci tag --level job --tags smp_failure_mode:"timeout"
    - mkdir outputs
    - AWS_NAMED_PROFILE="single-machine-performance"
    - "SMP_ACCOUNT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT account_id)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - SMP_ECR_URL=${SMP_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com
    - "SMP_TEAM_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT \"${SMP_TEAM_NAME}_team_id\"\
      ) || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_API=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $SMP_API_URL)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_LOGIN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_TOKEN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - aws configure set aws_access_key_id "$SMP_BOT_ID" --profile ${AWS_NAMED_PROFILE}
    - aws configure set aws_secret_access_key "$SMP_BOT_KEY" --profile ${AWS_NAMED_PROFILE}
    - aws configure set region us-west-2 --profile ${AWS_NAMED_PROFILE}
    - "aws --profile single-machine-performance s3 cp s3://smp-cli-releases/${SMP_VERSION}/x86_64-unknown-linux-musl/smp\
      \ smp || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-fetch-cli\"\n  exit $exit_code\n}\n"
    - chmod +x smp
    - source regression_detector.env
    - echo "Baseline SHA is ${BASELINE_SHA}"
    - echo -n "${BASELINE_SHA}" > "${CI_COMMIT_SHA}-baseline_sha"
    - aws s3 cp --profile single-machine-performance --only-show-errors "${CI_COMMIT_SHA}-baseline_sha"
      "s3://${SMP_TEAM_ID}-smp-artifacts/information/"
    - BASELINE_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${BASELINE_SHA}-7-full-amd64
    - echo "${BASELINE_SHA} | ${BASELINE_IMAGE}"
    - COMPARISON_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${CI_COMMIT_SHA}-7-full-amd64
    - echo "${CI_COMMIT_SHA} | ${COMPARISON_IMAGE}"
    - SMP_TAGS="ci_pipeline_id=${PARENT_PIPELINE_ID},ci_job_id=${CI_JOB_ID},ci_commit_branch=${CI_COMMIT_BRANCH},purpose=agent_ci"
    - echo "Tags passed through SMP are ${SMP_TAGS}"
    - RUST_LOG="info,aws_config::profile::credentials=error"
    - RUST_LOG_DEBUG="debug,aws_config::profile::credentials=error"
+   - EXPERIMENT_FILTER_ARG=""
+   - "if [ \"${READ_SELECTION_COMMENT:-false}\" = \"true\" ]; then\n  # Best effort:\
+     \ mint a GitHub token, resolve the PR, fetch the selection\n  # comment (the one\
+     \ whose body STARTS WITH the marker -- the CI config-diff\n  # comment only contains\
+     \ the marker inside a code block; this finder MUST\n  # match the smp-experiment-selection-comment\
+     \ writer). Any failure (no PR,\n  # octo-sts down, no comment) just leaves the\
+     \ file empty -> quality_gates.\n  set +e\n  GITHUB_TOKEN=$(dd-octo-sts token --scope\
+     \ DataDog/datadog-agent --policy self.gitlab.comment-pr 2>/dev/null)\n  PR_NUMBER=\"\
+     \"\n  if [ -n \"${GITHUB_TOKEN}\" ]; then\n    PR_NUMBER=$(curl -s -H \"Authorization:\
+     \ Bearer ${GITHUB_TOKEN}\" \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/commits/${CI_COMMIT_SHA}/pulls\"\
+     \ \\\n      | jq -r '.[0].number // empty')\n  fi\n  : > selection_comment.md\n\
+     \  if [ -n \"${PR_NUMBER}\" ]; then\n    curl -s -H \"Authorization: Bearer ${GITHUB_TOKEN}\"\
+     \ \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/issues/${PR_NUMBER}/comments?per_page=100\"\
+     \ \\\n      | jq -r 'map(select(.body | startswith(\"<!-- smp-experiment-selection\
+     \ -->\"))) | last | .body // empty' > selection_comment.md\n  fi\n  set -e\n \
+     \ # `smp experiments parse-comment` owns the comment format and never errors\n\
+     \  # on an empty file (emits \"\"). Force-include quality_gates, then union any\n\
+     \  # ticked extras.\n  EXTRAS=$(./smp experiments parse-comment --comment selection_comment.md\
+     \ --format path-filter)\n  FILTER=\"quality_gates\"\n  if [ -n \"${EXTRAS}\" ];\
+     \ then FILTER=\"quality_gates,${EXTRAS}\"; fi\n  EXPERIMENT_FILTER_ARG=\"--experiment-path-filter\
+     \ ${FILTER}\"\n  echo \"Experiment path filter: ${FILTER}\"\nfi\n"
    - if [ "$RUN_CONFIG_ONLY" == "true" ]; then
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit-experimental-config-only\
      \ \\\n--target-image ${COMPARISON_IMAGE} \\\n--target-sha ${CI_COMMIT_SHA} \\\n\
      --target-config-dir ${CONFIG_DIR} \\\n--submission-metadata submission_metadata\
      \ \\\n--tags ${SMP_TAGS} || {\n  exit_code=$?\n  echo \"smp job submit command\
      \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      job-submission\"\n  exit $exit_code\n} \n"
    - else
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit \\\n--baseline-image\
      \ ${BASELINE_IMAGE} \\\n--comparison-image ${COMPARISON_IMAGE} \\\n--baseline-sha\
      \ ${BASELINE_SHA} \\\n--comparison-sha ${CI_COMMIT_SHA} \\\n--target-config-dir\
      \ ${CONFIG_DIR} \\\n--submission-metadata submission_metadata \\\n--tags ${SMP_TAGS}\
-     \ || {\n  exit_code=$?\n  echo \"smp job submit command failed with code $exit_code\"\
-     \n  datadog-ci tag --level job --tags smp_failure_mode:\"job-submission\"\n  exit\
-     \ $exit_code\n} \n"
+     \ ${EXPERIMENT_FILTER_ARG} || {\n  exit_code=$?\n  echo \"smp job submit command\
+     \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
+     job-submission\"\n  exit $exit_code\n} \n"
    - fi
    - SMP_JOB_ID=$(jq -r '.jobId' submission_metadata)
    - echo "SMP Job Id is ${SMP_JOB_ID}"
    - datadog-ci tag --level job --tags smp_job_id:${SMP_JOB_ID}
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob status \\\n--wait \\\n--wait-delay-seconds\
      \ 60 \\\n--submission-metadata submission_metadata || {\n  exit_code=$?\n  echo\
      \ \"smp job status command failed with code $exit_code\"\n  datadog-ci tag --level\
      \ job --tags smp_failure_mode:\"job-status\"\n  exit $exit_code\n}\n"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob sync \\\n--submission-metadata\
      \ submission_metadata \\\n--output-path outputs || {\n  exit_code=$?\n  echo \"\
      smp job sync command failed with code $exit_code\"\n  datadog-ci tag --level job\
      \ --tags smp_failure_mode:\"job-sync\"\n  exit $exit_code\n}\n"
    - cat outputs/report.md | sed "s/^\$/$(echo -ne '\uFEFF\u00A0\u200B')/g"
    - datadog-ci junit upload --service datadog-agent outputs/junit.xml
    - datadog-ci tag --level job --tags smp_failure_mode:"none"
    - datadog-ci tag --level job --tags smp_optimization_goal:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal regression-detector || {\n  exit_code=$?\n  echo\
      \ \"smp regression detector has detected a regression\"\n  datadog-ci tag --level\
      \ job --tags smp_optimization_goal:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_bounds_check:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal bounds-check || {\n  exit_code=$?\n  echo \"smp\
      \ regression detector has detected a failed bounds check\"\n  datadog-ci tag --level\
      \ job --tags smp_bounds_check:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"failed"
    - "python3 <<'EOF'\nimport json\nimport sys\n\ntry:\n    with open('outputs/report.json')\
      \ as f:\n        data = json.load(f)\nexcept FileNotFoundError:\n    print(\"\
      Machine readable report not found.\")\n    sys.exit(1)\nexcept json.JSONDecodeError\
      \ as e:\n    print(f\"Error parsing JSON report: {e}\")\n    sys.exit(1)\n\nexperiments\
      \ = data.get('experiments', {})\nfailed = False\ndecision_record = []\n\nfor exp_name,\
      \ exp_data in experiments.items():\n    if exp_name.startswith('quality_gate_'):\n\
      \        bounds_checks = exp_data.get('bounds_checks', {})\n        for check_name,\
      \ check_data in bounds_checks.items():\n            results = check_data.get('results',\
      \ {})\n            comparison = results.get('comparison', [])\n            num_total\
      \ = len(comparison)\n            failed_replicates = [\n                replicate\
      \ for replicate in comparison if not replicate.get('passed', False)\n        \
      \    ]\n            num_failed = len(failed_replicates)\n            num_passed\
      \ = num_total - num_failed\n            if failed_replicates:\n              \
      \  decision_record.append(\n                    f\"- **{exp_name}**, bounds check\
      \ **{check_name}**: {num_passed}/{num_total} replicas passed. Failed {num_failed}\
      \ which is > 0. Gate **FAILED**.\"\n                )\n                failed\
      \ = True\n            else:\n                decision_record.append(\n       \
      \             f\"- **{exp_name}**, bounds check **{check_name}**: {num_passed}/{num_total}\
      \ replicas passed. Gate passed.\"\n                )\n\nwith open('outputs/decision_record.md',\
      \ 'w') as f:\n    # Extra newline since this is appended to another report\n \
      \   f.write('\\n\\n## CI Pass/Fail Decision\\n\\n')\n    if failed:\n        f.write('\u274C\
      \ **Failed.** Some Quality Gates were violated.\\n\\n')\n        f.write('\\n'.join(decision_record))\n\
      \    else:\n        f.write('\u2705 **Passed.** All Quality Gates passed.\\n\\\
      n')\n        f.write('\\n'.join(decision_record))\n\nif failed:\n    print(\"\
      Quality gate failed, see decision record\")\n    sys.exit(1)\nelse:\n    print(\"\
      Quality gate passed.\")\n    sys.exit(0)\nEOF\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"passed"
    stage: functional_test
    tags:
    - arch:amd64
    - specific:true
    timeout: 1h10m
.smp_job_submit
  .smp_job_submit:
  - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API} --aws-named-profile\
    \ ${AWS_NAMED_PROFILE} \\\njob submit \\\n--baseline-image ${BASELINE_IMAGE} \\\n\
    --comparison-image ${COMPARISON_IMAGE} \\\n--baseline-sha ${BASELINE_SHA} \\\n--comparison-sha\
    \ ${CI_COMMIT_SHA} \\\n--target-config-dir ${CONFIG_DIR} \\\n--submission-metadata\
-   \ submission_metadata \\\n--tags ${SMP_TAGS} || {\n  exit_code=$?\n  echo \"smp\
?                                                                      ------- -----
+   \ submission_metadata \\\n--tags ${SMP_TAGS} ${EXPERIMENT_FILTER_ARG} || {\n  exit_code=$?\n\
?                                                +++++++++++++++++++++++++
-   \ job submit command failed with code $exit_code\"\n  datadog-ci tag --level job\
?                                                                       ------------
+   \  echo \"smp job submit command failed with code $exit_code\"\n  datadog-ci tag\
?    ++++++++++++
-   \ --tags smp_failure_mode:\"job-submission\"\n  exit $exit_code\n} \n"
+   \ --level job --tags smp_failure_mode:\"job-submission\"\n  exit $exit_code\n} \n"
?    ++++++++++++
single-machine-performance-metal-runners-regression_detector
  single-machine-performance-metal-runners-regression_detector:
    allow_failure: true
    artifacts:
      expire_in: 1 weeks
      paths:
      - submission_metadata
      - outputs/report.md
      - outputs/regression_signal.json
      - outputs/bounds_check_signal.json
      - outputs/junit.xml
      - outputs/report.json
      - outputs/decision_record.md
      when: always
    before_script:
    - echo "BASELINE_SHA=${BASELINE_SHA}" > regression_detector.env
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$CI_IMAGE_DOCKER_X64_SUFFIX:$CI_IMAGE_DOCKER_X64
    retry:
      exit_codes:
      - 42
      max: 2
      when:
      - runner_system_failure
      - stuck_or_timeout_failure
      - unknown_failure
      - api_failure
      - scheduler_failure
      - stale_schedule
      - data_integrity_failure
    script:
    - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2"
      token)" || exit $?; export DATADOG_API_KEY
    - datadog-ci tag --level job --tags smp_failure_mode:"timeout"
    - mkdir outputs
    - AWS_NAMED_PROFILE="single-machine-performance"
    - "SMP_ACCOUNT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT account_id)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - SMP_ECR_URL=${SMP_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com
    - "SMP_TEAM_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT \"${SMP_TEAM_NAME}_team_id\"\
      ) || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_API=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $SMP_API_URL)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_LOGIN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_TOKEN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - aws configure set aws_access_key_id "$SMP_BOT_ID" --profile ${AWS_NAMED_PROFILE}
    - aws configure set aws_secret_access_key "$SMP_BOT_KEY" --profile ${AWS_NAMED_PROFILE}
    - aws configure set region us-west-2 --profile ${AWS_NAMED_PROFILE}
    - "aws --profile single-machine-performance s3 cp s3://smp-cli-releases/${SMP_VERSION}/x86_64-unknown-linux-musl/smp\
      \ smp || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-fetch-cli\"\n  exit $exit_code\n}\n"
    - chmod +x smp
    - source regression_detector.env
    - echo "Baseline SHA is ${BASELINE_SHA}"
    - echo -n "${BASELINE_SHA}" > "${CI_COMMIT_SHA}-baseline_sha"
    - aws s3 cp --profile single-machine-performance --only-show-errors "${CI_COMMIT_SHA}-baseline_sha"
      "s3://${SMP_TEAM_ID}-smp-artifacts/information/"
    - BASELINE_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${BASELINE_SHA}-7-full-amd64
    - echo "${BASELINE_SHA} | ${BASELINE_IMAGE}"
    - COMPARISON_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${CI_COMMIT_SHA}-7-full-amd64
    - echo "${CI_COMMIT_SHA} | ${COMPARISON_IMAGE}"
    - SMP_TAGS="ci_pipeline_id=${PARENT_PIPELINE_ID},ci_job_id=${CI_JOB_ID},ci_commit_branch=${CI_COMMIT_BRANCH},purpose=agent_ci"
    - echo "Tags passed through SMP are ${SMP_TAGS}"
    - RUST_LOG="info,aws_config::profile::credentials=error"
    - RUST_LOG_DEBUG="debug,aws_config::profile::credentials=error"
+   - EXPERIMENT_FILTER_ARG=""
+   - "if [ \"${READ_SELECTION_COMMENT:-false}\" = \"true\" ]; then\n  # Best effort:\
+     \ mint a GitHub token, resolve the PR, fetch the selection\n  # comment (the one\
+     \ whose body STARTS WITH the marker -- the CI config-diff\n  # comment only contains\
+     \ the marker inside a code block; this finder MUST\n  # match the smp-experiment-selection-comment\
+     \ writer). Any failure (no PR,\n  # octo-sts down, no comment) just leaves the\
+     \ file empty -> quality_gates.\n  set +e\n  GITHUB_TOKEN=$(dd-octo-sts token --scope\
+     \ DataDog/datadog-agent --policy self.gitlab.comment-pr 2>/dev/null)\n  PR_NUMBER=\"\
+     \"\n  if [ -n \"${GITHUB_TOKEN}\" ]; then\n    PR_NUMBER=$(curl -s -H \"Authorization:\
+     \ Bearer ${GITHUB_TOKEN}\" \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/commits/${CI_COMMIT_SHA}/pulls\"\
+     \ \\\n      | jq -r '.[0].number // empty')\n  fi\n  : > selection_comment.md\n\
+     \  if [ -n \"${PR_NUMBER}\" ]; then\n    curl -s -H \"Authorization: Bearer ${GITHUB_TOKEN}\"\
+     \ \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/issues/${PR_NUMBER}/comments?per_page=100\"\
+     \ \\\n      | jq -r 'map(select(.body | startswith(\"<!-- smp-experiment-selection\
+     \ -->\"))) | last | .body // empty' > selection_comment.md\n  fi\n  set -e\n \
+     \ # `smp experiments parse-comment` owns the comment format and never errors\n\
+     \  # on an empty file (emits \"\"). Force-include quality_gates, then union any\n\
+     \  # ticked extras.\n  EXTRAS=$(./smp experiments parse-comment --comment selection_comment.md\
+     \ --format path-filter)\n  FILTER=\"quality_gates\"\n  if [ -n \"${EXTRAS}\" ];\
+     \ then FILTER=\"quality_gates,${EXTRAS}\"; fi\n  EXPERIMENT_FILTER_ARG=\"--experiment-path-filter\
+     \ ${FILTER}\"\n  echo \"Experiment path filter: ${FILTER}\"\nfi\n"
    - if [ "$RUN_CONFIG_ONLY" == "true" ]; then
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit-experimental-config-only\
      \ \\\n--target-image ${COMPARISON_IMAGE} \\\n--target-sha ${CI_COMMIT_SHA} \\\n\
      --target-config-dir ${CONFIG_DIR} \\\n--submission-metadata submission_metadata\
      \ \\\n--tags ${SMP_TAGS} || {\n  exit_code=$?\n  echo \"smp job submit command\
      \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      job-submission\"\n  exit $exit_code\n} \n"
    - else
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit \\\n--baseline-image\
      \ ${BASELINE_IMAGE} \\\n--comparison-image ${COMPARISON_IMAGE} \\\n--baseline-sha\
      \ ${BASELINE_SHA} \\\n--comparison-sha ${CI_COMMIT_SHA} \\\n--target-config-dir\
      \ ${CONFIG_DIR} \\\n--submission-metadata submission_metadata \\\n--tags ${SMP_TAGS}\
-     \ || {\n  exit_code=$?\n  echo \"smp job submit command failed with code $exit_code\"\
-     \n  datadog-ci tag --level job --tags smp_failure_mode:\"job-submission\"\n  exit\
-     \ $exit_code\n} \n"
+     \ ${EXPERIMENT_FILTER_ARG} || {\n  exit_code=$?\n  echo \"smp job submit command\
+     \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
+     job-submission\"\n  exit $exit_code\n} \n"
    - fi
    - SMP_JOB_ID=$(jq -r '.jobId' submission_metadata)
    - echo "SMP Job Id is ${SMP_JOB_ID}"
    - datadog-ci tag --level job --tags smp_job_id:${SMP_JOB_ID}
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob status \\\n--wait \\\n--wait-delay-seconds\
      \ 60 \\\n--submission-metadata submission_metadata || {\n  exit_code=$?\n  echo\
      \ \"smp job status command failed with code $exit_code\"\n  datadog-ci tag --level\
      \ job --tags smp_failure_mode:\"job-status\"\n  exit $exit_code\n}\n"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob sync \\\n--submission-metadata\
      \ submission_metadata \\\n--output-path outputs || {\n  exit_code=$?\n  echo \"\
      smp job sync command failed with code $exit_code\"\n  datadog-ci tag --level job\
      \ --tags smp_failure_mode:\"job-sync\"\n  exit $exit_code\n}\n"
    - cat outputs/report.md | sed "s/^\$/$(echo -ne '\uFEFF\u00A0\u200B')/g"
    - datadog-ci junit upload --service datadog-agent outputs/junit.xml
    - datadog-ci tag --level job --tags smp_failure_mode:"none"
    - datadog-ci tag --level job --tags smp_optimization_goal:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal regression-detector || {\n  exit_code=$?\n  echo\
      \ \"smp regression detector has detected a regression\"\n  datadog-ci tag --level\
      \ job --tags smp_optimization_goal:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_bounds_check:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal bounds-check || {\n  exit_code=$?\n  echo \"smp\
      \ regression detector has detected a failed bounds check\"\n  datadog-ci tag --level\
      \ job --tags smp_bounds_check:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"failed"
    - "python3 <<'EOF'\nimport json\nimport sys\n\ntry:\n    with open('outputs/report.json')\
      \ as f:\n        data = json.load(f)\nexcept FileNotFoundError:\n    print(\"\
      Machine readable report not found.\")\n    sys.exit(1)\nexcept json.JSONDecodeError\
      \ as e:\n    print(f\"Error parsing JSON report: {e}\")\n    sys.exit(1)\n\nexperiments\
      \ = data.get('experiments', {})\nfailed = False\ndecision_record = []\n\nfor exp_name,\
      \ exp_data in experiments.items():\n    if exp_name.startswith('quality_gate_'):\n\
      \        bounds_checks = exp_data.get('bounds_checks', {})\n        for check_name,\
      \ check_data in bounds_checks.items():\n            results = check_data.get('results',\
      \ {})\n            comparison = results.get('comparison', [])\n            num_total\
      \ = len(comparison)\n            failed_replicates = [\n                replicate\
      \ for replicate in comparison if not replicate.get('passed', False)\n        \
      \    ]\n            num_failed = len(failed_replicates)\n            num_passed\
      \ = num_total - num_failed\n            if failed_replicates:\n              \
      \  decision_record.append(\n                    f\"- **{exp_name}**, bounds check\
      \ **{check_name}**: {num_passed}/{num_total} replicas passed. Failed {num_failed}\
      \ which is > 0. Gate **FAILED**.\"\n                )\n                failed\
      \ = True\n            else:\n                decision_record.append(\n       \
      \             f\"- **{exp_name}**, bounds check **{check_name}**: {num_passed}/{num_total}\
      \ replicas passed. Gate passed.\"\n                )\n\nwith open('outputs/decision_record.md',\
      \ 'w') as f:\n    # Extra newline since this is appended to another report\n \
      \   f.write('\\n\\n## CI Pass/Fail Decision\\n\\n')\n    if failed:\n        f.write('\u274C\
      \ **Failed.** Some Quality Gates were violated.\\n\\n')\n        f.write('\\n'.join(decision_record))\n\
      \    else:\n        f.write('\u2705 **Passed.** All Quality Gates passed.\\n\\\
      n')\n        f.write('\\n'.join(decision_record))\n\nif failed:\n    print(\"\
      Quality gate failed, see decision record\")\n    sys.exit(1)\nelse:\n    print(\"\
      Quality gate passed.\")\n    sys.exit(0)\nEOF\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"passed"
    stage: functional_test
    tags:
    - arch:amd64
    - specific:true
    timeout: 1h10m
    variables:
      BOT_LOGIN: bot_login_metal-runners
      BOT_TOKEN: bot_token_metal-runners
      CONFIG_DIR: test/regression/ebpf
      SMP_API_URL: metal-runners_api_url
      SMP_TEAM_NAME: metal-runners
      SMP_VERSION: v0.27.0-nightly.20260423T145046Z
    when: manual
single-machine-performance-metal-runners-regression_detector_cfg
  single-machine-performance-metal-runners-regression_detector_cfg:
    allow_failure: true
    artifacts:
      expire_in: 1 weeks
      paths:
      - submission_metadata
      - outputs/report.md
      - outputs/regression_signal.json
      - outputs/bounds_check_signal.json
      - outputs/junit.xml
      - outputs/report.json
      - outputs/decision_record.md
      when: always
    before_script:
    - echo "BASELINE_SHA=${BASELINE_SHA}" > regression_detector.env
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$CI_IMAGE_DOCKER_X64_SUFFIX:$CI_IMAGE_DOCKER_X64
    retry:
      exit_codes:
      - 42
      max: 2
      when:
      - runner_system_failure
      - stuck_or_timeout_failure
      - unknown_failure
      - api_failure
      - scheduler_failure
      - stale_schedule
      - data_integrity_failure
    script:
    - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2"
      token)" || exit $?; export DATADOG_API_KEY
    - datadog-ci tag --level job --tags smp_failure_mode:"timeout"
    - mkdir outputs
    - AWS_NAMED_PROFILE="single-machine-performance"
    - "SMP_ACCOUNT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT account_id)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - SMP_ECR_URL=${SMP_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com
    - "SMP_TEAM_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT \"${SMP_TEAM_NAME}_team_id\"\
      ) || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_API=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $SMP_API_URL)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_LOGIN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_TOKEN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - aws configure set aws_access_key_id "$SMP_BOT_ID" --profile ${AWS_NAMED_PROFILE}
    - aws configure set aws_secret_access_key "$SMP_BOT_KEY" --profile ${AWS_NAMED_PROFILE}
    - aws configure set region us-west-2 --profile ${AWS_NAMED_PROFILE}
    - "aws --profile single-machine-performance s3 cp s3://smp-cli-releases/${SMP_VERSION}/x86_64-unknown-linux-musl/smp\
      \ smp || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-fetch-cli\"\n  exit $exit_code\n}\n"
    - chmod +x smp
    - source regression_detector.env
    - echo "Baseline SHA is ${BASELINE_SHA}"
    - echo -n "${BASELINE_SHA}" > "${CI_COMMIT_SHA}-baseline_sha"
    - aws s3 cp --profile single-machine-performance --only-show-errors "${CI_COMMIT_SHA}-baseline_sha"
      "s3://${SMP_TEAM_ID}-smp-artifacts/information/"
    - BASELINE_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${BASELINE_SHA}-7-full-amd64
    - echo "${BASELINE_SHA} | ${BASELINE_IMAGE}"
    - COMPARISON_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${CI_COMMIT_SHA}-7-full-amd64
    - echo "${CI_COMMIT_SHA} | ${COMPARISON_IMAGE}"
    - SMP_TAGS="ci_pipeline_id=${PARENT_PIPELINE_ID},ci_job_id=${CI_JOB_ID},ci_commit_branch=${CI_COMMIT_BRANCH},purpose=agent_ci"
    - echo "Tags passed through SMP are ${SMP_TAGS}"
    - RUST_LOG="info,aws_config::profile::credentials=error"
    - RUST_LOG_DEBUG="debug,aws_config::profile::credentials=error"
+   - EXPERIMENT_FILTER_ARG=""
+   - "if [ \"${READ_SELECTION_COMMENT:-false}\" = \"true\" ]; then\n  # Best effort:\
+     \ mint a GitHub token, resolve the PR, fetch the selection\n  # comment (the one\
+     \ whose body STARTS WITH the marker -- the CI config-diff\n  # comment only contains\
+     \ the marker inside a code block; this finder MUST\n  # match the smp-experiment-selection-comment\
+     \ writer). Any failure (no PR,\n  # octo-sts down, no comment) just leaves the\
+     \ file empty -> quality_gates.\n  set +e\n  GITHUB_TOKEN=$(dd-octo-sts token --scope\
+     \ DataDog/datadog-agent --policy self.gitlab.comment-pr 2>/dev/null)\n  PR_NUMBER=\"\
+     \"\n  if [ -n \"${GITHUB_TOKEN}\" ]; then\n    PR_NUMBER=$(curl -s -H \"Authorization:\
+     \ Bearer ${GITHUB_TOKEN}\" \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/commits/${CI_COMMIT_SHA}/pulls\"\
+     \ \\\n      | jq -r '.[0].number // empty')\n  fi\n  : > selection_comment.md\n\
+     \  if [ -n \"${PR_NUMBER}\" ]; then\n    curl -s -H \"Authorization: Bearer ${GITHUB_TOKEN}\"\
+     \ \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/issues/${PR_NUMBER}/comments?per_page=100\"\
+     \ \\\n      | jq -r 'map(select(.body | startswith(\"<!-- smp-experiment-selection\
+     \ -->\"))) | last | .body // empty' > selection_comment.md\n  fi\n  set -e\n \
+     \ # `smp experiments parse-comment` owns the comment format and never errors\n\
+     \  # on an empty file (emits \"\"). Force-include quality_gates, then union any\n\
+     \  # ticked extras.\n  EXTRAS=$(./smp experiments parse-comment --comment selection_comment.md\
+     \ --format path-filter)\n  FILTER=\"quality_gates\"\n  if [ -n \"${EXTRAS}\" ];\
+     \ then FILTER=\"quality_gates,${EXTRAS}\"; fi\n  EXPERIMENT_FILTER_ARG=\"--experiment-path-filter\
+     \ ${FILTER}\"\n  echo \"Experiment path filter: ${FILTER}\"\nfi\n"
    - if [ "$RUN_CONFIG_ONLY" == "true" ]; then
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit-experimental-config-only\
      \ \\\n--target-image ${COMPARISON_IMAGE} \\\n--target-sha ${CI_COMMIT_SHA} \\\n\
      --target-config-dir ${CONFIG_DIR} \\\n--submission-metadata submission_metadata\
      \ \\\n--tags ${SMP_TAGS} || {\n  exit_code=$?\n  echo \"smp job submit command\
      \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      job-submission\"\n  exit $exit_code\n} \n"
    - else
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit \\\n--baseline-image\
      \ ${BASELINE_IMAGE} \\\n--comparison-image ${COMPARISON_IMAGE} \\\n--baseline-sha\
      \ ${BASELINE_SHA} \\\n--comparison-sha ${CI_COMMIT_SHA} \\\n--target-config-dir\
      \ ${CONFIG_DIR} \\\n--submission-metadata submission_metadata \\\n--tags ${SMP_TAGS}\
-     \ || {\n  exit_code=$?\n  echo \"smp job submit command failed with code $exit_code\"\
-     \n  datadog-ci tag --level job --tags smp_failure_mode:\"job-submission\"\n  exit\
-     \ $exit_code\n} \n"
+     \ ${EXPERIMENT_FILTER_ARG} || {\n  exit_code=$?\n  echo \"smp job submit command\
+     \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
+     job-submission\"\n  exit $exit_code\n} \n"
    - fi
    - SMP_JOB_ID=$(jq -r '.jobId' submission_metadata)
    - echo "SMP Job Id is ${SMP_JOB_ID}"
    - datadog-ci tag --level job --tags smp_job_id:${SMP_JOB_ID}
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob status \\\n--wait \\\n--wait-delay-seconds\
      \ 60 \\\n--submission-metadata submission_metadata || {\n  exit_code=$?\n  echo\
      \ \"smp job status command failed with code $exit_code\"\n  datadog-ci tag --level\
      \ job --tags smp_failure_mode:\"job-status\"\n  exit $exit_code\n}\n"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob sync \\\n--submission-metadata\
      \ submission_metadata \\\n--output-path outputs || {\n  exit_code=$?\n  echo \"\
      smp job sync command failed with code $exit_code\"\n  datadog-ci tag --level job\
      \ --tags smp_failure_mode:\"job-sync\"\n  exit $exit_code\n}\n"
    - cat outputs/report.md | sed "s/^\$/$(echo -ne '\uFEFF\u00A0\u200B')/g"
    - datadog-ci junit upload --service datadog-agent outputs/junit.xml
    - datadog-ci tag --level job --tags smp_failure_mode:"none"
    - datadog-ci tag --level job --tags smp_optimization_goal:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal regression-detector || {\n  exit_code=$?\n  echo\
      \ \"smp regression detector has detected a regression\"\n  datadog-ci tag --level\
      \ job --tags smp_optimization_goal:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_bounds_check:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal bounds-check || {\n  exit_code=$?\n  echo \"smp\
      \ regression detector has detected a failed bounds check\"\n  datadog-ci tag --level\
      \ job --tags smp_bounds_check:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"failed"
    - "python3 <<'EOF'\nimport json\nimport sys\n\ntry:\n    with open('outputs/report.json')\
      \ as f:\n        data = json.load(f)\nexcept FileNotFoundError:\n    print(\"\
      Machine readable report not found.\")\n    sys.exit(1)\nexcept json.JSONDecodeError\
      \ as e:\n    print(f\"Error parsing JSON report: {e}\")\n    sys.exit(1)\n\nexperiments\
      \ = data.get('experiments', {})\nfailed = False\ndecision_record = []\n\nfor exp_name,\
      \ exp_data in experiments.items():\n    if exp_name.startswith('quality_gate_'):\n\
      \        bounds_checks = exp_data.get('bounds_checks', {})\n        for check_name,\
      \ check_data in bounds_checks.items():\n            results = check_data.get('results',\
      \ {})\n            comparison = results.get('comparison', [])\n            num_total\
      \ = len(comparison)\n            failed_replicates = [\n                replicate\
      \ for replicate in comparison if not replicate.get('passed', False)\n        \
      \    ]\n            num_failed = len(failed_replicates)\n            num_passed\
      \ = num_total - num_failed\n            if failed_replicates:\n              \
      \  decision_record.append(\n                    f\"- **{exp_name}**, bounds check\
      \ **{check_name}**: {num_passed}/{num_total} replicas passed. Failed {num_failed}\
      \ which is > 0. Gate **FAILED**.\"\n                )\n                failed\
      \ = True\n            else:\n                decision_record.append(\n       \
      \             f\"- **{exp_name}**, bounds check **{check_name}**: {num_passed}/{num_total}\
      \ replicas passed. Gate passed.\"\n                )\n\nwith open('outputs/decision_record.md',\
      \ 'w') as f:\n    # Extra newline since this is appended to another report\n \
      \   f.write('\\n\\n## CI Pass/Fail Decision\\n\\n')\n    if failed:\n        f.write('\u274C\
      \ **Failed.** Some Quality Gates were violated.\\n\\n')\n        f.write('\\n'.join(decision_record))\n\
      \    else:\n        f.write('\u2705 **Passed.** All Quality Gates passed.\\n\\\
      n')\n        f.write('\\n'.join(decision_record))\n\nif failed:\n    print(\"\
      Quality gate failed, see decision record\")\n    sys.exit(1)\nelse:\n    print(\"\
      Quality gate passed.\")\n    sys.exit(0)\nEOF\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"passed"
    stage: functional_test
    tags:
    - arch:amd64
    - specific:true
    timeout: 1h10m
    variables:
      BOT_LOGIN: bot_login_metal-runners
      BOT_TOKEN: bot_token_metal-runners
      CONFIG_DIR: test/regression/ebpf/config-only
      RUN_CONFIG_ONLY: 'true'
      SMP_API_URL: metal-runners_api_url
      SMP_TEAM_NAME: metal-runners
      SMP_VERSION: v0.27.0-nightly.20260423T145046Z
    when: manual
single-machine-performance-regression_detector
  single-machine-performance-regression_detector:
    artifacts:
      expire_in: 1 weeks
      paths:
      - submission_metadata
      - outputs/report.md
      - outputs/regression_signal.json
      - outputs/bounds_check_signal.json
      - outputs/junit.xml
      - outputs/report.json
      - outputs/decision_record.md
      when: always
    before_script:
    - echo "BASELINE_SHA=${BASELINE_SHA}" > regression_detector.env
+   id_tokens:
+     DDOCTOSTS_ID_TOKEN:
+       aud: dd-octo-sts
    image: registry.ddbuild.io/ci/datadog-agent-buildimages/docker_x64$CI_IMAGE_DOCKER_X64_SUFFIX:$CI_IMAGE_DOCKER_X64
    retry:
      exit_codes:
      - 42
      max: 2
      when:
      - runner_system_failure
      - stuck_or_timeout_failure
      - unknown_failure
      - api_failure
      - scheduler_failure
      - stale_schedule
      - data_integrity_failure
    rules:
    - allow_failure: false
      if: $SMP_ALLOW_FAILURE == "false"
    - allow_failure: true
      when: on_success
    script:
    - DATADOG_API_KEY="$("$CI_PROJECT_DIR"/tools/ci/fetch_secret.sh "$AGENT_API_KEY_ORG2"
      token)" || exit $?; export DATADOG_API_KEY
    - datadog-ci tag --level job --tags smp_failure_mode:"timeout"
    - mkdir outputs
    - AWS_NAMED_PROFILE="single-machine-performance"
    - "SMP_ACCOUNT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT account_id)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - SMP_ECR_URL=${SMP_ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com
    - "SMP_TEAM_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT \"${SMP_TEAM_NAME}_team_id\"\
      ) || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_API=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $SMP_API_URL)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_ID=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_LOGIN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - "SMP_BOT_KEY=$($CI_PROJECT_DIR/tools/ci/fetch_secret.sh $SMP_ACCOUNT $BOT_TOKEN)\
      \ || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-secrets\"\n  exit $exit_code\n}\n"
    - aws configure set aws_access_key_id "$SMP_BOT_ID" --profile ${AWS_NAMED_PROFILE}
    - aws configure set aws_secret_access_key "$SMP_BOT_KEY" --profile ${AWS_NAMED_PROFILE}
    - aws configure set region us-west-2 --profile ${AWS_NAMED_PROFILE}
    - "aws --profile single-machine-performance s3 cp s3://smp-cli-releases/${SMP_VERSION}/x86_64-unknown-linux-musl/smp\
      \ smp || {\n  exit_code=$?\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      setup-fetch-cli\"\n  exit $exit_code\n}\n"
    - chmod +x smp
    - source regression_detector.env
    - echo "Baseline SHA is ${BASELINE_SHA}"
    - echo -n "${BASELINE_SHA}" > "${CI_COMMIT_SHA}-baseline_sha"
    - aws s3 cp --profile single-machine-performance --only-show-errors "${CI_COMMIT_SHA}-baseline_sha"
      "s3://${SMP_TEAM_ID}-smp-artifacts/information/"
    - BASELINE_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${BASELINE_SHA}-7-full-amd64
    - echo "${BASELINE_SHA} | ${BASELINE_IMAGE}"
    - COMPARISON_IMAGE=${SMP_ECR_URL}/${SMP_TEAM_ID}-agent:${CI_COMMIT_SHA}-7-full-amd64
    - echo "${CI_COMMIT_SHA} | ${COMPARISON_IMAGE}"
    - SMP_TAGS="ci_pipeline_id=${PARENT_PIPELINE_ID},ci_job_id=${CI_JOB_ID},ci_commit_branch=${CI_COMMIT_BRANCH},purpose=agent_ci"
    - echo "Tags passed through SMP are ${SMP_TAGS}"
    - RUST_LOG="info,aws_config::profile::credentials=error"
    - RUST_LOG_DEBUG="debug,aws_config::profile::credentials=error"
+   - EXPERIMENT_FILTER_ARG=""
+   - "if [ \"${READ_SELECTION_COMMENT:-false}\" = \"true\" ]; then\n  # Best effort:\
+     \ mint a GitHub token, resolve the PR, fetch the selection\n  # comment (the one\
+     \ whose body STARTS WITH the marker -- the CI config-diff\n  # comment only contains\
+     \ the marker inside a code block; this finder MUST\n  # match the smp-experiment-selection-comment\
+     \ writer). Any failure (no PR,\n  # octo-sts down, no comment) just leaves the\
+     \ file empty -> quality_gates.\n  set +e\n  GITHUB_TOKEN=$(dd-octo-sts token --scope\
+     \ DataDog/datadog-agent --policy self.gitlab.comment-pr 2>/dev/null)\n  PR_NUMBER=\"\
+     \"\n  if [ -n \"${GITHUB_TOKEN}\" ]; then\n    PR_NUMBER=$(curl -s -H \"Authorization:\
+     \ Bearer ${GITHUB_TOKEN}\" \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/commits/${CI_COMMIT_SHA}/pulls\"\
+     \ \\\n      | jq -r '.[0].number // empty')\n  fi\n  : > selection_comment.md\n\
+     \  if [ -n \"${PR_NUMBER}\" ]; then\n    curl -s -H \"Authorization: Bearer ${GITHUB_TOKEN}\"\
+     \ \\\n      \"https://api.github.com/repos/DataDog/datadog-agent/issues/${PR_NUMBER}/comments?per_page=100\"\
+     \ \\\n      | jq -r 'map(select(.body | startswith(\"<!-- smp-experiment-selection\
+     \ -->\"))) | last | .body // empty' > selection_comment.md\n  fi\n  set -e\n \
+     \ # `smp experiments parse-comment` owns the comment format and never errors\n\
+     \  # on an empty file (emits \"\"). Force-include quality_gates, then union any\n\
+     \  # ticked extras.\n  EXTRAS=$(./smp experiments parse-comment --comment selection_comment.md\
+     \ --format path-filter)\n  FILTER=\"quality_gates\"\n  if [ -n \"${EXTRAS}\" ];\
+     \ then FILTER=\"quality_gates,${EXTRAS}\"; fi\n  EXPERIMENT_FILTER_ARG=\"--experiment-path-filter\
+     \ ${FILTER}\"\n  echo \"Experiment path filter: ${FILTER}\"\nfi\n"
    - if [ "$RUN_CONFIG_ONLY" == "true" ]; then
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit-experimental-config-only\
      \ \\\n--target-image ${COMPARISON_IMAGE} \\\n--target-sha ${CI_COMMIT_SHA} \\\n\
      --target-config-dir ${CONFIG_DIR} \\\n--submission-metadata submission_metadata\
      \ \\\n--tags ${SMP_TAGS} || {\n  exit_code=$?\n  echo \"smp job submit command\
      \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
      job-submission\"\n  exit $exit_code\n} \n"
    - else
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob submit \\\n--baseline-image\
      \ ${BASELINE_IMAGE} \\\n--comparison-image ${COMPARISON_IMAGE} \\\n--baseline-sha\
      \ ${BASELINE_SHA} \\\n--comparison-sha ${CI_COMMIT_SHA} \\\n--target-config-dir\
      \ ${CONFIG_DIR} \\\n--submission-metadata submission_metadata \\\n--tags ${SMP_TAGS}\
-     \ || {\n  exit_code=$?\n  echo \"smp job submit command failed with code $exit_code\"\
-     \n  datadog-ci tag --level job --tags smp_failure_mode:\"job-submission\"\n  exit\
-     \ $exit_code\n} \n"
+     \ ${EXPERIMENT_FILTER_ARG} || {\n  exit_code=$?\n  echo \"smp job submit command\
+     \ failed with code $exit_code\"\n  datadog-ci tag --level job --tags smp_failure_mode:\"\
+     job-submission\"\n  exit $exit_code\n} \n"
    - fi
    - SMP_JOB_ID=$(jq -r '.jobId' submission_metadata)
    - echo "SMP Job Id is ${SMP_JOB_ID}"
    - datadog-ci tag --level job --tags smp_job_id:${SMP_JOB_ID}
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob status \\\n--wait \\\n--wait-delay-seconds\
      \ 60 \\\n--submission-metadata submission_metadata || {\n  exit_code=$?\n  echo\
      \ \"smp job status command failed with code $exit_code\"\n  datadog-ci tag --level\
      \ job --tags smp_failure_mode:\"job-status\"\n  exit $exit_code\n}\n"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\njob sync \\\n--submission-metadata\
      \ submission_metadata \\\n--output-path outputs || {\n  exit_code=$?\n  echo \"\
      smp job sync command failed with code $exit_code\"\n  datadog-ci tag --level job\
      \ --tags smp_failure_mode:\"job-sync\"\n  exit $exit_code\n}\n"
    - cat outputs/report.md | sed "s/^\$/$(echo -ne '\uFEFF\u00A0\u200B')/g"
    - datadog-ci junit upload --service datadog-agent outputs/junit.xml
    - datadog-ci tag --level job --tags smp_failure_mode:"none"
    - datadog-ci tag --level job --tags smp_optimization_goal:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal regression-detector || {\n  exit_code=$?\n  echo\
      \ \"smp regression detector has detected a regression\"\n  datadog-ci tag --level\
      \ job --tags smp_optimization_goal:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_bounds_check:"passed"
    - "RUST_LOG=\"${RUST_LOG}\" ./smp --team-id ${SMP_TEAM_ID} --api-base ${SMP_API}\
      \ --aws-named-profile ${AWS_NAMED_PROFILE} \\\n  job result \\\n  --submission-metadata\
      \ submission_metadata --signal bounds-check || {\n  exit_code=$?\n  echo \"smp\
      \ regression detector has detected a failed bounds check\"\n  datadog-ci tag --level\
      \ job --tags smp_bounds_check:\"failed\"\n}\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"failed"
    - "python3 <<'EOF'\nimport json\nimport sys\n\ntry:\n    with open('outputs/report.json')\
      \ as f:\n        data = json.load(f)\nexcept FileNotFoundError:\n    print(\"\
      Machine readable report not found.\")\n    sys.exit(1)\nexcept json.JSONDecodeError\
      \ as e:\n    print(f\"Error parsing JSON report: {e}\")\n    sys.exit(1)\n\nexperiments\
      \ = data.get('experiments', {})\nfailed = False\ndecision_record = []\n\nfor exp_name,\
      \ exp_data in experiments.items():\n    if exp_name.startswith('quality_gate_'):\n\
      \        bounds_checks = exp_data.get('bounds_checks', {})\n        for check_name,\
      \ check_data in bounds_checks.items():\n            results = check_data.get('results',\
      \ {})\n            comparison = results.get('comparison', [])\n            num_total\
      \ = len(comparison)\n            failed_replicates = [\n                replicate\
      \ for replicate in comparison if not replicate.get('passed', False)\n        \
      \    ]\n            num_failed = len(failed_replicates)\n            num_passed\
      \ = num_total - num_failed\n            if failed_replicates:\n              \
      \  decision_record.append(\n                    f\"- **{exp_name}**, bounds check\
      \ **{check_name}**: {num_passed}/{num_total} replicas passed. Failed {num_failed}\
      \ which is > 0. Gate **FAILED**.\"\n                )\n                failed\
      \ = True\n            else:\n                decision_record.append(\n       \
      \             f\"- **{exp_name}**, bounds check **{check_name}**: {num_passed}/{num_total}\
      \ replicas passed. Gate passed.\"\n                )\n\nwith open('outputs/decision_record.md',\
      \ 'w') as f:\n    # Extra newline since this is appended to another report\n \
      \   f.write('\\n\\n## CI Pass/Fail Decision\\n\\n')\n    if failed:\n        f.write('\u274C\
      \ **Failed.** Some Quality Gates were violated.\\n\\n')\n        f.write('\\n'.join(decision_record))\n\
      \    else:\n        f.write('\u2705 **Passed.** All Quality Gates passed.\\n\\\
      n')\n        f.write('\\n'.join(decision_record))\n\nif failed:\n    print(\"\
      Quality gate failed, see decision record\")\n    sys.exit(1)\nelse:\n    print(\"\
      Quality gate passed.\")\n    sys.exit(0)\nEOF\n"
    - datadog-ci tag --level job --tags smp_quality_gates:"passed"
    stage: functional_test
    tags:
    - arch:amd64
    - specific:true
    timeout: 1h10m
    variables:
      BOT_LOGIN: bot_login
      BOT_TOKEN: bot_token
      CONFIG_DIR: test/regression
+     READ_SELECTION_COMMENT: 'true'
      SMP_API_URL: api_url
      SMP_TEAM_NAME: agent
-     SMP_VERSION: v0.27.0
+     SMP_VERSION: dev-pr4640-2299f1770

Changes Summary

Removed Modified Added Renamed
0 5 0 0

ℹ️ Diff available in the job log.

@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor eb4c9f9
📊 Static Quality Gates Dashboard
🔗 SQG Job
SOME SIZE DELTAS ARE N/A (ANCESTOR METRICS NOT YET AVAILABLE). RETRY JOB

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 N/A N/A → 752.066 → 758.200
agent_deb_amd64_fips N/A N/A → 706.838 → 710.520
agent_heroku_amd64 N/A N/A → 308.024 → 315.230
agent_msi N/A N/A → 640.241 → 656.640
agent_rpm_amd64 N/A N/A → 752.049 → 758.170
agent_rpm_amd64_fips N/A N/A → 706.822 → 710.520
agent_rpm_arm64 N/A N/A → 728.647 → 729.660
agent_rpm_arm64_fips N/A N/A → 686.574 → 688.910
agent_suse_amd64 N/A N/A → 752.049 → 758.170
agent_suse_amd64_fips N/A N/A → 706.822 → 710.520
agent_suse_arm64 N/A N/A → 728.647 → 729.660
agent_suse_arm64_fips N/A N/A → 686.574 → 688.910
docker_agent_amd64 N/A N/A → 810.733 → 813.790
docker_agent_arm64 N/A N/A → 812.386 → 815.030
docker_agent_jmx_amd64 N/A N/A → 1001.630 → 1004.550
docker_agent_jmx_arm64 N/A N/A → 991.932 → 994.710
docker_cluster_agent_amd64 N/A N/A → 209.863 → 210.470
docker_cluster_agent_arm64 N/A N/A → 222.953 → 222.980
docker_cws_instrumentation_amd64 N/A N/A → 7.439 → 7.480
docker_cws_instrumentation_arm64 N/A N/A → 6.877 → 7.110
docker_dogstatsd_amd64 N/A N/A → 39.243 → 39.910
docker_dogstatsd_arm64 N/A N/A → 37.368 → 38.270
docker_host_profiler_amd64 N/A N/A → 305.016 → 317.640
docker_host_profiler_arm64 N/A N/A → 316.334 → 328.900
dogstatsd_deb_amd64 N/A N/A → 29.984 → 31.150
dogstatsd_deb_arm64 N/A N/A → 28.024 → 29.530
dogstatsd_rpm_amd64 N/A N/A → 29.984 → 31.150
dogstatsd_suse_amd64 N/A N/A → 29.984 → 31.150
iot_agent_deb_amd64 N/A N/A → 46.161 → 46.380
iot_agent_deb_arm64 N/A N/A → 42.849 → 43.720
iot_agent_deb_armhf N/A N/A → 43.617 → 43.960
iot_agent_rpm_amd64 N/A N/A → 46.162 → 46.380
iot_agent_suse_amd64 N/A N/A → 46.161 → 46.380

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Jul 14, 2026

Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 16cc1af2-7d2f-40cd-a797-d8f79f1513bf

Baseline: c3617ab
Comparison: 467a097
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_logs % cpu utilization +3.47 [+2.47, +4.48] 1 Logs bounds checks dashboard
quality_gate_metrics_logs memory utilization +0.70 [+0.45, +0.95] 1 Logs bounds checks dashboard
syslog_example % cpu utilization +0.68 [-0.31, +1.67] 1 Logs bounds checks dashboard
quality_gate_idle_all_features memory utilization +0.37 [+0.27, +0.47] 1 Logs bounds checks dashboard
quality_gate_security_mean_fs_load memory utilization -0.03 [-0.07, +0.00] 1 Logs bounds checks dashboard
quality_gate_security_idle memory utilization -0.05 [-0.10, +0.00] 1 Logs bounds checks dashboard
quality_gate_idle memory utilization -0.05 [-0.11, +0.01] 1 Logs bounds checks dashboard
quality_gate_security_no_fs_load memory utilization -0.35 [-0.44, -0.26] 1 Logs bounds checks dashboard

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed observed_value links
quality_gate_idle intake_connections 10/10 3 ≤ 4 bounds checks dashboard
quality_gate_idle memory_usage 10/10 146.97MiB ≤ 154MiB bounds checks dashboard
quality_gate_idle total_bytes_received 10/10 731.28KiB ≤ 819.20KiB bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 3 ≤ 4 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 494.28MiB ≤ 495MiB bounds checks dashboard
quality_gate_idle_all_features total_bytes_received 10/10 1.12MiB ≤ 1.25MiB bounds checks dashboard
quality_gate_logs intake_connections 10/10 4 ≤ 6 bounds checks dashboard
quality_gate_logs memory_usage 10/10 184.54MiB ≤ 195MiB bounds checks dashboard
quality_gate_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_logs total_bytes_received 10/10 264.16MiB ≤ 292MiB bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 353.94 ≤ 2000 bounds checks dashboard
quality_gate_metrics_logs intake_connections 10/10 3 ≤ 6 bounds checks dashboard
quality_gate_metrics_logs memory_usage 10/10 401.83MiB ≤ 430MiB bounds checks dashboard
quality_gate_metrics_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_metrics_logs total_bytes_received 10/10 0.94GiB ≤ 1.04GiB bounds checks dashboard
quality_gate_security_idle cpu_usage 10/10 29.13 ≤ 40 bounds checks dashboard
quality_gate_security_idle memory_usage 10/10 295.64MiB ≤ 330MiB bounds checks dashboard
quality_gate_security_mean_fs_load cpu_usage 10/10 66.62 ≤ 80 bounds checks dashboard
quality_gate_security_mean_fs_load memory_usage 10/10 277.02MiB ≤ 310MiB bounds checks dashboard
quality_gate_security_no_fs_load cpu_usage 10/10 24.28 ≤ 40 bounds checks dashboard
quality_gate_security_no_fs_load memory_usage 10/10 279.62MiB ≤ 320MiB bounds checks dashboard
syslog_example intake_connections 10/10 3 ≤ 6 bounds checks dashboard
syslog_example memory_usage 10/10 182.81MiB ≤ 195MiB bounds checks dashboard
syslog_example missed_bytes 10/10 0B = 0B bounds checks dashboard
syslog_example total_bytes_received 10/10 264.14MiB ≤ 292MiB bounds checks dashboard

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

Replicate Execution Details

We run multiple replicates for each experiment/variant. However, we allow replicates to be automatically retried if there are any failures, up to 8 times, at which point the replicate is marked dead and we are unable to run analysis for the entire experiment. We call each of these attempts at running replicates a replicate execution. This section lists all replicate executions that failed due to the target crashing or being oom killed.

Note: In the below tables we bucket failures by experiment, variant, and failure type. For each of these buckets we list out the replicate indexes that failed with an annotation signifying how many times said replicate failed with the given failure mode. In the below example the baseline variant of the experiment named experiment_with_failures had two replicates that failed by oom kills. Replicate 0, which failed 8 executions, and replicate 1 which failed 6 executions, all with the same failure mode.

Experiment Variant Replicates Failure Logs Debug Dashboard
experiment_with_failures baseline 0 (x8) 1 (x6) Oom killed Debug Dashboard

The debug dashboard links will take you to a debugging dashboard specifically designed to investigate replicate execution failures.

❌ Retried Profiling Replicate Execution Failures (ddprof)

Note: Profiling replicas may still be executing. See the debug dashboard for up to date status.

Experiment Variant Replicates Failure Debug Dashboard
quality_gate_logs baseline 10 Oom killed Debug Dashboard
quality_gate_logs comparison 10 Oom killed Debug Dashboard
quality_gate_metrics_logs baseline 10 Oom killed Debug Dashboard
quality_gate_metrics_logs comparison 10 Oom killed Debug Dashboard
quality_gate_security_idle baseline 10 Crashed (exit code: 134) Debug Dashboard
syslog_example baseline 10 Oom killed Debug Dashboard

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_security_mean_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.

@DataDog DataDog deleted a comment from cit-pr-commenter-54b7da Bot Jul 16, 2026
@DataDog DataDog deleted a comment from cit-pr-commenter-54b7da Bot Jul 16, 2026
@DataDog DataDog deleted a comment from dd-octo-sts Bot Jul 17, 2026
@DataDog DataDog deleted a comment from dd-octo-sts Bot Jul 24, 2026
@DataDog DataDog deleted a comment from dd-octo-sts Bot Jul 24, 2026
@DataDog DataDog deleted a comment from dd-octo-sts Bot Jul 27, 2026
Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

adds manually triggerable smp job with selectable experiments

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

fix comment filtering for grabbing experiment list

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

restructure experiments and change selection comment to rely on smp cli

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

add tooltips and descriptions

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

add codeowners and codeowner auto select

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

track changed files back to codeowners

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

extract codeowner filtering into dda task

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>

add optional and team gate examples

Signed-off-by: Caleb Metz <caleb.metz@datadoghq.com>
@dd-octo-sts

dd-octo-sts Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

SMP experiment selection

Quality gates always run.

Tick any additional suites below; selecting a folder runs its whole subtree. Re-run the single-machine-performance-regression_detector job to apply.

Additional suites (tick to include)
  • logs/general — Core log-pipeline experiments — always run when the logs team is a codeowner on the PR.
  • logs/stateful — Stateful log-pipeline experiments — opt in when relevant.
  • logs/syslog — Syslog-source log experiments — opt in when relevant.
  • metrics/feature_1 — Experiments for a specific metrics feature — opt in when testing that feature.
  • metrics/general — Core metrics-pipeline experiments — always run when the metrics team is a codeowner on the PR.

@cmetz100 cmetz100 closed this Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant