Skip to content

[SDBM-2648] Add collect_execution_plans option to SQL Server DBM#23961

Open
na-ji wants to merge 3 commits into
masterfrom
naji.astier/sqlserver-disable-execution-plan
Open

[SDBM-2648] Add collect_execution_plans option to SQL Server DBM#23961
na-ji wants to merge 3 commits into
masterfrom
naji.astier/sqlserver-disable-execution-plan

Conversation

@na-ji

@na-ji na-ji commented Jun 9, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds a new collect_execution_plans configuration block to the SQL Server DBM integration. When collect_execution_plans.enabled is set to false, the query-metrics job continues to collect and emit query metrics and FQT events, but skips execution plan collection entirely.

dbm: true
query_metrics:
  enabled: true
collect_execution_plans:
  enabled: false  # skip plan collection, keep metrics

Motivation

Some users want query metrics without execution plan collection — for example to reduce load from sys.dm_exec_query_plan lookups, or for policy/privacy reasons around plan XML. Previously the only way to disable plans was query_metrics.enabled: false, which also stopped metric collection.

The new option follows the existing collect_* block pattern used by collect_settings, collect_schemas, collect_deadlocks, etc.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

@na-ji na-ji added the qa/skip-qa Automatically skip this PR for the next QA label Jun 9, 2026
na-ji added a commit that referenced this pull request Jun 9, 2026
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@na-ji na-ji added the qa/required QA is required for this PR and will generate a QA card label Jun 9, 2026
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 9, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 47 Pipeline jobs failed

PR | test / check   View in Datadog   GitHub Actions

PR | test / test (linux, ubuntu-22.04, sqlserver, SQL Server on Linux (py3.13-linux-2022-newyork), py3.13-lin... / SQL Server on Linux (py3.13-linux-2022-newyork)-py3.13-linux-2022-newyork   View in Datadog   GitHub Actions

PR | test / test (linux, ubuntu-22.04, sqlserver, SQL Server on Linux (py3.13-linux-2022-tokyo), py3.13-linux... / SQL Server on Linux (py3.13-linux-2022-tokyo)-py3.13-linux-2022-tokyo   View in Datadog   GitHub Actions

View all 47 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a03aba8 | Docs | Datadog PR Page | Give us feedback!

@na-ji na-ji removed the qa/required QA is required for this PR and will generate a QA card label Jun 9, 2026
na-ji and others added 2 commits June 9, 2026 11:40
Adds a new `collect_execution_plans.enabled` config flag (default: true)
that lets users disable execution plan collection independently of query
metrics. When false, the query-metrics job still runs and emits metrics
and FQT events, but skips the _collect_plans loop.

SDBM-2648

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@na-ji na-ji force-pushed the naji.astier/sqlserver-disable-execution-plan branch from 431113d to 9b8dcca Compare June 9, 2026 09:40
Comment on lines +665 to +675
## Configure the collection of query execution plans. Execution plans are collected as part of
## the query metrics job and emitted as query samples. Disabling this keeps query metrics
## collection running while skipping plan collection.
## This option only applies when `dbm` is enabled.
#
# collect_execution_plans:

## @param enabled - boolean - optional - default: true
## Set to `false` to disable collection of query execution plans.
#
# enabled: true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hesitated to add this config under query_metrics, since it's the query_metrics job that is collecting the plans.
Also, I believe this config should be hidden. What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this option have any affect if query_metrics is disabled?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, that's probably the question I should have asked myself before hesitating 😅. So to answer your question: yes, if query_metrics job is disabled, then no plans are collected. It means that I should probably move the config over there

@na-ji na-ji changed the title Add collect_execution_plans option to SQL Server DBM [SDBM-2648] Add collect_execution_plans option to SQL Server DBM Jun 9, 2026
@na-ji na-ji self-assigned this Jun 9, 2026
@na-ji na-ji marked this pull request as ready for review June 9, 2026 10:01
@na-ji na-ji requested review from a team as code owners June 9, 2026 10:01
Plans are collected by the query-metrics job and are already disabled
when query_metrics.enabled is false, so the toggle belongs there.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

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.

2 participants