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

Allow mapping event types to groups using regexes #17772

Merged
merged 1 commit into from
Aug 10, 2018

Commits on Aug 9, 2018

  1. Allow mapping event types to groups using regexes

    Up until now, in order to associate an event type with an event group,
    we needed to spell out events full name in settings file under
    appropriate event group category and level.
    
    Some of the providers have hundreds of event types, which makes
    filling all this information in tedious and error prone. Not to
    mention that settings file is now one giant pile of event types.
    
    In order to make process of registering event types scale a bit
    better, this commit adds support for registering a class of event
    types that match specified regular expressions. Simple example:
    
        :ems:
          :ems_dummy:
            :event_handling:
              :event_groups:
                :addition:
                  :critical:
                  - dummy_event01_add
                  - dummy_event02_add
                  :detail:
                  - dummy_event03_add
                  - dummy_event04_add
                  ...
                  - dummy_event70_add
                  - dm_event_create
    
    This can now be written as
    
        :ems:
          :ems_dummy:
            :event_handling:
              :event_groups:
                :addition:
                  :critical:
                  - dummy_event01_add
                  - dummy_event02_add
                  :detail:
                  - dm_event_create
                  - !ruby/regexp /^dummy_event[0-9]{2}_add$/
    
    We took a great deal of care not to break existing code, so non-regex
    event type mappings take precedence over regular expression matches.
    For example, in our sample above, dummy_event_02_add gets assigned
    critical level despite also matching detail regex.
    
    Note that if sets of event types that are matched by regular
    expressions are not disjoint, then there will be multiple valid event
    type mappings. In this case, event types that match more than one
    group and/or level get assigned an arbitrary one.
    Tadej Borovšak committed Aug 9, 2018
    Configuration menu
    Copy the full SHA
    85e3008 View commit details
    Browse the repository at this point in the history