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

[maps][geo-containment rule] boundaries are not re-fetched when query changes #157066

Closed
nreese opened this issue May 8, 2023 · 2 comments
Closed
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Maps impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas

Comments

@nreese
Copy link
Contributor

nreese commented May 8, 2023

geo-containment rule caches boundaries to avoid looking them up each time the rule is executed. However, there is no logic to refetch boundaries when data view, field name, or query changes.

https://github.com/elastic/kibana/blob/main/x-pack/plugins/stack_alerts/server/rule_types/geo_containment/geo_containment.ts#L150

const { shapesFilters, shapesIdsNamesMap } = state.shapesFilters
      ? state
      : await getShapesFilters(
          params.boundaryIndexTitle,
          params.boundaryGeoField,
          params.geoField,
          services.scopedClusterClient.asCurrentUser,
          logger,
          ruleId,
          params.boundaryNameField,
          params.boundaryIndexQuery
        );

Work around - users have to delete the rule and re-create a new rule to apply to change any boundary query state.

@nreese nreese added bug Fixes for quality problems that affect the customer experience Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Feature:Maps labels May 8, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@nreese nreese self-assigned this May 12, 2023
nreese added a commit that referenced this issue May 17, 2023
…query changes (#157408)

Fixes #157068 and
#157066

<img width="800" alt="Screen Shot 2023-05-11 at 10 16 31 AM"
src="https://github.com/elastic/kibana/assets/373691/3ee3b573-f3f9-497f-afef-1927f43681a7">

Throwing errors provides better user feedback when alerting rules
encounter problems. PR updates tracking containment rule to throw when:
* No tracking containment boundaries are found. Prior to this PR, entity
containment search request would throw because "filters" was undefined.
Root cause of #157068
* Throw when entity containment search request throws. Prior to this PR,
entity containment search request failure was just logged as server
warning.

PR updates boundaries cache to refresh whenever any parameters change
that result in boundary filters needing to be updated, resolving
#157066

PR defines common type "RegisterRuleTypesParams" for
registerBuiltInRuleTypes parameter to avoid duplicate type definitions
for the same thing.

PR also cleans up some tech debt in tracking containment rule
* "alert" name replaced with "rule" some time ago. PR renames
"alert_type" to "rule_type".
* Breaks types defined in "alert_type" into separate "types" file
* Breaks "geoContainment.ts" and "geoContainment.test.ts" files into
separate files, "executor.ts", "lib/get_entities_and_generate_alerts",
and "lib/transform_results.ts"
* Renames type "GeoContainmentParams" to "GeoContainmentRuleParams"
* Renames type "GeoContainmentExtractedParams" to
"GeoContainmentExtractedRuleParams"
* Renames type "GeoContainmentState" to "GeoContainmentRuleState"
* Renames type "GeoContainmentInstanceState" to
"GeoContainmentAlertInstanceState"
* Renames type "GeoContainmentInstanceContext" to
"GeoContainmentAlertInstanceContext"
* Renames type "GeoContainmentAlertType" to "GeoContainmentRuleType"

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
jasonrhodes pushed a commit that referenced this issue May 17, 2023
…query changes (#157408)

Fixes #157068 and
#157066

<img width="800" alt="Screen Shot 2023-05-11 at 10 16 31 AM"
src="https://github.com/elastic/kibana/assets/373691/3ee3b573-f3f9-497f-afef-1927f43681a7">

Throwing errors provides better user feedback when alerting rules
encounter problems. PR updates tracking containment rule to throw when:
* No tracking containment boundaries are found. Prior to this PR, entity
containment search request would throw because "filters" was undefined.
Root cause of #157068
* Throw when entity containment search request throws. Prior to this PR,
entity containment search request failure was just logged as server
warning.

PR updates boundaries cache to refresh whenever any parameters change
that result in boundary filters needing to be updated, resolving
#157066

PR defines common type "RegisterRuleTypesParams" for
registerBuiltInRuleTypes parameter to avoid duplicate type definitions
for the same thing.

PR also cleans up some tech debt in tracking containment rule
* "alert" name replaced with "rule" some time ago. PR renames
"alert_type" to "rule_type".
* Breaks types defined in "alert_type" into separate "types" file
* Breaks "geoContainment.ts" and "geoContainment.test.ts" files into
separate files, "executor.ts", "lib/get_entities_and_generate_alerts",
and "lib/transform_results.ts"
* Renames type "GeoContainmentParams" to "GeoContainmentRuleParams"
* Renames type "GeoContainmentExtractedParams" to
"GeoContainmentExtractedRuleParams"
* Renames type "GeoContainmentState" to "GeoContainmentRuleState"
* Renames type "GeoContainmentInstanceState" to
"GeoContainmentAlertInstanceState"
* Renames type "GeoContainmentInstanceContext" to
"GeoContainmentAlertInstanceContext"
* Renames type "GeoContainmentAlertType" to "GeoContainmentRuleType"

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Nick Peihl <nickpeihl@gmail.com>
@nreese
Copy link
Contributor Author

nreese commented Jun 14, 2023

Closed by #157408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Maps impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
Development

No branches or pull requests

2 participants