Skip to content

Refactor to share state across Internal Events CLI

Sarah Yasonik requested to merge syasonik-master-patch-eb31 into master

What does this MR do and why?

Overview: Refactors the internal events cli in preparation of supporting the ability to configure filtering events in metrics in the cli. There are no changes to the expected behavior of the CLI in this MR.

Recommended: To review, check out the branch and look at the files in their entirety; the structure of the classes is clearer in context

Changes include:

  • sets up a class with shared state across all flows, so event/metric definitions are loaded only initially and after file saves
  • separates out helper classes for existing definitions and new definitions --> reading & writing are pretty different, so gets rid of some hacky workarounds
  • moves description/presentational logic for distributions/time frame/identifiers/etc into their own helper classes to make it easier to isolate behavior
  • a tiny bugfix in displaying metric options for multiple selected events; only existing metrics should be disabled, but the previous logic overzealously disabled metrics for which any of the selected events had that type of metric (an uncommon edge case, but still)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. run ruby scripts/internal_events/cli.rb
  2. create an event, metrics, view usage --> all should behave the same
Edited by Sarah Yasonik

Merge request reports

Loading