-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C#/Java/Rust: Improve database quality diagnostics query. #20366
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
C#/Java/Rust: Improve database quality diagnostics query. #20366
Conversation
6b0657b to
cafe644
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the database quality diagnostics message for C# by including specific health metrics in the diagnostic output. The enhancement provides users with concrete percentage values for call targets and expression types to help them better understand database quality issues.
Key changes:
- Enhanced diagnostic message to include specific database health metrics with percentage values
- Refactored the diagnostic creation logic to capture and display both call target and expression type statistics
- Updated expected test outputs to reflect the new message format
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| csharp/ql/src/change-notes/2025-09-04-database-diagnostics.md | Documents the enhancement to include database health metrics in diagnostic messages |
| csharp/ql/src/Telemetry/DatabaseQualityDiagnostics.ql | Refactors diagnostic logic to capture specific metrics and updates the diagnostic message format |
| csharp/ql/integration-tests/all-platforms/standalone/DatabaseQualityDiagnostics.expected | Updates expected test output to match the new diagnostic message format |
cafe644 to
02e2b65
Compare
02e2b65 to
70b3a46
Compare
|
|
||
| private string getDbHealth() { | ||
| result = | ||
| callMsg + ": " + callTargetOk.floor() + ". " + exprMsg + ": " + exprTypeOk.floor() + ". " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
| callMsg + ": " + callTargetOk.floor() + ". " + exprMsg + ": " + exprTypeOk.floor() + ". " | |
| callMsg + ": " + callTargetOk.floor() + "%. " + exprMsg + ": " + exprTypeOk.floor() + "%. " |
?
| | | ||
| percentageGood < 95 | ||
| ) | ||
| TTheDbQualityDiagnostic(string callMsg, float callTargetOk, string exprMsg, float exprTypeOk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about instead:
private predicate diagnostic(string msg, float value, float threshold) {
CallTargetStatsReport::percentageOfOk(msg, value) and
threshold = 85
or
ExprTypeStatsReport::percentageOfOk(msg, value) and
threshold = 85
}
private newtype TDbQualityDiagnostic =
TTheDbQualityDiagnostic() {
exists(float percentageGood, float threshold |
diagnostic(_, percentageGood, threshold) and
percentageGood < threshold
)
}
...
private string getDbHealth() {
result =
strictconcat(string msg, float value, float threshold |
diagnostic(msg, value, threshold)
|
msg + ": " + value.floor() + " % (threshold " + threshold.floor() + " %)", ". "
)
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, considering the discussion on the posibility of having different thresholds pr metric - then this looks very good.
I will address the review comments for C# and when we have reached consensus, I will update for the other languages as well (in this PR).
hvitved
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing.
ae516ee to
29c22e6
Compare
hvitved
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again.
No description provided.