Commit Graph

39 Commits

Author SHA1 Message Date
Łukasz Mierzwa
6166fdd474 Expose number of time unsee collected alerts from Alertmanager API
This way one can alert if unsee stops collecting alerts.
2017-07-06 08:52:13 -07:00
Łukasz Mierzwa
cd63ee512e Fix metric updates for alert counters
Metrics were incremented but never reset, this fixes it
2017-07-06 08:52:13 -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
0a06d58e22 Append alert state from the correct object 2017-07-01 20:28:51 -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
5bd03234a0 Clear Alertmanager data on pull error 2017-07-01 11:31:29 -07:00
Łukasz Mierzwa
ca0403ea75 Correctly sort alerts in dedup code 2017-07-01 10:01:35 -07:00
Łukasz Mierzwa
c29cb2c0a9 Sort alert groups so they are returned in a stable order 2017-06-30 23:41:25 -07:00
Łukasz Mierzwa
360dece7ad Disallow multiple Alertmanager instances with the same URI
Unique uri is required for silence form result tracking
2017-06-30 19:49:47 -07:00
Łukasz Mierzwa
5e020b9e01 Store alert source link per Alertmanager instance 2017-06-29 21:18:30 -07:00
Łukasz Mierzwa
612a0e817f Rename ALERTMANAGER_URI to ALERTMANAGER_URIS
This will make upgrade more explicit since there is a syntax change
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
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
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
ccbac56cd7 Add upstream abstraction to alertmanager package 2017-06-24 20:38:05 -07:00
Łukasz Mierzwa
e0ef9c2da8 Update tests to match list of silences 2017-06-21 13:28:45 -07:00
Łukasz Mierzwa
275c0a7e03 Update tests 2017-06-06 21:34:56 -07:00
Łukasz Mierzwa
b9de72fc48 Add support for Alertmanager 0.6.2
Minor changes in the API.
2017-05-09 21:52:39 +01:00
Łukasz Mierzwa
cee9b2bef6 Generate mock data using livemock.py
Generate mock data for all Alertmanager releases that we can support (0.4 - 0.6) and switch tests to use them instead of old files
Fixes #67
2017-05-02 10:28:40 +01:00
Łukasz Mierzwa
72808c0002 Add 0.6.1 mock data 2017-05-01 22:20:12 +01:00
Łukasz Mierzwa
3a1f6905e0 Add basic support for Alertmanager 0.6.1
This makes unsee work with 0.6.1, but the new status means that we should refactor unsee data model and pull inhibited and silenced into it, with a single filter
2017-04-28 12:40:04 -07:00
Łukasz Mierzwa
5d9ec5da64 Use ReadJSON everywhere, remove GetJSONFromURL 2017-04-16 08:31:07 -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
eb9a95be8a Add tests for new functions in alertmanager package 2017-04-06 19:24:48 -07:00
Łukasz Mierzwa
e8727897f0 Use new alertmanager package methods for fetching AM data
Change to using mapper module, remove old code
2017-04-06 19:24:47 -07:00
Łukasz Mierzwa
d02028e581 Add functions in alertmanager package for getting alerts and silences via the mapper package 2017-04-06 19:24:47 -07:00
Łukasz Mierzwa
f533114801 Add a function for querying remote Alertmanager version 2017-04-06 19:24:47 -07:00
Łukasz Mierzwa
e7d694cece Move getJSONFromURL to the transport package
Move it and make it public so it can be reused outside of alertmanager package
2017-04-06 19:09:16 -07:00
Łukasz Mierzwa
b47788d9ce Move joinURL to the transport package
Move it and make it public so it can be reused outside of alertmanager package
2017-04-06 19:09:16 -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
83496297d6 Add tests for package currently not covered by testing 2017-03-31 23:30:13 -07:00
Tristan Colgate
b7dd9d088e Fixes for 0.5.1 2017-03-29 08:40:14 +01: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