cmd/bosun: major notification overhaul #2135
Merged
Conversation
9 commits
Jul 27, 2017
added
cmd/bosun/conf/rule/rule.go
Outdated
n.UseBody = v == "true" | ||
default: | ||
c.errorf("unknown key %s", k) | ||
m := map[interface{}]interface{}{} |
kylebrandt
Jul 31, 2017
Member
Since this is meant to build JSON, should be a map[string]interface
or it won't marshal into JSON
Since this is meant to build JSON, should be a map[string]interface
or it won't marshal into JSON
cmd/bosun/conf/rule/rule.go
Outdated
"makeSlice": func(vals ...interface{}) interface{} { | ||
return vals | ||
}, | ||
"makeMap": func(vals ...interface{}) (interface{}, error) { |
kylebrandt
Jul 31, 2017
Member
Need to think, but avoid return errors here because we don't wan't to completely break the template. See the docs at http://bosun.org/definitions#template-error-handling
Somewhat related, we might need an "error" template type for fallback with templates error... same case with JSON.
Need to think, but avoid return errors here because we don't wan't to completely break the template. See the docs at http://bosun.org/definitions#template-error-handling
Somewhat related, we might need an "error" template type for fallback with templates error... same case with JSON.
When I set the content type with the following:
I see the content type displayed in the the UI, but when I test the notification I don't see the Content-Type header set with using |
Oops, wasn't setting headers. fixed. |
20 commits
Sep 20, 2017
added
mvuets
pushed a commit
to bookingcom/bosun
that referenced
this pull request
Apr 17, 2018
Presumably as part of the PR bosun-monitor#2135 three new global template functions were added: json, makeSlice, and makeMap. However they are not mentioned nor documented at http://bosun.org/definitions. This commit attempts to fill in the gap.
captncraig
added a commit
that referenced
this pull request
Apr 17, 2018
Presumably as part of the PR #2135 three new global template functions were added: json, makeSlice, and makeMap. However they are not mentioned nor documented at http://bosun.org/definitions. This commit attempts to fill in the gap.
michep
pushed a commit
to michep/bosun
that referenced
this pull request
Apr 23, 2018
…-monitor#2241) Presumably as part of the PR bosun-monitor#2135 three new global template functions were added: json, makeSlice, and makeMap. However they are not mentioned nor documented at http://bosun.org/definitions. This commit attempts to fill in the gap.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Makes notifications more individually configurable.
BREAKING CHANGES:
Notifications no longer support
body
inline template, oruseBody
flag. Instead, you can supplybodyTemplate
to select any pre-rendered template key on the alert's template:Old:
New:
Templates can now include arbitrarily named keys (not just subject and body anymore), and they will all be pre-rendered when the alert fires, with the full context of the alert.
Features
Can add arbitrary keys to templates, as explained above.
Templates can "inherit" another template, essentially copying all of their keys/values that are not already defined:
Notifications now support
getTemplate
andpostTemplate
to select a template to use for building urls. They havebodyTemplate
to select a template to use for post or email body (default isbody
) andemailSubjectTemplate
to select a template to use for the email subject.