50 Commits

Author SHA1 Message Date
Łukasz Mierzwa
9c16ffa447 chore(project): rename from unsee to karma
Fixes prymitive/unsee#23
2018-09-09 14:12:26 +01:00
Łukasz Mierzwa
e04f74cc5e fix(style): move some code out of alerts() to reduce complexity and make the linter happy 2018-09-09 12:01:15 +01:00
Łukasz Mierzwa
440354de89 feat(api): always provide color information for foo=bar filters 2018-09-09 11:46:45 +01:00
Łukasz Mierzwa
129ffb7e17 fix(test): use httptest.newRequest instead of (incorrect) http.newRequest
httptest.newRequest is suppose to be used for testing request handing, http.newRequest is for preparing outgoing requests, this allows to fix cache key selection and increase test coverage
2018-08-21 09:35:49 +01:00
Łukasz Mierzwa
77079a9629 feat(api): export annotation settings in the API 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
32e3f946ab refactor(backend): turn index.html back into Go template
There are a few config keys that needs to be passed to ui code before react app starts, we'll render them in the index.html as template
2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
2ee239a74c refactor(api): move settings keys in the API response to a namespace 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
be8806c22f feat(ui): remove old /help view, this is now fully managed by the ui 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
875a4f5217 feat(api): summarize alertmanager counts in group API 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
6c7ba5551c refactor(api): move silences into a dedicated key in API response
A single silence can supress multiple alerts so to reduce response size and the amount of data react UI needs to track move it out of alert instance (which will deduplicate it) and on each alert only store a reference. In the API return all silences as a global dict and each alert only contains the ID of silences suppressing it.
2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
79ff668019 refactor(api): deduplicate lables & annotations in API responses
Each alert in a group holds only keys that are unique to that alert instance, everything shared by the entire group is moved to group.shared ns
2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
e1530e01cd refactor(api): provide configured list of static labels in the API response
DOM data-* attributes are no longer used for this, feed react data store with this config so it can (re)render labels correctly
2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
8b060054d7 refactor(api): expect filter query args as an array instead of a single string
Using a single string separated by ',' means that we cannot use ',' in labels. Use arrays instead to fix that
2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
4fe19c3d73 feat(api): extra fields with parsed filter data in the API response 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
a4a20ea3ef feat(ui): new UI written in React 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
c0fdb71276 feat(api): expose total alerts counter in the api response 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
b7d274c93b refactor(api): return alert groups as a mapping id->group 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
5a51898e43 fix(filters): don't return empty filters in the API response 2018-07-19 23:38:11 +02:00
Łukasz Mierzwa
b71883f1ef Migrate to new repo
Forked unsee from cloudflare, so import paths needs to be updated
2018-06-07 15:30:57 +02:00
Łukasz Mierzwa
65a27b39df Move label coloring config options from 'color' to 'labels' section 2017-12-03 10:09:17 -08:00
Łukasz Mierzwa
6273a5a585 Rewrite flag & env handling to use viper
This adds support for reading configuration from file, env support is still there and legacy env variables will still work, but flags are now following config schema, so they don't match old flags.
Having a config file allows to express more complex configuration options, which is needed for some feature requests.
2017-11-27 20:34:36 -08:00
Łukasz Mierzwa
5d4ae47888 Convert all packages to be internal
Internal packages are supported by Go 1.5+, any package in /internal/ dir is only importable from the same repo. This will cleanup main dir a bit and provide better namespace for unsee subpackages
2017-08-04 16:21:27 -07:00
Łukasz Mierzwa
f202232be8 Version all bundles
This will tell webpack to add a hash to all bundles filenames, we generate script tags for loading those and inject them as templates. No more forced cache bypassing
2017-07-29 16:19:48 -07:00
Łukasz Mierzwa
4a75acfdc1 Fix asset paths in tests 2017-07-29 13:53:40 -07:00
Łukasz Mierzwa
8f5c246297 Move to fully webpack managed assets 2017-07-29 13:52:07 -07:00
Łukasz Mierzwa
81ce5d3098 Speed up alert fingerprint generation
Dynamic fingerprints made the code much slower, pprof shows they are responsible for ~70% of all cpu usage for any API call. To make it worse they are applied to all alerts, since dedup layer doesn't know which alerts will be filtered later, it operates on all of them. This PR will:
1. add benchmarks to so it's easier to track performance
2. Keep current methods for accessing fingerprints, but use precomputed static fields in those
3. Refactor Alert methods to use pointers, so we're not working on a copy

Benchmark timing went down from ~4000ns to 0.4ns for fingerprint calls and API response times from 1.3s (for my test sample) to 0.2s, which puts it back to the same level as before moving fingerprints to be dynamic. I still don't like this code much, it's all over the place, but I don't have a good idea how to better structure this, let's hope I'll be wiser in the future.
2017-07-05 23:35:00 -07:00
Łukasz Mierzwa
71c0dce1f6 Vendor renamed Sirupsen/logrus to sirupsen/logrus, fix imports 2017-07-02 10:12:33 -07:00
Łukasz Mierzwa
6f1e58d387 Don't flush cache on failed instances
Cache handling is done in the upstream handling code, this isn't needed anymore
2017-07-01 12:54:30 -07:00
Łukasz Mierzwa
721b4f8be4 Update silence form to work with multiple Alertmanager instances 2017-06-28 22:36:26 -07:00
Łukasz Mierzwa
c5724bb751 Handle per Alertmanager instance errors in the API and the UI 2017-06-28 22:36:25 -07:00
Łukasz Mierzwa
16be1627ed Move all *InSlice functions into a slices package 2017-06-28 22:36:25 -07:00
Łukasz Mierzwa
26d14d1bd2 Refactor Alertmanager API client code to use multiple upstream instances
Alerts are stored per instance and deduplicated on read.
2017-06-28 22:35:16 -07:00
Łukasz Mierzwa
23f70880dc Reverse sort on autocomplete data
This way =~ hints will be first, instead of !=. It probably makes sense to have smarter ordering, but this will do for now.
2017-06-13 09:37:34 -07:00
Łukasz Mierzwa
6d15a82e89 Support multiple receivers 2017-06-03 13:23:51 -07:00
Łukasz Mierzwa
8a77d620fd Rename @status to @state
Fixes #104

@status filter was added to the master branch to support new status key from Alertmanager >=0.6.1
status ended up being nested in Alertmanager (it was added to solve AM issue 609 and that was a long PR with lots of changes), current unsee implementation ended being slightly off with how Alertmanager is naming this, it should actually be @state rather than @status.
2017-05-23 21:52:08 +01:00
Łukasz Mierzwa
12521e25bc Use gray color for alert groups with only unprocessed alerts
Expose counts of all alert statuses in each group (active, suppressed, unprocessed) instead of only active, and if a group contains only unprocessed alerts then color it as gray
2017-05-10 10:58:19 +01:00
Łukasz Mierzwa
0d55311a9d Replace @silenced & @inhibited filters with @status
Now that Alertmanager provides status=(unprocessed|suppressed|active) in the API it doesn't make sense to keep having separate filters for each value, merge @silenced & @inhibited into a single filter, update docs and UI
2017-05-05 13:56:48 +01:00
Łukasz Mierzwa
487d7bcde8 Use alert status, inhibitedBy & silencedBy fields instead of silenced & inhibited 2017-05-01 22:20:12 +01:00
Łukasz Mierzwa
d5916c81cf Add support for creating silences directly from unsee UI
It adds a button next to the @silenced filter that shows a modal window with a silence form. API request is send via AJAX call from user browser.
2017-04-20 17:01:52 -07:00
Łukasz Mierzwa
5fe3f706af If we only have silenced or inhibited alerts make the whole alert group green
This will make the UI present inhibited alerts same way as silenced. It also drops unused fields in the model, replacing SilencedCount & UnsilencedCount with only ActiveCount
2017-04-19 15:43:13 -07:00
Łukasz Mierzwa
10ef33afdf Expose number of inhibited alerts in the /alerts.json response
This is so that the UI can take use of it
2017-04-17 14:06:30 -07:00
Łukasz Mierzwa
f0579b087b Rename models, strip Unsee prefix
Now that models package contains only unsee specific models rename everything stripping Unsee prefix from names
2017-04-06 19:24:48 -07:00
Łukasz Mierzwa
0a0e3b0d16 Refactor store code to be a little less ugly
This makes the code a little bit cleaner and safer, as it moves lots of locks into the store package, but it could still use some work.
2017-04-01 16:26:39 -07:00
Łukasz Mierzwa
4bb629455b Merge pull request #23 from tcolgate/am051
Fixes for 0.5.1
2017-04-01 10:41:16 -07:00
Łukasz Mierzwa
0d82cffd79 Add -web.prefix / WEB_PREFIX option
This allows people to use unsee with a sub uri setup, which is pretty common usa case, fixes #22
2017-03-30 19:35:52 +01:00
Tristan Colgate
b7dd9d088e Fixes for 0.5.1 2017-03-29 08:40:14 +01:00
Łukasz Mierzwa
d99f7e60d8 Don't create http.FileServer on every favicon request
Setup it once and use for all requests
2017-03-28 10:26:13 -07:00
Łukasz Mierzwa
f8420d4632 Use go-bindata-assetfs for static files
This allows unsee to be compiled into a single self-contained binary, without any need to external static files or templates
2017-03-26 17:41:17 -07:00
Łukasz Mierzwa
3de3a9c481 Generate flag for each environment key
This allows to set config keys via flags, in additions to current env variable only configuration. Flags are autogenerated from supported env keys.
2017-03-26 13:38:37 -07:00
Łukasz Mierzwa
e239fd05fd Import code from internal repository (#1)
Import code from internal repository
2017-03-23 16:58:04 -07:00