Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDEA] Remove flogs for an "AlertManager" in the Core #104

Closed
HugoSoszynski opened this issue Oct 30, 2019 · 0 comments · Fixed by #135
Closed

[IDEA] Remove flogs for an "AlertManager" in the Core #104

HugoSoszynski opened this issue Oct 30, 2019 · 0 comments · Fixed by #135
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers intermediate pending Issue have a pull request waiting for review technical
Milestone

Comments

@HugoSoszynski
Copy link
Contributor

What is your feature about ?
Removing the flogs filter because it does not comply with darwin philosophy.

Creating an "AlertManager" in the Core that is able to handle alert file, redis and maybe more.

Additional context
The "AlertManager" could use a list of output interfaces (IAlertRepository).

@HugoSoszynski HugoSoszynski added enhancement New feature or request good first issue Good for newcomers intermediate technical labels Oct 30, 2019
@HugoSoszynski HugoSoszynski added this to the Version 1.1.1 milestone Nov 12, 2019
@HugoSoszynski HugoSoszynski self-assigned this Nov 12, 2019
@HugoSoszynski HugoSoszynski added the pending Issue have a pull request waiting for review label Dec 2, 2019
@NS4nti NS4nti mentioned this issue Dec 6, 2019
HugoSoszynski added a commit that referenced this issue Dec 11, 2019
# ✨ Pull Request Template
‼️ Once all the **checklist** is **done** you have to:
  * **stash merge** this pull request
  * **delete** the corresponding **branch**
  * **close** the associated **issue**

## 📃 Type of change

**Breaking change**: fix or feature that would cause existing functionality to not work as expected.

## 💡 Related Issue(s)

- Resolve #104 
- Resolve #136 

## ✒️ Description

**BREAKING**: The filters no longer launch alert on 101 code (error code).

**CAUTION**: This PR implies new configuration fields for the filters. However those are not mandatory (see filters documentation).

Adding an AlertManager to the Core to enable every filter to raise an alert.

The alerts can be raised in : 
- File
- Redis list
- Redis channel

Alert file rotation is handled catching the SIGHUP or SIGUSR1 signal.

### Core
The new alerting configuration fields are:
 - 'log_file_path': path to the log file dedicated to alerts
 - 'redis_socket_path': path to the redis UNIX socket to send alert to
 - 'alert_redis_list_name': name of the alert list in redis
 - 'alert_redis_channel_name': name of redis channel to publish alert to

If the alert configuration is missing or wrong, it is not applied.
If the alert configuration is partialy correct, apply as much as possible.
In both cases a warning is logged.

DARWIN_RAISE_ALERT(str) macro makes filter code easier to read. (AlertManager.hpp)

### CMake
- Added the Redis dependencies to the CMakeLists.txt because it will soon be part of all the filters through the Alert Manager.
- Added the required toolkit parts to the core sources.
- Added DARWIN_LIBRARIES var to remove duplicata and avoid core libraries mistake.

### FileManager
- Only accepts const strings as no modification should occur.
- Rewrote parts of the FileManager to be more C++ friendly.
- Force reopen is now possible with our FiLeManager.
- File opening / reopening is now done under mutex lock to prevent writing while opening / closing the file.

### Filters
- Filters are now using the AlertManager to raise alert.
- Added ftest to enable easier testing of the core functions. This filter is not compiled by default but is mandatory for tests.

### Tests
- Added the alert manager tests (around 75 tests so no listing here)
- Updated TAnomaly tests to check for proper handling of both legacy and new configuration file.

## 🎯 Test Environments

### FreeBSD (version)
- Redis 4.0.14_1
- Boost 1.71.0
- clang++ 8.0.1
- CMake 3.15.4
- Python 3.6

### Ubuntu (version)
- Redis 5.0.3
- Boost 1.71.0
- g++ 8.3.0
- CMake 3.13.14
- Python 3.7.3
- Valgrind 3.14.0

## ✔️ Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] _(ftest)_ I have added corresponding page to the documentation
- [x] I have made corresponding changes to the documentation
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes

</br>

- [x] 🙋 **I certify on my honor that all the information provided is true, and I've done all I can to deliver a high quality code**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers intermediate pending Issue have a pull request waiting for review technical
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant