Skip to content

Parameterize SQL Server agent history row limit#24206

Merged
lu-zhengda merged 2 commits into
masterfrom
zhengda.lu/SDBM-2747-parameterize-row-limit
Jun 26, 2026
Merged

Parameterize SQL Server agent history row limit#24206
lu-zhengda merged 2 commits into
masterfrom
zhengda.lu/SDBM-2747-parameterize-row-limit

Conversation

@lu-zhengda

Copy link
Copy Markdown
Contributor

What does this PR do?

Parameterizes the SQL Server Agent job history row limit by changing the query to use SELECT TOP (?) and executing it with (history_row_limit, last_collection_time). It also removes duplicated test SQL so the tests execute the production AGENT_HISTORY_QUERY directly.

Motivation

Follow-up to #24203. That PR stabilized the changing completion_epoch_time filter; this removes the remaining query text formatting for the configurable history_row_limit so both dynamic query inputs are bound parameters.

Validation so far:

  • ddev --no-interactive test -fs sqlserver
  • ddev --no-interactive test sqlserver:py3.13-linux-odbc-2022-single -- -k test_agent_history_query_parameterizes_last_collection_time

I also attempted test_connection_with_agent_history locally to exercise TOP (?) against SQL Server, but the local Docker SQL Server container failed before query execution with initerrlog: Could not open error log file '/var/opt/mssql/log/errorlog'. Operating system error = 5(Access is denied.).

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

@lu-zhengda lu-zhengda added the qa/skip-qa Automatically skip this PR for the next QA label Jun 26, 2026
@dd-octo-sts dd-octo-sts Bot added integration/sqlserver and removed qa/skip-qa Automatically skip this PR for the next QA labels Jun 26, 2026
@lu-zhengda lu-zhengda added the qa/skip-qa Automatically skip this PR for the next QA label Jun 26, 2026
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jun 26, 2026

Copy link
Copy Markdown

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 90.40% (+2.44%)

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

@lu-zhengda lu-zhengda marked this pull request as ready for review June 26, 2026 17:58
@lu-zhengda lu-zhengda requested review from a team as code owners June 26, 2026 17:58
@dd-octo-sts

dd-octo-sts Bot commented Jun 26, 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

@lu-zhengda lu-zhengda added this pull request to the merge queue Jun 26, 2026
Merged via the queue into master with commit 4dff6b2 Jun 26, 2026
140 of 146 checks passed
@lu-zhengda lu-zhengda deleted the zhengda.lu/SDBM-2747-parameterize-row-limit branch June 26, 2026 18:25
@dd-octo-sts dd-octo-sts Bot added this to the 7.82.0 milestone Jun 26, 2026
github-actions Bot pushed a commit to ConnectionMaster/integrations-core that referenced this pull request Jun 26, 2026
* Parameterize SQL Server agent history row limit

* Add SQL Server row limit changelog entry 4dff6b2
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