* textarea with auto resize
Signed-off-by: mizukoshi-m <mizukoshi@mfeed.ad.jp>
* implement resize textarea on type
Signed-off-by: m-masataka <m.mizukoshi.wakuwaku@gmail.com>
* remove scrollHeight
Signed-off-by: m-masataka <m.mizukoshi.wakuwaku@gmail.com>
* Add new function for textarea field
Signed-off-by: m-masataka <m.mizukoshi.wakuwaku@gmail.com>
* remove unnecessary code
Signed-off-by: m-masataka <m.mizukoshi.wakuwaku@gmail.com>
* Create Silence from filters
Signed-off-by: m-masataka <m.mizukoshi.wakuwaku@gmail.com>
* Get rid of unnecessary things
Signed-off-by: m-masataka <m.mizukoshi.wakuwaku@gmail.com>
We can simplify the view flow by parsing the list
of alerts for custom grouping as soon as they are
returned to the update function.
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
Updating the api in
bc373f562f
resulted in the UI sending query strings for the
filter that no longer match what the backend
expects. This brings that in to line.
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
This patch adds HTTP headers to each web asset response, disabling
caching for the payload. This prevents users running an old version of
the UI against a new version of Alertmanager once they updated. On the
down-side it increases page load size on subsequent page loads.
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
The ELM_HOME variable needs to be set to the mounted volume
directory when building to prevent permissions errors caused
by using root as the default home dir.
Signed-off-by: Paul Gier <pgier@redhat.com>
- make clean shouldn't print errors when files/directories have already
been removed
- add copyright header to generated api files to pass license check
Signed-off-by: Paul Gier <pgier@redhat.com>
Even if an alert is already silenced and/or muted, I still want to
know that my newly created silence will affect it.
Signed-off-by: beorn7 <beorn@soundcloud.com>
If a users chooses to disable the Alertmanager cluster feature, there is
no cluster name nor cluster peers. Hence these should be optional. Only
cluster status is set to "disabled".
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
When users start Alertmanager with `--cluster.listen-address=`, the
cluster will not be initialized, hence api.peer will be `nil`. So far
this would result in a nil pointer dereference by the API v2 accessing
the api.peer field.
With this patch, api v2 skips populating the peers array, sets the name
to an empty string and the status to "disabled" in case `api.peer` is
nil.
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
* Remove inhibited/silenced text
In the alert list, this is already seen via the
icons. In the silence preview, since it's in the
silence preview, clearly it's affected by the
silence.
* Generate assets
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
With issue 1465 on openapi-generator [1] being fixed, we can not extract
shared properties of the gettable and postable alert definition into a
shared object (`alert`) like we do for silence, gettable silence and
postable silence.
In addition this patch does the following changes to the UI:
- Use `List GettableAlert` instead of plural type definition like
`GettableAlerts` because the plural definitions are not generated.
- Fix openapi-generator-cli docker image to specific hash.
[1] https://github.com/OpenAPITools/openapi-generator/issues/1465
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
Previously the api url was hardcoded in the elm logic fetching the
status of an Alertmanager. Instead it is now being passed down like we
already did for /alerts, /silences and /receivers.
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
Instead of having one general silence, differentiate between postable
and gettable silence, hence making more fields required.
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
With the previous patch /status and /silences were requested from api
v2. Requesting alerts from api v1 is done in a separate commit to be
able to revert it once alerts also come from api v2.
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
This patch makes the Alertmanager UI (/status & /silences) use the
api/v2 endpoint. In addition it adds logic to generate the elm side data
model based on the OpenAPI specification.
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
Support `w` duration when making silences. Remove
`y` as a supported duration, silences are for
short term notification prevention.
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
* Migrate from go-bindata to vfsgen
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Ensure idempotent generation for vfsgen
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* asset: update generated files
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Fix asset paths for Windows platforms
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Regenerate assets
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Add vfs wrapper that returns constant mod time
This is identical to what we had with go-bindata and avoids the extra
step of storing the identity of the complete file system in another
location.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Additional cleanup
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Use a button instead of a for buttons
Using <a> was causing an unintended redirect to
the root. It appears this behavior has changed in
0.19.
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
* bindata
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
* Include Makefile.common
* Fix the bindata.go files to make the style target happy
* Inline `.PHONY` statements
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This change replaces the deprecated InstrumentHandler function by
the equivalent functions from the promhttp package.
The following metrics are removed:
* http_request_duration_microseconds (Summary).
* http_request_size_bytes (Summary).
* http_requests_total (Counter).
And the following metrics are added instead:
* alertmanager_http_request_duration_seconds (Histogram).
* alertmanager_http_response_size_bytes (Histogram).
* promhttp_metric_handler_requests_in_flight (Gauge).
* promhttp_metric_handler_requests_total (Counter).
* Wait for the gossip to settle before sending notifications
See #1209 for details.
As an heuristic for mesh readyness, try to see if
the mesh looks stable (the number of peers isn't changing too much).
This implementation always mark the altermanager as ready after a maximum of 60s.
This adds one new flags to control this behavior:
```
--cluster.settle-timeout=60s mesh settling timeout. Do not wait more than this duration on startup.
```
It also adds `/-/ready` which always return 200 (in order to make it clear
that we are ready as soon as we can receive requests).
The mesh status is exposed in `/api/v1/status` and visible on `/#/status`.
* cluster: fix typos and base interval on gossipInterval
* wire default creator through Elm
* wire defaultCreator into localStorage
* add ui/bindata.go
* fix indentation
* change defaultCreator type from (Maybe String) to String
use an empty string as default value
* update ui/bindata.go
* Inconsistent use of baseUrl and apiUrl arguments
Both are Strings, so flipping the order between
one invocation and another didn't raise any
argument from the compiler. The baseUrl argument
is actually unnecessary, and has been removed.
* Update bindata.go
* Render status page without mesh connection (#918)
A mesh connection was assumed, even though the
value that was being passed into the helper
function was a possibly-nil pointer. Add a check
for this, and return a nil value in that case. The
frontend finds this when decoding the json
payload, and displays the "not configured"
message.
* Update bindata
* Test for consecutive chars throughout string
Previously, we were only testing for consecutive
characters at the beginning of the string. Now,
the entire string being compared is searched
through for a matching character, and then the
consecutive search starts.
We were seeing weird situations where the text
entered matched the last half of certain terms,
but because it wasn't, but because we only
searched from the start, results that probably
shouldn't have been the top suggestion were being
suggested too high on the list.
* Weight consecutive matches more highly
Bit of a guess, this seemed to give better results
for my small test case.
* bindata
We generate binaries whenever `make build-all` is run. If they already
exist, we only regenerate them if they are outdated.
When one makes changes to the front-end and runs the single command
`make build-all` on the root level Makefile, the front-end is rebuild
accordingly.
`make build-all` will use Docker to build the front-end. If someone prefers
to install all the dev dependencies on their local machine instead, one
can add the `NO_DOCKER=true` flag.
For folks that only want to make back-end changes `ui/bindata.go` is
checked in, so they do not have to build the front-end. They still use
the `make build` command as before.
When clicking on a label on the AlertList or SilenceList view, the
changed Alert/Silence query is appended to the current url. This Postfix
should not start with a slash. If it does, the url is not appended but
replaced by the browser instead resulting in a `pushState` exception.
Infer path from Navigation.Location
Build uses template, local dev uses elm-reactor
Remove unneeded local dev go server
Add script.js make target
Compiles and uglifies script.js
Before:
~570kb
After:
~170kb
Bootstrap loading state
Add trailing slash via JS & add routePrefix console param
Add Javascript script tag to `index.html` which adds a trailing slash to
the url pathname if none is present. This is done to ensure assets like
`script.js` are loaded properly.
Example without patch:
If the pathname is "mxinden.com/alertmanager" the browser will try to
download the `script.js` asset from "mxinden.com/script.js". This
request will fail.
Example with patch:
If the pathname is "mxinden.com/alertmanager", Javascript redirects the
browser to "mxinden.com/alertmanager/" and then the `script.js` asset
will be downloaded from "mxinden.com/alertmanager/script.js". This
request will succeed.
Add `-web.route-prefix` as a console parameter. This configures a
Prefix for the internal routes of web endpoints. Defaults to path of
-web.external-url like in *Prometheus*.
Trim slashes off of route prefix and add one slash at the beginning.
Make sure route prefix is not empty or just a slash before prefixing
router.
* Restructure the validation
* Validate on blur
* Extract alerts from the silence
* Use string for the error type
* Use ApiData everywhere
* Validate the form
* Remove redirect on failure
* Code review fixes
* Hide the delete button if there is one matcher
* Rename silence2
* Update bindata.go
* Fix the tests
* Actually hide the delete button
* Update bindata.go
This adds the silenced query parameter to the /alerts API endpoint. In
addition it changes the default in the UI. Previously silenced alerts
were displayed by default. This PR hides silenced alerts by default.
* Create set of labelKeys
* Wip (compiling)
* Add naive levenshtein distance
Need to check out the fzf fuzzy algo, this is just
a place holder for now.
https://github.com/junegunn/fzf/blob/master/src/algo/algo.go
* Hack a groupBy into the code
This needs massive cleanup and is just a
late-night spike. Everything in this commit needs
to be re-organized, most likely.
* Update some html/css
* Set input validation for label filtering
* Add Jaro-Winkler string comparison
* remove levenshtein stuff
* Fix match tests
* Read actual Jaro definition
if ml == 0, then the distance == 0
* Use correct searchLength implementation
* Limit searching string to matchRange
Only search matchRange when looking for matches,
instead of going through every value and then
deciding if it should be checked based on its
position.
Data generated from
https://ellie-app.com/38cXFnRLjcga1/1
matchCharmatchChar2delta
mean ops/sec
346,928.55 (stddev: 12,306.94, 3.55%)
364,551.61 (stddev: 10,561.94, 2.9%) +5.08%
mean runtime
2.886ns (stddev: 103.748µs, 3.59%)
2.745ns (stddev: 80.856µs, 2.95%) -4.87%
total runtime
5.022s
5.052s
sampling
48 runs of 30,000 calls
46 runs of 40,000 calls
* Fix off-by-one error in List slicing
* Simplify transition calculation
* Keyboard controls for the autocomplete
* Fix clicking on the results
* Rename AutoComplete to GroupBar
* Broke apart the view function
* Fix the layout
* Change button style
* Synchronize grouping with URL
* Fix tests
* Added toggle silenced alerts
* Remove comment
* Roll back the labelButton
* Always fetch the alerts
* Disable show silenced
* Extract alert groups
* Rename tests
* Use more generic number instead of int
* Restore showSilenced
* Update ui/bindata.go
* Update template/internal/deftmpl/bindata.go
* Update bindata.go
* Reformat with updated elm-format
The commit [1] introduced the `cache-control` header field with the value
`no-cache`. This enforces any cache to revalidate. Apparently this does
not prohibit *FireFox* from caching the assets. `no-cache, no-store,
must-revalidate` does by prohibiting to even save anything of the
request.
[1] c3850708c1
Instead of using the /alerts/groups endpoint to retriev alerts this
commit introduces usage of the /alerts endpoint. This bypasses a lot of
complexity by ignoring alert groups and alert blocks. Groups and blocks
are left as a pure back-end detail.
Fixes#694
This adds three more steps to the Travis tests.
1. Compile Elm -> script.js
2. Bundle html.index & script.js -> bindata.go
3. Check if bindata.go hasn't changed
* 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
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
* Export parsed configuration as JSON in /api/v1/status.
* Avoid exporting the XXX fields.
* Drop js-yaml library and use already parsed configuration.
* Go fmt + go-bindata
This fixes#559 by removing concurrent map writes to the matcher cache.
The cache was guarded by the Silence's main lock, which only used a
read-lock on queries.
The cache's get methods lazily loads data into the cache and thus
causing concurrent writes.
We just change the main lock to always write-lock, as we don't expect
high lock contention at this point and would have it in a dedicated
cache lock anyway.
Nodes with `continue: true` were being ignored,
and only the first match in the routing tree was
being highlighted.
Additionally, each node was incorrectly being set
to continue=true if nothing is received from the
API. The API sends nothing if continue=false.
This change makes actions around silences in different stages more
clear. Changes that are not allowed to be in-place are handled by
creating a new silence and deleting/expiring the old one behind the
scenes.
Currently, even if all alerts within a group are silenced, the group
summary still appears. This can take up a lot of space when many alerts
are silenced.
If all alerts in a group are silenced and 'Hide silences' is checked,
hide the empty group.
bindata was updated by running:
make assets format
Add default VictorOpsAPIURL
Add VictorOps default config
Add VictorOpsConfig struct in notifiers
Add new template tags for victorops
Add notifications logic for victorops
Compiled template tags with make assets
Remove common labels from entity_id template
Set messageType default value to CRITICAL
Recovery messageType is not configurable anymore. Firing state only allows specific keys
Make assets
Using log.Debugf
EntityID should not be configureable
Remove entity_id from template
Use GroupKey(ctx) as entity_id
Improve debug logging
Fix type of entity_id