Add metric_agg_script to MetricAggregationRule #558
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Copied from SpikeMetricAggregationRule, which originally copied
generate_aggregation_query from MetricAggregationRule and added these
two lines.
So this commit just makes the two generate_aggregation_query look the
same, which just works and I'm not really sure why no one has done it
before.
Should not be a breaking change since it just adds an optional rule attribute.
Checklist
make test-docker
with my changes.Questions or Comments
No idea how to unit test this. It runs against a mocked elasticsearch, right? I was planning to not write any until I saw this checklist so uh, that's a tomorrow problem.
Most of my manual testing was with an out of tree extension, but I haven't gotten around to test this specific version of the code, so that one is unchecked.
I can't really add a changelog entry before creating the pull request.About the code: to be honest, this is a really lazy change, but it follows the trend of someone copypasting one version of
generate_aggregation_query
, modifying it a little and never applying that change to the original.I don't know what's the best way to deduplicate these things, and doing something like
MetricAggregationRule.generate_aggregation_query(self)
would be needlessly obscure imo. Can't really deduplicate the docs.