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

AlertFiltering: add restrictAlertsToExactLocation #18603

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

cklin
Copy link
Contributor

@cklin cklin commented Jan 27, 2025

This commit introduces a new extensible predicate restrictAlertsToExactLocation, which is similar to the existing restrictAlertsTo predicate but matches alert locations exactly.

restrictAlertsToExactLocation is intended for situations such as testing, where we know the exact alert location and want to distinguish between alert locations that are potentially on the same line.

This commit rephrases the documentation for the restrictAlertsTo
predicate and renames the predicate columns for clarity. The new
documentation should be equivalent to the old documentation, except
allowing for the possibility that there may be multiple alert filtering
predicates.
@cklin cklin force-pushed the cklin/restrict-alerts-to-exact branch from de8805e to 1d39110 Compare January 28, 2025 15:52
@cklin
Copy link
Contributor Author

cklin commented Jan 28, 2025

I am not expecting any performance change from this PR, in the common case where restrictAlertsToExactLocation is small (like restrictAlertsTo).

I ran some local performance tests with apache__hadoop-common, restricting diff-informed queries to a single alert. Here are the "Total time spent evaluating predicates" results:

  • Using restrictAlertsTo on main: 206.1s
  • Using restrictAlertsTo on this PR: 206.3s
  • Using restrictAlertsToExactLocation on this PR: 205.8s

The evaluation times are close enough to support the case that performance of diff-informed queries remain unchanged.

I also verified that alert filtering works properly for both restrictAlertsTo and restrictAlertsToExactLocation.

@cklin cklin marked this pull request as ready for review January 28, 2025 21:26
@Copilot Copilot bot review requested due to automatic review settings January 28, 2025 21:26

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

shared/util/ext/default-alert-filter.yml:11

  • The newly introduced extension 'restrictAlertsToExactLocation' lacks explicit test coverage. Please add or update tests to verify it functions as expected.
      extensible: restrictAlertsToExactLocation

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

@cklin cklin requested review from hmakholm and asgerf January 28, 2025 21:27
@cklin cklin added the no-change-note-required This PR does not need a change note label Jan 28, 2025
Copy link
Contributor

@hmakholm hmakholm left a comment

Choose a reason for hiding this comment

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

Looks broadly OK from my point of view. Not pretty, but I understand the rationale for needing it.

Comment on lines +44 to +49
* Note that an alert that is not accepted by this filtering predicate may still be included in the
* query results if it is accepted by another active filtering predicate in this module. An alert is
* excluded from the query results if only if (1) there is at least one active filtering predicate,
* and (2) it is not accepted by any active filtering predicate.
Copy link
Contributor

Choose a reason for hiding this comment

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

The duplication of these paragraphs between the two sets of QLDoc feels a bit awkward. Is there a way to have it appear only once, e.g. in a comment for the whole file?

If that is not possible, it might still be better to explicitly separate the general rules from the ones that are specific to the filtering predicate in question. As it is, each predicate has two general paragrams ("Note that an alert ..." as well as "A query should either perform ...") interlaced with specific information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My main goal is to ensure that the qldoc for each filtering predicate provides all relevant information for the behavior and the use of that predicate, as I consider the predicate qldoc to be the only piece of documentation that everyone can be reasonably expected to read. That is why some of the same text appears in both qldocs.

When seeing both qldocs together in the source code, I understand that the duplication feels redundant and messy, especially when common information is interleaved with specific information. That said, qldoc can appear outside the context of the QL source code, and one qldoc may be shown without the other. I want to optimize for the ease of understanding for each qldoc by itself, even at the risk of being overly verbose.

Which is not to say that the qldocs are above criticism—I am sure there is a lot of room for improvement, and I am happy to hear your suggestions. Though I will also assess any suggestions using the criteria outlined above, unless someone makes a good case that those are not the goals to optimize for.

Copy link
Contributor

Choose a reason for hiding this comment

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

When I write a long piece of duplicated QLDoc like that, I like to end it with "See also: [names of the predicates with similar QLDoc]". Then future maintainers are also alerted to the coupling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I write a long piece of duplicated QLDoc like that, I like to end it with "See also: [names of the predicates with similar QLDoc]". Then future maintainers are also alerted to the coupling.

Thanks. I updated the PR to add the cross references.

asgerf
asgerf previously approved these changes Jan 29, 2025
Copy link
Contributor

@asgerf asgerf left a comment

Choose a reason for hiding this comment

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

Looks good from my perspective. I don't have a strong opinion about the QLDoc issue.

This commit introduces a new extensible predicate
restrictAlertsToExactLocation, which is similar to the existing
restrictAlertsTo predicate but matches alert locations exactly.
@cklin cklin force-pushed the cklin/restrict-alerts-to-exact branch from 1d39110 to 96caa68 Compare January 29, 2025 15:51
@cklin cklin requested review from jbj and asgerf January 29, 2025 15:52
Copy link
Contributor

@asgerf asgerf left a comment

Choose a reason for hiding this comment

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

Still LGTM

Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

The stage timing changes in DCA look like noise to me.

@cklin cklin merged commit b3b7817 into main Jan 30, 2025
22 checks passed
@cklin cklin deleted the cklin/restrict-alerts-to-exact branch January 30, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants