Since oslo.context=4.0.0 Feb 3, 2022 the deprecated argument
tenant was removed [1]
- Bump docutils in lower-constraints and test-requirements
[1] f4cbe4c296
Change-Id: I703d49f5e5870bf45030fc5502749e197aae3a3b
As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to do two things:
1. Change the default value of '[oslo_policy] policy_file''
config option from 'policy.json' to 'policy.yaml' with
upgrade checks.
2. Deprecate the JSON formatted policy file on the project side
via warning in doc and releasenotes.
Also replace policy.json to policy.yaml ref from doc and tests.
[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html
Change-Id: Ibb26169656785330e7d86a362fd110222fb63a07
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Remove hacking and friends from lower-constraints, they are not needed
for installation.
Change-Id: Ia16e8cbccf7b38be8909aa94e66c04b99f200b89
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: Ie775b99cdb645f072c0a22fa1a1a47448970b103
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
The change allows passing supported options as dictionary to create a
Kafka producer object.
Change-Id: I7627a8caa2d6bb9c7789df143e72a4085060b164
Story: 2006059
Task: 37531
In Python 2 Kafka message value gets implicitly converted to unicode in
delivery_report function. In case the message value already contains
unicode characters the convertion fails with UnicodeDecodeError.
This case can be reproduced when trying to run:
u'goose: {}'.format('gęś')
This commit fixes the debug message and avoids implicit type convertion.
Change-Id: Ia9463cd4e9f92cdf18b092abd2cf676aa4966679
Story: 2006503
Task: 36481
The change moves LegacyKafkaMessage object and client factory module
from the commponents commonly using it (persister, notification).
Story: 2003705
Task: 36094
Change-Id: I61ecf2cdf1dbe9a134df53c3a36614f84e8baa4e
The change fixes:
`TypeError: on_revoke expects a callable`
when `repartition_callback` is not set.
Change-Id: I488d6c99e2f2ad857d44b471c5b62e549062a46e
Story: 2003705
Task: 36093
Even when there is no new message consumed the consumer loop should
proceed to execute the commit callback. Otherwise the batched messages
which which were consumed earlier do not get commited until new message
arrives. Although the case is nearly impossible to happen in real
environment it causes tempest tests to fail when only two messages are
created for testing.
Story: 2003705
Task: 35855
Change-Id: Iffee218b0a9cac572b6ea13d96da5b8f9e0d0b0d
The code of alarm_expr_parser was copied from monasca-api to monasca-common
in order to be used in monasca-ui, but after more than a year it isn't used
in monasca-ui.
Change-Id: I4b4dc0410715ab9e1f4c7fc786df10ec2f615b59
Story: 2001837
Task: 35800
This patch changes the use of "async" with the PEP8 recommended
convention. As of Python 3.6, the following deprecation warning is
displayed:
See PEP 492 for further details.:
https://www.python.org/dev/peps/pep-0492/
Change-Id: I0e3fd5b70fb34ee3b4f1eb444c27279479b3bc60
Story: 2006176
Task: 35700
Confluent Kafka client throws the KafkaError._PARTITION_EOF exception
when no new messages are available in a given partitiion. We should
catch this case and continue consuming after a short sleep.
Story: 2003705
Task: 30116
Change-Id: I44add24df764bbc4e718358a8af75903e035f3f0
This change provides a wrapper around a high-level Kafka consumer which
can be used in all Monasca components, in particular in
monasca-persister and monasca-notification.
Story: 2003705
Task: 29711
Change-Id: Iee317c3016f9868616022389209e36994cf185cf
In the general validate_metric case, when possible add the metric
name to the exception message. This makes it much easier to
track down what metric failed.
Also, fixing code where an exception could be thrown but then
immediately ignored and another exception fo the same type
with a different message would be thrown.
Change-Id: I8b8f04bb98a65b6904894dc00af88ea367a350f8
Story: 2004185
Task: 27675
The type 'long' no longer exists under python 3. The runtime execution
of the code using it in the metrics module already detects the python
version, but when the linter is run under python 3 it does not apply
the same check. Add a noqa pragma to tell the linter to ignore the
line where 'long' is referenced to avoid an error.
Change-Id: If806e6461358ea523708eceed6fdcc3dfb8d75a9
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
* set the maximum line length to 100
* removed unnecessary ignores
* updated codes for pep8
* added apache 2.0 license for missed files
Change-Id: If9398a8fdd094e50d6a07cb73f7389558dbe0a0d
Signed-off-by: Amir Mofakhar <amofakhar@op5.com>
These messages can be used for testing unicode in monasca-log-api and
monasca-tempest-plugin.
Change-Id: I51843dcda5059599a87e3e136a75faa25da67660
Story: 2001400
Task: 6222
Under monasca_common/policy an enforcement engine is added for using
oslo.policy in the other monasca projects.
There are same methods as in enforcement engings currently used in
nova and keystone projects.
Also added unit tests under tests/policy for testing implemented
methods.
Task: 6105
Story: 2001233
Change-Id: Ic5402ba0986416c9386c1dc3fc1559f148ea9625
Signed-off-by: Amir Mofakhar <amofakhar@op5.com>
On failure to publish, clear the topic metadata then retry, in
case the IP Addresses have changed. This can occur when
Monasca is run in Kubernetes and the Kafka pod is restarted.
Restarting the Kafka pod can happen often enough the
API should be able handle it without losing a message.
Change-Id: If48971c40883b5be10adec947562cdda7e82d77c
Story: 2001386
Task: 5963
PROBLEM: Consumer offset was resetting to the latest index rather than the earliest
SOLUTION: Modified consumer creation to include `auto_offset_reset="smallest"` which
allows the offset to reset to the earliest known index.
NOTE: This does exactly what the whence parameter in SimpleConsumer.seek()
is expected to do, however in order to achieve this functionality,
the parameter `auto_offset_reset` MUST be set to either "largest"
or "smallest".
Change-Id: I887892d80f2da9619c7f11737b3ab2e1d1dacf1e
The new alarm rules will each have an expression in their
definition which will need to be parsed by both the Monasca-
API and the Monasca-Notification-Engine. Documentation for
this will be included in the API along with descriptions of the
new rules.
Story: 2000939
Task: 4692
Change-Id: I1a98fafae8dfdfa6fdb2eb66f4a4a4f40e518e46
This replaces the deprecated (in python 3.2) unittest.TestCase
method assertRaisesRegexp() with assertRaisesRegex()
Change-Id: I0bed1f2a0bb8ef57a48e3b778795e8ac75f3a2eb
Following commits does several things:
* migrates CI of monasca-common to ostestr
* enables PY35 compatybility
Also:
* marked one tests as excluded under PY35 because changing
it would require affecting embedded kafka library which
will be eventually removed in future
Change-Id: I432a466e2620bc8d305ef2630307b636461c8e81
monasca_common.logging seems to be unused
in other monasca projects therefore should
be removed.
Also removed one dependency that was used only
by that module
Change-Id: Ib875d9bae86c9b2b715edbe0226347b3fc9ec8ed
long, as type, is also possible to be a timestamp
format
Needed-By: I2f9d22a2c5e18826c8f9bb1e817ad963731b390f
Change-Id: I186abe4cdafd58d998f8aaf36d866795771a9e0a