Commit Graph

28 Commits

Author SHA1 Message Date
Łukasz Mierzwa
d02e8569aa Refactor group fingerpint tests
Depending on exact value breaks when testing with a different Go version since implementation details might cause structhash to return a different hash. We don't depend on exact values in the UI, we only require that those values are unique to a unique set of labels and selected attributes, so that's what we should test rather than hardcoded values. This PR allows unsee to pass tests under Go 1.9beta2
2017-07-17 19:04:54 -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
f2b21a60e2 Store alert state per instance 2017-07-01 12:43:15 -07:00
Łukasz Mierzwa
01c89082dd Calculate min/max timestamps and store those as globals, keep individual timestamps per instance 2017-07-01 12:09:55 -07:00
Łukasz Mierzwa
a8aa900830 Drop global SilencedBy & InhibitedBy from alert, only export per instance data 2017-07-01 10:05:28 -07:00
Łukasz Mierzwa
68b8e5fecf Use labels fp for sorting alerts
Labels fp is stable, contant fp will keep changing
2017-07-01 08:33:34 -07:00
Łukasz Mierzwa
5e020b9e01 Store alert source link per Alertmanager instance 2017-06-29 21:18:30 -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
2647330f71 Generate AlertGroup unique fingerprint on the fly 2017-06-28 22:36:25 -07:00
Łukasz Mierzwa
b0d6628f82 Generate alert unique fingerprint on the fly 2017-06-28 22:36:24 -07:00
Łukasz Mierzwa
97e3728dab Compute alert content fingerprints on the fly
This will be more expensive but will simplify the code
2017-06-28 22:36:24 -07:00
Łukasz Mierzwa
6311f9edc7 Update models package tests 2017-06-28 22:36:24 -07:00
Łukasz Mierzwa
4ecc0f199d Split models package for easier maintenance 2017-06-28 22:36:24 -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
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
487d7bcde8 Use alert status, inhibitedBy & silencedBy fields instead of silenced & inhibited 2017-05-01 22:20:12 +01:00
Łukasz Mierzwa
5df44def81 Add new attrs for tracking alert status and linking silences / inhibiting alerts
Those will replace Inhibited and Silenced
2017-05-01 18:43:03 +01: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
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
681d3d1a5b Remove alertmanager models in the models package
Those aren't needed anymore, only mapper package needs to know Alertmanager schema and it already does so
2017-04-06 19:24:48 -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
b754155266 Store alert sha1 internally and use it as a secondary key when sorting
We already compute alert sha1, it's a unique string so it's a good match for secondary sort key, used when two alerts have the exact same
timestamp. This helps to ensure that we always have a stable sort order and don't flash the UI if we have a group with alerts created at the exact same time
2017-03-29 19:48:02 -07:00
Tristan Colgate
b7dd9d088e Fixes for 0.5.1 2017-03-29 08:40:14 +01:00
Łukasz Mierzwa
0eb885bded Compare timestamps as is when sorting
Remove rounding of timestamps when sorting alert list, not sure why it was added, it's not needed
2017-03-27 19:40:04 -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