-
Notifications
You must be signed in to change notification settings - Fork 41
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
enforce that composite monitors use links #197
Conversation
Observations (not necessarily problems):
|
1: it requires some code changes, but not too bad I'd hope |
@@ -238,6 +239,8 @@ def validate_json(data) | |||
validate_message_variables(data) | |||
end | |||
|
|||
validate_using_links(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer a boolean setting:
validate_using_links(data) | |
validate_using_links(data) if require_using_links |
Having a "setting" where the two values are "method with logic" or "override with a no-op block" is ... a weird way of programming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Particularly when the method/block in question effectively returns void
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it's not very smooth ... some more general skip_validations: [:foo]
might be nicer ... but that's more refactoring and can be it's own PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another option would be
eval "->(*) { v }", nil, file, line.to_i
to use validate_using_links: false
but that ends up making any setting callable which could end up ugly too
@@ -27,11 +27,12 @@ class Monitor < Record | |||
}.freeze | |||
DEFAULT_ESCALATION_MESSAGE = ["", nil].freeze | |||
ALLOWED_PRIORITY_CLASSES = [NilClass, Integer].freeze | |||
ALLOWED_UNLINKED = [] # rubocop:disable Style/MutableConstant placeholder for custom overrides |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If (when) we extend this validation to other linking types - e.g. monitor widgets in dashboards – what will ALLOWED_UNLINKED look like then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will need to move up into Kennel::ALLOWED_UNLINKED
but the structure can stay the same
7656d74
to
40c9052
Compare
No description provided.