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

v0.5.0 release #828

Merged
merged 204 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
e5b94cc
feat(dev): add script to run auto-reloading celery workers
Samyak2 Feb 9, 2022
aabe456
fix: fixes #730 by removing extra t-1 from fill missing data function
kartikay-bagla Feb 16, 2022
b4dbb3f
fix: modify the format to display expected values
kshitij123456 Feb 17, 2022
41ab6b9
fix: modify the format to display expected values
kshitij123456 Feb 17, 2022
f18ed58
Merge pull request #748 from chaos-genius/expected-range-fix
Samyak2 Feb 18, 2022
ebcb83a
removed loader from add kpi and changed nooptions text baased on load…
Feb 21, 2022
6f70b78
added changes in formatting of labels for values below 1000
Feb 21, 2022
2c9274d
Merge pull request #751 from chaos-genius/remove-loader-from-add-kpi-…
manassolanki Feb 22, 2022
7b38e25
added check for non-numerical perc changes (#747)
ChartistDev Feb 22, 2022
522ea51
Merge pull request #752 from chaos-genius/incorrect-formatting-of-yax…
manassolanki Feb 22, 2022
82a7594
resolved follow-redirects dependencies
Feb 22, 2022
7b34e99
Merge branch 'develop' of github.com:chaos-genius/chaos_genius into d…
Feb 22, 2022
66f8d91
added url for troubleshooting
Feb 22, 2022
b1058c2
Merge pull request #756 from chaos-genius/url-for-troubleshoot-doc
manassolanki Feb 22, 2022
0a0b2cd
chore(formatting): formatted alert_channel_creds.py
varunp2k Feb 22, 2022
c0af3bd
Merge branch 'main' into develop
Samyak2 Feb 22, 2022
876164a
chore(formatting): formatted alert_config.py
varunp2k Feb 22, 2022
999fc95
fix: frontend/Dockerfile.prod to reduce vulnerabilities
varunp2k Feb 22, 2022
6ad3f2b
chore(formatting): formatted alerts files
varunp2k Feb 22, 2022
dd6f92f
chore(format): formatting alerts
varunp2k Feb 22, 2022
502435a
chore(formatting): formatted alerts
varunp2k Feb 22, 2022
12ffeea
Merge pull request #755 from chaos-genius/dependabot-severity-fixes
manassolanki Feb 23, 2022
c7c83c0
Merge remote-tracking branch 'origin/main' into develop
Samyak2 Feb 23, 2022
0dc2615
feat: set default value for CHAOSGENIUS_WEBAPP_URL
kshitij123456 Feb 22, 2022
6dcf009
Merge pull request #762 from chaos-genius/webapp_url_fix
Samyak2 Feb 23, 2022
233acb4
chore: readability improvement for PR instructions
rjdp Feb 23, 2022
dba2178
Merge pull request #764 from rjdp/develop
rjdp Feb 23, 2022
f4dd1a5
Merge pull request #734 from chaos-genius/fix-anomaly-end-date-missing
Amatullah Feb 23, 2022
9c8b2de
Merge pull request #760 from chaos-genius/alerts-format
Samyak2 Feb 23, 2022
fc0ca2e
Merge pull request #759 from chaos-genius/snyk-vuln-fix
Samyak2 Feb 24, 2022
def7f85
refactor(scheduler): refacted scheduler into a class
varunp2k Feb 24, 2022
1f208d6
Merge pull request #683 from chaos-genius/celery-scripts
varunp2k Feb 24, 2022
c6ed782
refactor(scheduler): refactor scheduler function into a class
varunp2k Feb 24, 2022
e1fa08c
test(scheduler): added edge cases to write tests for
varunp2k Feb 24, 2022
3d8d509
feat(scheduler): hourly sceduler
varunp2k Feb 25, 2022
c1f855b
fix: end-date missing data edge case
Amatullah Feb 28, 2022
d843c39
event alert toaster issues fixed
Feb 28, 2022
71ad8a3
refactor: split base_alerts.py into different modules
kshitij123456 Feb 28, 2022
a0a7457
feat: Add Druid Datasource Spec and Connector
bhargavsk1077 Feb 28, 2022
d985696
refactor: fix dependency issues
kshitij123456 Mar 1, 2022
2bbf7d4
refactor: fix dependency issues
kshitij123456 Mar 1, 2022
75041c6
refactor: remove redundant query to DataSource table
kshitij123456 Mar 1, 2022
17079b0
refactor: make constant for "Overall KPI"
kshitij123456 Mar 1, 2022
97edfe3
fix(druid): add pydruid with sqlalchemy in prod requirements
Samyak2 Mar 1, 2022
ccd0a82
refactor: modify conversion of datetime objects to strings
kshitij123456 Mar 1, 2022
f227bbf
fix(scheduler): prevent error when scheduler_frequency not set up
Samyak2 Mar 1, 2022
46fca8c
refactor(scheduler): separate get_scheduled_time for daily, hourly
Samyak2 Mar 1, 2022
17d6226
chore(formatting): formatted analytics scheduler
varunp2k Mar 1, 2022
129e6ec
fix(scheduler): decoupled rca and anomaly
varunp2k Mar 1, 2022
c235e7b
fix(scheduler): add rca_time if it is not present in scheduler_params
varunp2k Mar 1, 2022
46c45f5
Merge pull request #780 from chaos-genius/end-date-fix
suranah Mar 2, 2022
4a0afb6
refactor: remove unused imports from files
kshitij123456 Mar 2, 2022
3432f3e
feat(anomaly-params): allow hourly scheduler_frequency
Samyak2 Mar 2, 2022
85c31a1
fix(scheduler): fixed logic for running rca
varunp2k Mar 2, 2022
fa8711d
refactor: format files using isort and black
kshitij123456 Mar 2, 2022
9a5098d
fix(scheduler): fixed logic for running rca
varunp2k Mar 2, 2022
43f94e1
Merge pull request #784 from chaos-genius/enable-hourly-scheduler-fre…
suranah Mar 2, 2022
126abd3
fix(scheduler): fixed rca logic and scheduler crontab time
varunp2k Mar 2, 2022
939c19f
chore(formatting): formatted analytics scheduler
varunp2k Mar 2, 2022
14f71c2
Merge pull request #782 from chaos-genius/alerts-refactor
Samyak2 Mar 2, 2022
d097c5e
Merge remote-tracking branch 'origin/main' into develop
Samyak2 Mar 2, 2022
116a55d
fix(scheduler): cleanup and document analytics scheduler
Samyak2 Mar 2, 2022
65ba7db
feat(anomaly): add hourly support
Amatullah Mar 2, 2022
01eea11
feat: db-migration to add created_at column
Amatullah Mar 2, 2022
6733699
chore: add comments to hourly function
Amatullah Mar 2, 2022
104ee96
chore: add HOURS_OFFSET_FOR_ANALTYICS to docker composes
Samyak2 Mar 2, 2022
2b88e4a
Merge pull request #787 from chaos-genius/hourly-anomaly
Samyak2 Mar 2, 2022
bc2278b
fix(scheduler): typo on anomaly scheduler beat schedule
Samyak2 Mar 2, 2022
b782909
Merge pull request #785 from chaos-genius/scheduler-hourly-anomaly
Samyak2 Mar 2, 2022
7aba7b6
fix: updated end_date for alerts and start_date for hourly queries
Amatullah Mar 2, 2022
53fd640
fix(alerts): convert created_at time to string before storing
Samyak2 Mar 3, 2022
d1b8273
fix: Remove comment extraction from druid tables
bhargavsk1077 Mar 4, 2022
4762cf3
initial test cases .. more to add
rjdp Mar 4, 2022
1d1723a
undo adding of celery_extension.py
rjdp Mar 4, 2022
e64074f
test: add more tests for _to_run_rca, _to_run_anomaly, _get_scheduled…
rjdp Mar 7, 2022
3f26286
test: use monkeypatch
rjdp Mar 7, 2022
d270cb9
style: Format data_connection_config.json
bhargavsk1077 Mar 8, 2022
172b5ff
made FE changes for hourly implementation
Mar 8, 2022
21ed9fd
feat(anomaly): added retraining endpoint
varunp2k Mar 8, 2022
b17d94f
feat(anomaly): added logging
varunp2k Mar 8, 2022
307fd22
feat(anomaly):hourly api to return only minute of scheduled time
varunp2k Mar 8, 2022
85edb45
fix: Handle datasource addition without Auth.
bhargavsk1077 Mar 8, 2022
a875baa
[FEAT]: implement part 3,4 of Issue #794
rjdp Mar 8, 2022
1843ae7
feat: change date format
kshitij123456 Mar 8, 2022
bca67f9
feat: changes to percentage change calculation
kshitij123456 Mar 8, 2022
9e94d36
fix: incorporate alert changes
kshitij123456 Mar 8, 2022
4de9cae
refactor: restructure code in save_anomaly_point_formatting function
kshitij123456 Mar 8, 2022
1c32401
refactor: format anomaly_alerts.py using isort and black
kshitij123456 Mar 8, 2022
2a143ff
chore: add Anomaly Processor Tests
Amatullah Mar 8, 2022
d3c22d1
chore: format test_anomaly_process.py
Amatullah Mar 8, 2022
2a356a5
chore: add Anomaly Controller test
Amatullah Mar 8, 2022
d641bc1
chore: add Anomaly utils test
Amatullah Mar 8, 2022
e2cdb59
Merge branch 'druid-connector' of github.com:chaos-genius/chaos_geniu…
bhargavsk1077 Mar 8, 2022
97345c4
fix: Filter out Druid internal tables
bhargavsk1077 Mar 8, 2022
756c003
chore: format file
Amatullah Mar 8, 2022
c73dea5
fix: updated part 3, 4 of #794
kartikay-bagla Mar 8, 2022
6c5a629
feat: added part 2 of #794
kartikay-bagla Mar 8, 2022
8609a07
feat: added part 1 of #794
kartikay-bagla Mar 8, 2022
c72dce1
fix(api): api request now sends capitalized sensitivty
varunp2k Mar 8, 2022
ba7f2b4
chore(formatting): formatted anomaly_data_view
varunp2k Mar 8, 2022
77f1f1d
Merge pull request #799 from chaos-genius/anomaly-params-api-changes
ChartistDev Mar 9, 2022
83220b9
fix(scheduler): suppots HH:MM:SS format
varunp2k Mar 9, 2022
8fea2da
chore(formatting): formatted analytics_scheduler
varunp2k Mar 9, 2022
2cbc802
chore: format files
Amatullah Mar 9, 2022
2338cb6
fix: use anomaly_params in place of scheduler_params
kshitij123456 Mar 9, 2022
850482c
fix: replace change_message value in save_anomaly_point_formatting
kshitij123456 Mar 9, 2022
d18b3f2
fix: make changes to _save_nl_message_daily_freq function
kshitij123456 Mar 9, 2022
30145d4
style: Revert data_connection_config.json to single line
bhargavsk1077 Mar 9, 2022
328916d
Merge branch 'tz-aware-ds' of github.com:chaos-genius/chaos_genius in…
bhargavsk1077 Mar 9, 2022
29c74fc
fix: unified timezone strings for GMT and UTC
kartikay-bagla Mar 9, 2022
3fedbfb
feat: added string parsing support for druid
kartikay-bagla Mar 9, 2022
74ef550
fix: removed semicolons from tz query
kartikay-bagla Mar 9, 2022
c5c2ad7
feat: add signs to "inf"
kshitij123456 Mar 9, 2022
f48ead3
feat: added preaggregation support for anomaly
kartikay-bagla Mar 9, 2022
6f623f2
feat: added preaggregation support for deepdrills
kartikay-bagla Mar 9, 2022
defddb9
fix: removed incorrect randomword usage
kartikay-bagla Mar 9, 2022
2325eca
fix: removed incorrect variable name
kartikay-bagla Mar 9, 2022
2e21c53
Merge pull request #795 from chaos-genius/anomaly-retraining
Samyak2 Mar 10, 2022
3fb0bf3
Merge pull request #798 from chaos-genius/anomaly-tests
varunp2k Mar 10, 2022
3bf6e35
changes for retrain and last scan data
Mar 10, 2022
a5988dd
fix(api): blank graph after refreshing anomaly wait page
varunp2k Mar 10, 2022
8177af0
Merge branch 'hourly' of github.com:chaos-genius/chaos_genius into an…
Mar 10, 2022
6816f6b
fix(api): blank graph after refreshing anomaly wait page
varunp2k Mar 10, 2022
48254be
fix(api): blank graph after refreshing anomaly wait page
varunp2k Mar 10, 2022
b69e8d8
fix(api):used count instead of all and len for data existence check
varunp2k Mar 10, 2022
e772352
feat: add colors to change messages
kshitij123456 Mar 10, 2022
60c36b4
fix: add last available date + last available scan to DD and Anomaly …
Amatullah Mar 10, 2022
b1d3b5f
Merge branch 'scheduler-hourly-time-format' into scheduler-tests
rjdp Mar 10, 2022
4311cc8
Update chaos_genius/core/rca/rca_utils/api_utils.py
Amatullah Mar 10, 2022
99cf362
test: adjust to adjust input time format change from MM:SS to HH:MM:SS
rjdp Mar 10, 2022
c481c2a
chore: format files
Amatullah Mar 10, 2022
bebbde4
style: fix some formatting in anomaly_data_view
Samyak2 Mar 10, 2022
45d6639
Merge pull request #804 from chaos-genius/datetime-api-changes
Samyak2 Mar 10, 2022
3d37fb7
Merge pull request #797 from chaos-genius/alert-changes
Samyak2 Mar 10, 2022
79acce7
Merge pull request #802 from chaos-genius/scheduler-hourly-time-format
Samyak2 Mar 10, 2022
da58b81
Merge branch 'hourly' of github.com:chaos-genius/chaos_genius into an…
Mar 10, 2022
189c629
fix: resolve conflicts
Amatullah Mar 10, 2022
f502a3d
Merge branch 'hourly' into hourly-FE-changes
Amatullah Mar 10, 2022
df33f4e
feat: add kpi_id to kpi settings response
Samyak2 Mar 10, 2022
7fccc2e
fix: format of Last Scan entry + remove offset display
Amatullah Mar 10, 2022
1aae8db
Merge pull request #806 from chaos-genius/datetime-api
Samyak2 Mar 10, 2022
17328b7
made changes for retrain API
Mar 10, 2022
00efad4
Merge branch 'hourly' of github.com:chaos-genius/chaos_genius into an…
Mar 10, 2022
cee8757
added note for hourly schedule
Mar 10, 2022
9080e5f
Merge branch 'hourly-FE-changes' of github.com:chaos-genius/chaos_gen…
Mar 10, 2022
4c56fb1
removed retrain from sub-dimensions
Mar 10, 2022
b21f944
minor UI fixes
Mar 10, 2022
96ede52
Merge remote-tracking branch 'origin/develop' into tz-aware-ds
Samyak2 Mar 10, 2022
a4e9c6a
fix: fix controller tests
Amatullah Mar 10, 2022
1177ee3
test(kpi-validation): add tests for tz-aware and datetime string cols
Samyak2 Mar 10, 2022
3b0fb0d
feat: update `mutidim_status` logic based on datasource
rjdp Mar 10, 2022
0bdb6c7
fix: Fix Druid fetch table details, eg. known issue incase of unused …
rjdp Mar 10, 2022
d0e649d
Feat: supported aggregations based on Datasource
rjdp Mar 10, 2022
add2564
Merge branch 'tz-aware-ds' into datasource-aware-aggregation-multidim-dd
rjdp Mar 10, 2022
7f8e29a
fix: silly missing import
rjdp Mar 10, 2022
983d69f
Merge pull request #800 from chaos-genius/hourly-FE-changes
manassolanki Mar 10, 2022
238af03
Merge pull request #807 from chaos-genius/anomaly-retraining-FE
manassolanki Mar 10, 2022
c77bbd6
Merge pull request #809 from chaos-genius/tz-aware-ds
Samyak2 Mar 10, 2022
4379c08
Merge branch 'develop' into hourly
Samyak2 Mar 10, 2022
5e3673e
changes for add kpi aggregation options for druid
Mar 10, 2022
9d0acd3
chore: fix silly logger use
rjdp Mar 10, 2022
0e87b50
fix: merge branched migrations - hourly and druid
Samyak2 Mar 10, 2022
3321fab
fix(kpi-validation): skip tz-naive check only for druid, update tests
Samyak2 Mar 10, 2022
92e1238
fix(kpi-validation): the data_source passed was dict, not object
Samyak2 Mar 10, 2022
cc8f412
fix(kpi-validation): forgot to pass data_source
Samyak2 Mar 10, 2022
12091b4
fix(kpi-validation): consider tz-aware only if it's Druid
Samyak2 Mar 10, 2022
08e70e7
fixed dropdown issues for add KPI
Mar 10, 2022
8820e32
Merge pull request #810 from chaos-genius/hourly
Amatullah Mar 11, 2022
319f4c3
refactor: switch to property instead of classmethod
rjdp Mar 11, 2022
7dea62d
Update chaos_genius/connectors/base_db.py
rjdp Mar 11, 2022
bdd427a
Merge pull request #811 from chaos-genius/datasource-aware-aggregatio…
manassolanki Mar 11, 2022
586f1e6
Merge pull request #812 from chaos-genius/fix/kpi-validation-tests-tz
manassolanki Mar 11, 2022
d5ef84f
resolve the issue in the data ingestion
manassolanki Mar 10, 2022
360f5b1
fix: make the chunksize configurable from the db model
manassolanki Mar 11, 2022
4da1937
Merge pull request #781 from chaos-genius/sb-frontend-eventalerttoaster
manassolanki Mar 11, 2022
cf8883a
resolved conflicts
Mar 11, 2022
635fb7d
fix: bump version to 0.5.0
Samyak2 Mar 11, 2022
c46f544
added hourly alert configuration
Mar 11, 2022
f736001
Merge pull request #816 from chaos-genius/hourly-alert
manassolanki Mar 11, 2022
d87ef13
Merge pull request #805 from chaos-genius/fix/data-ingestion
manassolanki Mar 11, 2022
a929d41
refactor: move get_dim_status to controller
rjdp Mar 11, 2022
d531e40
Merge remote-tracking branch 'origin/datasource-aware-aggregation-mul…
rjdp Mar 11, 2022
8cc7e0d
Merge pull request #814 from chaos-genius/datasource-aware-aggregatio…
manassolanki Mar 11, 2022
86b771c
Merge pull request #815 from chaos-genius/version-0.5.0
manassolanki Mar 11, 2022
8fc600c
fix(migrations): merge diverged branches
Samyak2 Mar 11, 2022
9e2ac69
Merge pull request #817 from chaos-genius/fix/migrations-jsonb-merge
rjdp Mar 11, 2022
8985599
feat: enable the event alert by default
manassolanki Mar 14, 2022
93bc6d8
feat: add the hourly schedular for the event alerts
manassolanki Mar 14, 2022
61f8800
fix: frontend/Dockerfile.prod to reduce vulnerabilities
snyk-bot Mar 14, 2022
aede053
feat(alert-dashboard): hide subdims, kpi filter in event alert tab
Samyak2 Mar 14, 2022
a04d9fe
Merge pull request #821 from chaos-genius/snyk-fix-61a29964ad48d0de19…
bhargavsk1077 Mar 14, 2022
6d3dcbe
fix: modify datetime format in event alerts dashboard
kshitij123456 Mar 14, 2022
9e9369d
fix: remove unused import
kshitij123456 Mar 14, 2022
d83c4da
fix: create a constant DIGEST_DATETIME_FORMAT
kshitij123456 Mar 14, 2022
b4d8fcb
fixed bug which didn't accept test query payload
Mar 14, 2022
d663d0b
Merge pull request #823 from chaos-genius/event-alert-test-query-bugfix
manassolanki Mar 14, 2022
02e2273
Merge pull request #820 from chaos-genius/feature/hourly-alert
manassolanki Mar 14, 2022
bf2dc33
disabled consolidated alerts reports in event alerts
Mar 14, 2022
3951d0e
added individual alerts checked by default
Mar 14, 2022
9abd9b9
Merge pull request #824 from chaos-genius/disable-consolidated-report…
manassolanki Mar 14, 2022
cf68534
fixed search bug accross multiple pages
Mar 15, 2022
3444903
chore: Update docker-compose image tags to 0.5.0
bhargavsk1077 Mar 15, 2022
d0f42e3
Merge pull request #826 from chaos-genius/search-functionality-bug-fix
manassolanki Mar 15, 2022
d65006e
Merge pull request #827 from chaos-genius/0.5.0-compose-update
Samyak2 Mar 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ CHAOSGENIUS_WEBAPP_URL=http://localhost:8080/

# Alert configuration
## to enable event alerts
REACT_APP_EVENT_ALERT=false
REACT_APP_EVENT_ALERT=true

# Docker volume mounts
CG_DB_DOCKER_MOUNT=cg_db
Expand Down Expand Up @@ -148,6 +148,7 @@ MAX_FILTER_SUBGROUPS_ANOMALY=250
MAX_DEEPDRILLS_SLACK_DAYS=14
MAX_ANOMALY_SLACK_DAYS=14
DAYS_OFFSET_FOR_ANALTYICS=2
HOURS_OFFSET_FOR_ANALTYICS=0
DEEPDRILLS_HTABLE_MAX_PARENTS=5
DEEPDRILLS_HTABLE_MAX_CHILDREN=5
DEEPDRILLS_HTABLE_MAX_DEPTH=3
Expand Down
82 changes: 82 additions & 0 deletions chaos_genius/alerts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import logging
from datetime import date
from typing import List, Tuple

from chaos_genius.alerts.anomaly_alerts import AnomalyAlertController
from chaos_genius.alerts.event_alerts import StaticEventAlertController
from chaos_genius.alerts.static_kpi_alerts import StaticKpiAlertController
from chaos_genius.databases.models.alert_model import Alert
from chaos_genius.databases.models.data_source_model import DataSource
from chaos_genius.databases.models.kpi_model import Kpi

logger = logging.getLogger()


def check_and_trigger_alert(alert_id):
"""Check the alert and trigger the notification if found

Args:
alert_id (int): alert id

Raises:
Exception: Raise if the alert record not found

Returns:
bool: status of the alert trigger
"""
alert_info = Alert.get_by_id(alert_id)
if not alert_info:
raise Exception("Alert doesn't exist")

if not (alert_info.active and alert_info.alert_status):
print("Alert isn't active. Please activate the alert.")
return True

if alert_info.alert_type == "Event Alert":

data_source_id = alert_info.data_source
data_source_obj = DataSource.get_by_id(data_source_id)
static_alert_obj = StaticEventAlertController(
alert_info.as_dict, data_source_obj.as_dict
)
static_alert_obj.check_and_prepare_alert()
elif (
alert_info.alert_type == "KPI Alert" and alert_info.kpi_alert_type == "Anomaly"
):
anomaly_obj = AnomalyAlertController(alert_info.as_dict)
return anomaly_obj.check_and_prepare_alert()
elif alert_info.alert_type == "KPI Alert" and alert_info.kpi_alert_type == "Static":
static_kpi_alert = StaticKpiAlertController(alert_info.as_dict)

return True


def trigger_anomaly_alerts_for_kpi(
kpi_obj: Kpi, end_date: date
) -> Tuple[List[int], List[int]]:
"""Triggers anomaly alerts starting from end_date.

Args:
kpi_obj (Kpi): Object of kpi for which alerts are to be triggered
end_date (dateimte.datetime): Datetime object containing the upper bound of anomaly date values

Returns:
List[int]: List of alert IDs for which alert messages were successfully sent
List[int]: List of alert IDs for which alert failed
"""
success_alerts = []
errors = []
alerts = Alert.query.filter(
Alert.kpi == kpi_obj.id, Alert.active == True, Alert.alert_status == True
).all()
for alert in alerts:
try:
anomaly_obj = AnomalyAlertController(
alert.as_dict, anomaly_end_date=end_date
)
anomaly_obj.check_and_prepare_alert()
success_alerts.append(alert.id)
except Exception as e:
logger.error(f"Error running alert for Alert ID: {alert.id}", exc_info=e)
errors.append(alert.id)
return success_alerts, errors
21 changes: 9 additions & 12 deletions chaos_genius/alerts/alert_channel_creds.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def get_email_creds(name):
if config_obj is None:
return "", "", "", "", ""

configs = config_obj.as_dict.get('config_setting', {})
configs = config_obj.as_dict.get("config_setting", {})
return (
configs.get('server', ''),
configs.get('port', ''),
configs.get('username', ''),
configs.get('password', ''),
configs.get('sender_email', '')
configs.get("server", ""),
configs.get("port", ""),
configs.get("username", ""),
configs.get("password", ""),
configs.get("sender_email", ""),
)


Expand All @@ -25,11 +25,8 @@ def get_slack_creds(name):
if config_obj is None:
return ""

configs = config_obj.as_dict.get('config_setting', {})
return configs.get('webhook_url', '')
configs = config_obj.as_dict.get("config_setting", {})
return configs.get("webhook_url", "")


HELPER_FUNC_DICT = {
"email": get_email_creds,
"slack": get_slack_creds
}
HELPER_FUNC_DICT = {"email": get_email_creds, "slack": get_slack_creds}
16 changes: 5 additions & 11 deletions chaos_genius/alerts/alert_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,25 @@
"port": True,
"sender_email": True,
"server": True,
"username": False
"username": False,
}

SLACK_CONFIGS_EXPOSE = {
"webhook_url": False,
"channel_name": True
}
SLACK_CONFIGS_EXPOSE = {"webhook_url": False, "channel_name": True}

ORGANISATION_SETTINGS_EXPOSE = {
"account": True,
"metrics": True
}
ORGANISATION_SETTINGS_EXPOSE = {"account": True, "metrics": True}

ALERT_DIGEST_SETTINGS_EXPOSE = {
"active": True,
"daily_digest": True,
"scheduled_time": True,
"weekly_digest": True
"weekly_digest": True,
}

helper_objects = {
"email": EMAIL_CONFIGS_EXPOSE,
"slack": SLACK_CONFIGS_EXPOSE,
"organisation_settings": ORGANISATION_SETTINGS_EXPOSE,
"alert_digest_settings": ALERT_DIGEST_SETTINGS_EXPOSE
"alert_digest_settings": ALERT_DIGEST_SETTINGS_EXPOSE,
}

# TODO: Duplicate logic in the alert_cofig model too
Expand Down
30 changes: 0 additions & 30 deletions chaos_genius/alerts/anomaly_alert_config.py

This file was deleted.

Loading