7 Commits

Author SHA1 Message Date
Ł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
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
5e020b9e01 Store alert source link per Alertmanager instance 2017-06-29 21:18:30 -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
4ecc0f199d Split models package for easier maintenance 2017-06-28 22:36:24 -07:00