Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for sampling idle recently active sessions #19479

Merged
merged 11 commits into from
Jan 24, 2025

Conversation

nenadnoveljic
Copy link
Contributor

@nenadnoveljic nenadnoveljic commented Jan 24, 2025

What does this PR do?

Adds an option to sample recently active idle sessions.

Motivation

Improve APM/DBM correlation by ~3x.

For example, the execution plan for the query below, which ran in 2ms, was captured only after several executions:

image

Details

Capturing queries is essential for APM/DBM correlation. Currently, only active sessions are sampled, missing many fast queries. By sampling idle sessions that were recently active, we can significantly increase the number of captured queries.

Trade off

The option is disabled by default because, in SQL Server, identifying queries from idle sessions requires a second scan, doubling activity collection time.

Dependencies

Sampled idle sessions are excluded from the active sessions graph but appear in the samples with the Wait Event set to Other. If we don't filter them, they should be marked as Idle.

image

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • 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

@nenadnoveljic nenadnoveljic changed the title Add option for sampling idle recently active session Add option for sampling idle recently active sessions Jan 24, 2025
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.

Project coverage is 89.47%. Comparing base (35e3533) to head (36738f6).
Report is 15 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
presto ?
solr ?
sqlserver 91.59% <93.93%> (+9.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@nenadnoveljic nenadnoveljic added the qa/skip-qa Automatically skip this PR for the next QA label Jan 24, 2025
@nenadnoveljic nenadnoveljic marked this pull request as ready for review January 24, 2025 18:39
@nenadnoveljic nenadnoveljic requested review from a team as code owners January 24, 2025 18:39
lu-zhengda
lu-zhengda previously approved these changes Jan 24, 2025
@nenadnoveljic nenadnoveljic added this pull request to the merge queue Jan 24, 2025
Merged via the queue into master with commit 06d858a Jan 24, 2025
35 checks passed
@nenadnoveljic nenadnoveljic deleted the nenadnoveljic/sqlserver-idle-sessions branch January 24, 2025 21:01
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