Fixes#721
I was using the RunE method of cobra.Command which does things with an
error returned from a function. I doesn't seem possible to keep it from
printing usage every time, so I've make a wrapper to use the other
function.
Turn the GroupKey into a string that is composed of the matchers if the
path in the routing tree and the grouping labels.
Only hash it at the very end to ensure we don't exceed size limits of
integration APIs.
* Implement alertmanager cli tool 'amtool'
The primary goal of an alertmanager tool is to provide a cli interface
for the prometheus alertmanager.
My vision for this tool has two parts:
- Silence management (query, add, delete)
- Alert management (query, maybe more in future?)
Resolves: #567
* Update elm-tools/parser
* Improve filter UI
* Pressing backspace edits the last matcher
* Put escape char back into the output
* Allow editing the matcher
* Update bindata.go
* Const for key codes
* Use qualified imports
* Update bindata.go
* Commented the backspacePressed attribute
Building a hash over an entire set of alerts causes problems, because
the hash differs, on any change, whereas we only want to send
notifications if the alert and it's state have changed. Therefore this
introduces a list of alerts that are active and a list of alerts that
are resolved. If the currently active alerts of a group are a subset of
the ones that have been notified about before then they are
deduplicated. The resolved notifications work the same way, with a
separate list of resolved notifications that have already been sent.
By passing "-modtime 1" flag into go-bindata command it uses the same
unix timestamp (1) for every file in the fake filesystem. Thereby every
execution of "make assets" results in the same asset outputs if the
inputs were the same. This forces us to set the "Cache-Control"
attribute to "no-cache".
* Clicks update alerts filter text
- Normal click replaces filter with selected label
- Modifier (ctrl, cmd) + click appends to filter
* Auto-filter when clicking labels
* ctrl+click removes already present matcher
* Match arbitrary whitespace before/after comma
* Run elm make with --yes
* Always add labels to the filter
* Updating filter currently sends Noop msg
For now we are still going to require the user to
explicitly click "filter" before we send an API
request to update the list.
* Extract a model for the silence form
* Use empty in initSilenceForm
* Use plural silences in urls
* Populate matchers from alert
* Updating bindata.go file
* Including glue between Alertmanager server and Elm UI.
* Rebuilding assets (ui/bindata.go).
* Exact commit: 'bd78de6b16bcefaacf4229304d439b33aa09cc72'
* Subdirectory: ui/app
* Extract update function from Main.elm into Updates.elm
* Refactor Alerts view to use MsgForAlerts instead of Translator
Related to Issue #8
* Prevent decode failure when alert annotation is not present
Previously if one alert wouldn't have an annotation field the entire
decoding of the block would fail, due to the Maybe unwrapping of the
block type (line 46). Now if an alert does not have an annotation field
it just returns an empty list for that alert instead.
Fixes#11
* Move AlertList code to Views/AlertList/.
Related to issue #8
* Move Alert entity related types to Alerts/Types.elm
Related to issue #8
* Refactor Silences view to use MsgForSilences instead of Translator
Related to issue #8
* Move Silences view code to Views/SilenceList
TODO: Split up SilenceList into SilenceList, SilenceEdit, SilenceView,
Related to issue #8
...
* Rename MsgFor{Alerts,Silences} to MsgFor{AlertList,SilenceList}
Related to issue #8
* Seperate SilenceView from SilencesListView
Extracting all SilenceView related code to seperate
Views/Silence/{Views,Types,Parsing,Updates} files.
Related to Issue #8
* Seperate SilenceForm from SilencesListView
Extracting all SilenceForm related code to seperate
Views/SilenceForm/{Views,Types,Parsing,Updates} files.
Related to issue #8
* Flatten route tree
Instead of having sub routes under silences this commit flattens the
route tree and introduces the SilenceListRoute as a top level route.
Related to issue #8
* Run elm-format on entire elm code base
* Introduce NotFoundPage to prevent default case conditions
Having (_ ->) in case declarations is error-prone. This removes them in
the routing code.
* Move Status view code to Views/Status/.
Introduce InitView event to keep logic inside view update function
instead of global update function
Related to issue #8
* Introduce Init*View pattern to SilenceView
Instead of triggering the initialization of the view (loading silences,
loading alerts, ...) inside the global update function, the global
update function just triggers the message Init*View which is picked up
by e.g. the Silence update function which then triggers requesting the
silence.
Related to issue #8
* Remove unused Silences Msg and corresponding update case
* Remove unused Alerts Msg and corresponding update case
* Prevent empty filters to be specified
If the user inputs only a space into the filter textbox it crashes the
request to the server.
* Move NavBar code into Views folder
Additionally making silence available under /silence/<id>.
* Use type variable "msg" instead of concrete type "Msg"
Related to issue #8
* Use import alias on qualified view imports
Related to issue #8
* Rename {edit,new}Form to {new,edit} in SilenceForm.Views
Related to issue #8
* Pass only model.silence and not the entire model down to SilenceForm
Related to issue #8
* Refactor AlertListCompact.views function
Credit goes to @w0rm.
Related to issue #8
* Refactor SilenceBase.view function
Related to issue #8
* Refactor Views.Silence.Updates.update function
Related to issue #8
* Refactor Alerts.Types and global parsing function
Related to issue #8
* Remove accidentally added files
Instead of using ForSelf and ForParent, messages are wrapped by a message
per view, like e.g. MsgForStatus. The global update function then hands
each message to its corresponding sub-update function. So the message
"MsgForStatus getStatus" is redirected to the Status.Update.update
function.