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

Sensu 2.0 Readiness: Handler Mapping #189

Open
jspaleta opened this issue Jul 24, 2018 · 1 comment
Open

Sensu 2.0 Readiness: Handler Mapping #189

jspaleta opened this issue Jul 24, 2018 · 1 comment

Comments

@jspaleta
Copy link
Contributor

Problem

Handlers in the plugin collection might not work as expected due to changes in the internal event json object.

It should be possible to provide a mapping from 2.0 back to 1.4 event as a dedicated method to the Handler class, so that anyone making use of the sensu-plugin gem can keep their handlers working through the transition for native 2.0 handling.

Where to place the mapping logic for handlers

Call method in Handler initialize. Maybe also wrap logic with a boolean argument so that handler users will have to explicitly enable remapping if its desired.

When to engage mapping method?

if handler doesn't support 2.0 data natively
or
if handler was explicitly told to engage mapping via cmdline argument

How can you tell its a 2.0 data packet?

If entity key is populated and client key is not

Mapping so far

This list could change has more testing and reviews are done.

Non-Destructive Mapping 2.0 -> 1.4

These should be save re-mapping actions as they regenerate missing json keys.

  1. copy entity -> client
  2. entity.id -> id
  3. cp entity.subscriptions -> client.subscribers
  4. cp timestamp -> client.timestamp
  5. cp check.subscriptions -> check.subscribers
  6. create check.type
  7. cp check.total_state-change -> check.total_state_change

Destructive Mapping

This changes will cause a break in 2.0 event handling. Not clear if this is needed to keep existing handlers in the collection working.

  1. reformat check.history

Unknown Mapping

Its not clear on first inspection how to repopulate these 1.4 event keys. Not clear if these are needed to get existing handlers in the collection working.

  1. action
  2. last_state_change
  3. silenced
  4. silenced_by
@jspaleta
Copy link
Contributor Author

PR #190 with prototype shim to fix things up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant