Resolve the following RemovedIn20Warning warning:
The Engine.execute() method is considered legacy as of the 1.x
series of SQLAlchemy and will be removed in 2.0.
This also allows us to resolve the following RemovedIn20Warning warning:
The current statement is being autocommitted using implicit
autocommit, which will be removed in SQLAlchemy 2.0. Use the .begin()
method of Engine or Connection in order to use an explicit transaction
for DML and DDL statements.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I46f3277ea17e814e7b631750b2739f25e4395e22
Both the JSONEncodedDict and TimestampUTC can be safely used in a cache
key. Set 'cache_ok' to indicate this. This resolves the following
warnings:
SAWarning: TypeDecorator TimestampUTC() will not produce a cache key
because the ``cache_ok`` attribute is not set to True. This can have
significant performance implications including some performance
degradations in comparison to prior SQLAlchemy versions. Set this
attribute to True if this type object's state is safe to use in a
cache key, or False to disable this warning. (Background on this error
at: https://sqlalche.me/e/14/cprf)
SAWarning: TypeDecorator JSONEncodedDict() will not produce a cache
key because the ``cache_ok`` attribute is not set to True. This can
have significant performance implications including some performance
degradations in comparison to prior SQLAlchemy versions. Set this
attribute to True if this type object's state is safe to use in a
cache ke y, or False to disable this warning. (Background on this
error at: https://sqlalche.me/e/14/cprf)
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I589a0e378e155dcb181e6b1a9cca7aae4cad5349
Resolve the following RemovedIn20Warning warning:
Passing a string to Connection.execute() is deprecated and will be
removed in version 2.0. Use the text() construct, or the
Connection.exec_driver_sql() method to invoke a driver-level SQL
string.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ic4518ca1a5aea94a72c9dc3e4393eb970b55c3dd
We aren't passing context objects around, hence this looks more like
ironic's use of oslo.db than e.g. nova or cinder. Nothing complicated
though.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ia0368cc128d495011776e80a27af04776e876fa9
This follows what was already done in the other projects like [1].
In FIPS mode, md5 is allowed only in non-security contexts. This
change disables the security context in the md5 call to determine
the hash for workload partitioning, because this usage does not
involve any security risks.
[1] 8027d907109b6b3c96623f9793aff752cec8ed12
Change-Id: I7d622a6e7d324a765760819c024295b57990f95c
... so that operators can review effective values (except for secret
information such as password) from the log.
Change-Id: Ic094df537b5f7333be38c249cdec59a10d2e2660
Remove pifpaf and dependencies to gnocchi for tox test runs.
Remove redundant gabbi tests.
Move wsme & query unit tests from fuctional to unit test folder where
they belong.
Remove integration tests which has been covered in the new tempest
cases in the depends on patch.
Remove run-tests.sh in favour of just calling stestr.
Depends-On: https://review.opendev.org/c/openstack/telemetry-tempest-plugin/+/901838
Change-Id: I5b33cba27dfcb2bbdf12c9bc6b28ecff9aa18d93
This is already done in the 'aodh.tests.functional.db.TestBase' base
class.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I33e40cdb00620dc67e214f181068d4a024aa1447
This patch adds threshold evaluator for Prometheus metrics.
Alarms are based on Prometheus query only. The library
python-observabilityclient is used for querying Prometheus.
Co-authored-by: Jaromír Wysoglad <jwysogla@redhat.com>
Depends-On: Ie7477e0b11479449f7f13c7a784737ac70059964
Change-Id: I72e124cca4398b78f7ed12e1db3f66bdbfcb196e
The backend_url option can sometimes contain secrets.
For example when redis coordination backend is used and authentication
is enabled in redis, the plain redis password is put as an URL element.
[coordination]
backend_url=redis://:password@127.0.0.1:6379
Closes-Bug: #2012246
Change-Id: Ib918532d82c4633add7fad9c8441868cfd84001b
this will allow various oslo.policy scripts like
oslopolicy-policy-generator to work with Aodh.
Change-Id: I5941fe03277368f789a0e07d823ececdf86ed37e
Story: 2010559
Task: 47247
This partly reverts commit d32ca24453.
The rest of the revert is in 9b50734bf7.
This partial revert is because the changes to
aodh/api/controllers/v2/alarm_rules/composite.py were omitted in the
original revert.
Change-Id: I181380747bd9f613239de87fa931f75e7d97ff7d
oslo.db 12.1.0 has changed the default value for the 'autocommit'
parameter of 'LegacyEngineFacade' from 'True' to 'False'. This is a
necessary step to ensure compatibility with SQLAlchemy 2.0. However,
Aodh is currently relying on the autocommit behavior and needs changes
to explicitly manage sessions. Until that happens, we need to override
the default.
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: I129b54b06e1a5c3fafd2a03f295cc1cfd9c9e33c
This parameter has had no effect for several cycles and was officially
deprecated during Xena cycle[1].
[1] 082d67f596
Related-Bug: #1929178
Change-Id: Ifeda4499b46129bf81f10286f38fff409c93f907
Change 74eadfbd58 replaced usage of
metric aggregate API by Dynamic aggregate API.
However the Dynamic aggregate API returns a different response code
(not 404, but 400) in Gnocchi <= 4.4 and this is causing the direct API
error when the metric associated with the aggregation does not exist.
This change adds 400 to the ignored response codes so that Aodh api
does not return error even when the associated metric is not yet
created in Gnocchi.
Closes-Bug: #1974682
Change-Id: Ief75ccdc0fe5c6a197fc05bc481a5be096447558
Switch to using the Dynamic Aggregates API as the Metric Aggregation
API is deprecated.
When using the Dynamic Aggregates API, any aggregation using rates
can use the underlying base measures for the aggregation rather than
the rate, for example:
(aggregation rate:mean (metric cpu mean))
The tuple of data for each record returned via this API is encapsulated
with information about the aggregation used so adapt the sanitization
function to deal with this and the formatting of the metrics measures
API as well.
Change-Id: I4f631d224404460138f4050b1b981d577b592544
Closes-Bug: 1946793
The api-paste.ini file defines WSGI definition of API. This file is
regarded as one configuration file and sometimes users need to modify
the file, for example to enable an additional middleware.
However currently aodh-api by default expects the file is located in
the aodh source directory and users should set the [api] paste_config
parameter in addition to copy and modify the file.
This change makes the aodh-api process search the api-paste.ini file
from configuration directories automatically, so that users can more
easily customize the file by putting the modified file in /etc/aodh
(or any other config directories).
If the paste_config parameter is defined as a full path then aodh-api
directly loads the file from the specified path. If the file is not
found then the default file in the aodh source directory is used.
Change-Id: I4a6194fbf6a5317a523d75e3fb6bd2fd055f5100
... so that users can more easily understnad the parameter defines
interval. This makes the parameter name consistent with other services
like designate or mistral, which provides the similar functionality
using the same tooz library.
Change-Id: I53cf905d7f643a3dc41f1121404abe3c9f0e61ac
This change introduces support for Guru Meditation Report(GMR) into
Aodh, using oslo.reportis library.
With this change, each service prints GMR to stderr or file when
the service receives SIGUSR1.
The same was introduced into Cilometer a long ago[1], and this change
is based on the change made in Ceilometer.
[1] https://review.opendev.org/c/openstack/ceilometer/+/196369
Change-Id: I7f67acd98c2089bb248d3249159719a3979d27e7
The oslo_utils.fnmatch module was added to solve an issue in py2.7 but
it is no longer required because py2.7 is no longer supported.
The module was deprecated since oslo.utils 4.9.1[1] and the stdlib's
fnmatch module should be used instead.
SQLAlchemy url is now immutable
Use URL.set to update
Co-authored by: Takashi Kajinami
[1] 4c893c92f551c9dd2a7cfbe7ae8171ad8139df0b
Change-Id: I59c4d93a5914b8e14f7ef93bcaff8d1caaf5e75a
Since 3.7.0, oslo policy started the DeprecationWarning[1] if
deprecated_reason and deprecated_since param are not passed
in DeprecatedRule or they are passed in RuleDefault object.
These warnings are logged for every test which increase the
log size and sometime can full the log buffer and fail the
job.
[1] https://github.com/openstack/oslo.policy/blob/3.7.0/oslo_policy/policy.py#L1538
Change-Id: I8b9f0611364f6857b86fc800c89fe403672af975
The [coordination] check_watchers is no longer used in any
implementation. This change deprecates the parameter so that we can
remove it in a future release.
Closes-Bug: #1929178
Change-Id: I973eb15433e66c75366666940a841e5a579bf0e8
This patch introduces the same functionality as is implemented in panko
recently[1], and allows us to limit the number of alarm histories
deleted in a single iteration, to avoid the query takes a long time and
if there are many expired records.
[1] Icf83ffe089301b3782273923f18efd4d209131c2
Change-Id: Ie1d1bbb911cf56a56f712291f61ffaabfa97422f
The notifier group are duplicated when defining options. This is not
affecting functionality but make the code less readable. Let's merge
these tow using itertools as is done for other groups.
Change-Id: Icd8389c771363235062807c31a866d2960726ec6