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

Omit field if missing from event #60

Open
warmfusion opened this issue Jan 22, 2018 · 3 comments
Open

Omit field if missing from event #60

warmfusion opened this issue Jan 22, 2018 · 3 comments

Comments

@warmfusion
Copy link

  • Given fields are configured
  • When an event is submitted which does not include an entry for that field
  • Then the slack message sent should not include the field element

Scenario

Using fields for tips or url links in alert configurations. Sometimes our alerts include them, sometimes they dont. In all cases currently the message includes blank sections which isn't very attractive.

There may be an argument for showing the field name and not including a value at all to demonstrate that the user hasn't included this information, but that seems to be implict based on its absence on a message?

@majormoses
Copy link
Member

I definitely see the value although I think there should be an option for it but the default should be off.

Reasons why it should default off:

  • remaining backwards compatible
  • I think that is an excellent way to prompt people to start writing those tips/links/runbooks when they resolve the incident they should think about adding it.

@warmfusion
Copy link
Author

So would you be thinking of an ignore_field_if_missing: true flag?

Or perhaps a more structural change to fields themselves, eg

fields:
 {
      "list": nil,
      "clientkeys": "A default value",
      "to_render": 123
}

Such that the assigned value is used as a default, and if set to nil is simply omitted from display if no client value has set it.

Note; I have an extended use case/pull request to develop which will include event field custom values in this listing, such that events themselves can include metadata to submit on alerts

@majormoses
Copy link
Member

How about include_missing_fields with a default of true. I generally dislike having "negative" variable/option names in code when dealing with booleans. The reason is that it is much clearer and avoids needing to eval true as false when I am quickly reviewing code/documentation I am unfamiliar with.

I suppose we could make a more structural change and have a render flag and if evals nil||true we would include it. If it evals as false we would not render.

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

No branches or pull requests

2 participants