C#/Java/Rust: Improve database quality diagnostics query.#20366
C#/Java/Rust: Improve database quality diagnostics query.#20366michaelnebel merged 10 commits intogithub:mainfrom
Conversation
6b0657b to
cafe644
Compare
There was a problem hiding this comment.
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.
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.
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.
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).
ae516ee to
29c22e6
Compare
No description provided.