From f940cf580b5ef54ad73fcebd87420a223b7f23e8 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Sat, 4 Jan 2025 14:23:19 -0500 Subject: [PATCH 1/2] upgrade deps, resolve deprecation warnings --- elastalert/alerts.py | 10 +++++----- elastalert/elastalert.py | 4 ++-- requirements-dev.txt | 12 ++++++------ requirements.txt | 30 +++++++++++++++--------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/elastalert/alerts.py b/elastalert/alerts.py index 793715df..5e16f4bf 100644 --- a/elastalert/alerts.py +++ b/elastalert/alerts.py @@ -6,8 +6,8 @@ from jinja2 import Template from prettytable import PrettyTable -from prettytable import MSWORD_FRIENDLY -from prettytable import ALL +from prettytable import TableStyle +from prettytable import HRuleStyle, VRuleStyle from texttable import Texttable @@ -308,11 +308,11 @@ def get_aggregation_summary_text(self, matches): # an abandoned PR (https://github.com/jertel/elastalert2/pull/1227). text_table = PrettyTable() text_table.field_names = summary_table_fields_with_count - text_table.set_style(MSWORD_FRIENDLY) + text_table.set_style(TableStyle.MSWORD_FRIENDLY) text_table.border = True text_table.header = True - text_table.hrules = ALL - text_table.vrules = ALL + text_table.hrules = HRuleStyle.ALL + text_table.vrules = VRuleStyle.ALL text_table.header = True text_table.format = True for keys, count in match_aggregation.items(): diff --git a/elastalert/elastalert.py b/elastalert/elastalert.py index 31174701..44003a72 100755 --- a/elastalert/elastalert.py +++ b/elastalert/elastalert.py @@ -1520,8 +1520,8 @@ def find_recent_pending_alerts(self, time_limit): # Fetch recent, unsent alerts that aren't part of an aggregate, earlier alerts first. inner_query = {'query_string': {'query': '!_exists_:aggregate_id AND alert_sent:false'}} - time_filter = {'range': {'alert_time': {'from': dt_to_ts(ts_now() - time_limit), - 'to': dt_to_ts(ts_now())}}} + time_filter = {'range': {'alert_time': {'gte': dt_to_ts(ts_now() - time_limit), + 'lte': dt_to_ts(ts_now())}}} sort = {'sort': {'alert_time': {'order': 'asc'}}} query = {'query': {'bool': {'must': inner_query, 'filter': time_filter}}} query.update(sort) diff --git a/requirements-dev.txt b/requirements-dev.txt index 5bcc47a3..c71b1123 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,11 +2,11 @@ flake8 flake8-absolute-import pre-commit -pylint==3.3.1 -pytest==8.3.3 -pytest-cov==5.0.0 +pylint==3.3.3 +pytest==8.3.4 +pytest-cov==6.0.0 pytest-xdist==3.6.1 setuptools -sphinx==8.0.2 -sphinx_rtd_theme==3.0.1 -tox==4.21.2 +sphinx==8.1.3 +sphinx_rtd_theme==3.0.2 +tox==4.23.2 diff --git a/requirements.txt b/requirements.txt index adc4f1c1..41c43cd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,25 +1,25 @@ -apscheduler>=3.10.4,<4.0 +apscheduler>=3.11.0,<4.0 aws-requests-auth>=0.4.3 -boto3>=1.34.54 -cffi>=1.16.0 -croniter>=2.0.2 +boto3>=1.35.92 +cffi>=1.17.1 +croniter>=6.0.0 elasticsearch==7.10.1 envparse>=0.2.0 exotel==0.1.5 -Jinja2>=3.1.3 -jira>=3.5.2 -jsonpointer>=2.4 -jsonschema>=4.21.1 -prettytable>=3.10.0 +Jinja2>=3.1.5 +jira>=3.8.0 +jsonpointer>=3.0.0 +jsonschema>=4.23.0 +prettytable>=3.12.0 prison>=0.2.1 -prometheus_client>=0.20.0 +prometheus-client>=0.21.1 python-dateutil>=2.9.0.post0 -PyYAML>=6.0.1 +PyYAML>=6.0.2 py-zabbix>=1.1.7 -requests>=2.31.0 +requests>=2.32.3 sortedcontainers>=2.4.0 statsd-tags==3.2.1.post1 -stomp.py>=8.1.0 -tencentcloud-sdk-python>=3.0.1098 +stomp.py>=8.2.0 +tencentcloud-sdk-python>=3.0.1295 texttable>=1.7.0 -twilio>=8.13.0 +twilio>=9.4.1 From 4ceaf7fa9a25a3fc5d5d858bb0ed25ea225b8ed9 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Sat, 4 Jan 2025 14:31:47 -0500 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f2865b9..7f85702e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,29 @@ - [Docs] Add missing documentation of the `aggregation_alert_time_compared_with_timestamp_field` option. - [#1588](https://github.com/jertel/elastalert2/pull/1588) - @nicolasnovelli - Fix linter error reporting about return type assignation in `elastalert/test_rule.py`. - [#1594](https://github.com/jertel/elastalert2/pull/1594) - @thican - Add support for Kibana 8.17 for Kibana Discover - [#1597](https://github.com/jertel/elastalert2/pull/1597) - @nsano-rururu +- Resolve runtime deprecation warnings related to Elastic's 8.16 range filter changes - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Resolve test deprecation warnings related to prettytable enum changes - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency pylint to 3.3.3 (build) - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency pytest to 8.3.4 (build) - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency pytest-cov to 6.0.0 (build) - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency sphinx to 8.1.3 (build) - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency sphinx_rtd_theme to 3.0.2 (build) - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency tox to 4.23.2 (build) - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency apscheduler to 3.11.0 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency boto3 to 1.35.92 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency cffi to 1.17.1 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency croniter to 6.0.0 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency jinja2 to 3.1.5 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency jira to 3.8.0 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency jsonpointer to 3.0.0 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency jsonschema to 4.23.0 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency prettytable to 3.12.0 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency prometheus-client to 0.21.1 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency pyyaml to 6.0.2 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency requests to 2.32.3 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency stomp.py to 8.2.0 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency tencentcloud-sdk-python to 3.0.1295 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel +- Upgrade dependency twilio to 9.4.1 - [#1599](https://github.com/jertel/elastalert2/pull/1599) - @jertel # 2.22.0