|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Deduplicates alerts based on fingerprint. More...
#include <alert_pipeline.h>

Public Member Functions | |
| alert_deduplicator (std::chrono::milliseconds cache_duration) | |
| Construct with cache duration. | |
| bool | is_duplicate (const alert &a) |
| Check if alert is a duplicate. | |
| void | mark_seen (const alert &a) |
| Mark alert as seen. | |
| void | reset () |
| Clear deduplication cache. | |
Private Member Functions | |
| void | cleanup_expired () |
Private Attributes | |
| std::chrono::milliseconds | cache_duration_ |
| std::mutex | mutex_ |
| std::unordered_map< std::string, std::chrono::steady_clock::time_point > | seen_ |
| std::unordered_map< std::string, alert_state > | last_state_ |
Deduplicates alerts based on fingerprint.
Maintains a cache of recently seen alerts to prevent duplicate notifications for the same alert condition.
Definition at line 511 of file alert_pipeline.h.
|
inlineexplicit |
Construct with cache duration.
| cache_duration | How long to remember alerts |
Definition at line 517 of file alert_pipeline.h.
|
inlineprivate |
Definition at line 569 of file alert_pipeline.h.
References cache_duration_, last_state_, and seen_.
Referenced by is_duplicate().

|
inline |
Check if alert is a duplicate.
| a | Alert to check |
Definition at line 525 of file alert_pipeline.h.
References cleanup_expired(), kcenon::monitoring::alert::fingerprint(), last_state_, mutex_, seen_, and kcenon::monitoring::alert::state.
Referenced by main().


|
inline |
Mark alert as seen.
Definition at line 552 of file alert_pipeline.h.
References kcenon::monitoring::alert::fingerprint(), last_state_, mutex_, seen_, and kcenon::monitoring::alert::state.

|
inline |
Clear deduplication cache.
Definition at line 562 of file alert_pipeline.h.
References last_state_, mutex_, and seen_.
Referenced by main().

|
private |
Definition at line 581 of file alert_pipeline.h.
Referenced by cleanup_expired().
|
private |
Definition at line 584 of file alert_pipeline.h.
Referenced by cleanup_expired(), is_duplicate(), mark_seen(), and reset().
|
mutableprivate |
Definition at line 582 of file alert_pipeline.h.
Referenced by is_duplicate(), mark_seen(), and reset().
|
private |
Definition at line 583 of file alert_pipeline.h.
Referenced by cleanup_expired(), is_duplicate(), mark_seen(), and reset().