Commit Graph

201 Commits

Author SHA1 Message Date
Martin Chacon Piza a6e56ab63c Add Support for Falcon 3.0.0, 3.0.1
- Support to new Falcon 3.0.0 and 3.0.1 keeping compatibility
for version 2.0.0

- Remove Falcon's class OptionalRepresentation
Starting from Falcon 3.0.0 version the class OptionalRepresentation
was removed. [1]

- Remove unnecessary URL slashes which are not compatible
with Falcon >= 3.0.0

- Keep facon.API instead of new falcon.App to keep support for
version 2.0.0

- Disable temporary docker-build and docker-publish Zuul jobs.

[1] https://falcon.readthedocs.io/en/stable/changes/3.0.0.html#breaking-changes

Change-Id: Ifb067429dd66fd350110187ac3a8b6a9977bad90
2021-06-06 21:29:22 +02:00
Zuul c7e0ecdfc5 Merge "Update hacking for Python3" 2020-04-23 11:08:18 +00:00
Zuul 176985da7c Merge "Allow users to set periodic notifications on all notification types" 2020-04-22 10:09:43 +00:00
Andreas Jaeger abad342eb2 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found by updated hacking version.

Remove hacking and friends from lower-constraints, they are not needed
there at all.

Change-Id: I35d848e9af297d3561ea2838a4808166d1c36601
2020-04-22 07:37:55 +00:00
Martin Chacon Piza 0b7dc58296 Migrate from ujson to simplejson
The change updates the imports to use simplejson library and
monasca_api.common.rest instead of monasca_common.rest, since
it was moved to this project during the API's merge.

Temporarily set following jobs as non-voting:

* monasca-tempest-python3-influxdb
* build-monasca-docker-image
* publish-monasca-api-docker-image

Change-Id: Ife3d2c9795a9dc406c2927cc9a077dda01c183c6
Story: 2007549
Task: 39389
2020-04-18 10:28:24 +02:00
Doug Szumski 92fbb93091 Allow users to set periodic notifications on all notification types
In some cases, users may want to send periodic notifications for
notification types other than webhooks.

Story: 2006837
Task: 37417
Depends-On: https://review.opendev.org/#/c/694596
Change-Id: Ia2c50e623aa79e06d2d35df4735fb2805fbf40ed
2020-01-21 10:49:22 +00:00
Doug Szumski f4dce6c37d Support batching metrics when writing to Kafka
When a large post (> 10s of MB) is made to the Monasca API an attempt
is made to write these metrics to the metrics topic in Kafka. However, due to
the large size of the write, this can fail with a number of obscure errors
which depend on exactly how much data is written. This change supports
splitting the post into chunks so that they can be written to Kafka in
sequence. A default has been chosen so that the maximum write to Kafka
should be comfortably under 1MB.

A future extension could support splitting the post by size, rather than the
number of measurements. A better time to look at this may be after the
Python Kafka library has been upgraded.

Story: 2006059
Task: 34772
Change-Id: I588a9bc0a19cd02ebfb8c0c1742896f208941396
2019-11-15 16:33:15 +00:00
Zuul 313a3ad7af Merge "Merge log-api and api" 2019-09-27 17:53:02 +00:00
Zuul b2c9e1551f Merge "Support time range to query dimension names/values" 2019-09-27 10:48:51 +00:00
Bharat Kunwar 233ea9c51b Support time range to query dimension names/values
At present, dimensions are not scoped by time window, which makes
dimension related queries to large databases timeout because it searches
all of time instead of a time window specified on the grafana app.

This commit implements the server side changes required to scope the
search query by the time window specified on the app.

Change-Id: Ia760c6789ac0063b8a25e52c9e0c3cc3b790ad2d
Story: 2005204
Task: 35790
2019-09-26 15:11:19 +00:00
Adrian Czarnecki d2379a018e Merge log-api and api
*Merge monasca-log-api into merge-api
*Enable logs endpoints
*Add configuration that allow to enable/disable metrics and logs part
*Remove redundant log-api source code

Story: 2003881
Task: 30533
Change-Id: Iaa5689694e7081f3375f1a2235cad31d6a7b5f76
2019-09-26 12:02:20 +02:00
Martin Chacon Piza 2485e39b53 Merge monasca-common code into the monasca-api
This change copies the code from monasca-common used by the 3
monasca APIs into monasca-api for the Merge-APIs target.

After mergin the APIs the duplicated code can be removed from
monasca-common.

Change-Id: I52d36fad846637baf10516f5cbbedc541d4c2064
Story: 2003881
Task: 30427
2019-07-26 14:08:31 +02:00
akhiljain23 0fae94fac2 Update hacking version to 1.1.x
This commit updates hacking version in test-requirements and
fixes some related pep8 issues

Change-Id: I67d85eb5bef72c38cc5360b5625d6b1c37adb40f
Story: 2004930
Task: 29315
2019-06-20 04:52:24 +00:00
Doug Szumski a9cc4bb482 Add support for using Falcon 2.0.0
Falcon 2.0.0 introduces some breaking changes. The relevant ones here are:

- falcon.testing.TestCase.api property was removed
- falcon.testing.TestBase class was removed

Additionally, the default behaviour for handling trailing slashes on
URIs also changed:

https://falcon.readthedocs.io/en/latest/user/faq.html#how-does-falcon-
handle-a-trailing-slash-in-the-request-path

This commit adds support for using the new release. It currently makes
no effort to be backwards compatible with older releases.

The change also updates the requirements for influxdb and sphinx
libraries to match global requirements.

Until monasca-log-api implementation is not updated to support the new
version of Falcon, `monascalog-python3-tempest` is marked to be
non-voting as agreed in the team meeting.

Story: 2005695
Task: 31015
Change-Id: I03bc8d502a333a7a71d9c12b8ddc7c5dc0a4f588
2019-05-29 16:10:53 +02:00
Adrian Czarnecki e18ed3f02d Improve tests coverage
* Add unit tests
* Fix python3 and python2 compatibility

Story: 2003881
Task: 29254

Change-Id: Ib54b94737dace3104976321e38ad1a9076a46877
2019-03-11 14:49:33 +00:00
Witold Bedyk 11e5bceffd Fix exception handling in _alarm_definition_create
Use oslo encodeutils to safely format exception title and description
both in Python 2 and 3. Otherwise exception is thrown[1]:

  TypeError: b'Invalid alarm expression' is not JSON serializable

[1] http://logs.openstack.org/58/606658/2/check/openstack-tox-lower-constraints/0a33141/testr_results.html.gz

Story: 2003240
Task: 26920

Change-Id: I78ca6f43a4d998613d4c3f64f82a384701d620dd
2018-10-05 14:10:04 +02:00
Adrian Czarnecki 7ba3a8b7ab Python3: Fix failing tempest tests
Fix sorting and string encoding

Story: 2000975
Task: 24394

Change-Id: Iaf4575b47fdc299c4e9eb77e19c36bebb0642ec8
2018-08-24 08:33:18 +00:00
Witold Bedyk 0d218ddae5 Remove usage of future library
*future* library is not listed in global-requirements and should not be
used. This commit removes all its occurences and replaces with
oslo_utils.encodeutils module.

Change-Id: I5d0795a1a894c103422f7d63f5d76b29ea6d15a4
Story: 2003193
Task: 23360
2018-08-01 14:32:33 +02:00
Zuul 378408a490 Merge "Using oslo.policy for monasca-api" 2018-06-07 10:52:26 +00:00
Amir Mofakhar 3ca4b057dd Using oslo.policy for monasca-api
Added policies and used policy enforcement engine
from monasca-common.

- Replaced security with oslo.policy
- Updated unit tests and implemented some new tests
- Added a new entry point for generating sample policy file by tox

story: 2001233
task: 6355

Change-Id: I4aa444fe6ec883160c03c201145c77994b6615f9
Signed-off-by: Amir Mofakhar <amofakhar@op5.com>
2018-06-05 12:25:07 +00:00
Zuul 5bd1b5e212 Merge "Add py3.5 support for alarms endpoint/unit test" 2018-05-24 11:31:31 +00:00
Zuul c4fed020db Merge "Add py3 support for versions endpoint/unit test" 2018-04-18 09:02:29 +00:00
Adrian Czarnecki 8efd03aab8 Add py3.5 support for alarms endpoint/unit test
* Python 3 dict.values() returns iterator, must be converted to list
* use `u` prefix for unicode literals
* use builtins.str for handling unicode
* use oslo_serialisation for loading JSON objects

Can be tested with:
  tox -e py35 -- -r monasca_api.tests.test_alarms.*

Story: 2001400
Task: 12580

Change-Id: I0cc7018f7d5efedb4937922b6daa2fb59b3d645c
2018-04-12 17:34:17 +02:00
Adrian Czarnecki c6e72ff66d Add py3 support for versions endpoint/unit test
Story: 2000975
Task: 12578

Change-Id: Id40c574c1e6ab8a88a9cd4f640fc66d426e15ac0
2018-04-11 12:36:25 +00:00
Jui Chandwaskar 03bd329dd0 Update pep8 checks
* Update max line length to 100
* Clean up code for pep8 checks

Change-Id: Ibde2939831e6eeaab3db66fbc18255c71592bb41
Signed-off-by: Jui Chandwaskar <jchandwaskar@op5.com>
2018-04-11 12:40:27 +02:00
bandorf 8f231733cc Fix bug: Use correct dimension name in expression
Change-Id: If3db2f3b11b27681afa35b31511dfa3422706376
Story: 2001753
Task:  12134
2018-03-29 11:50:23 +02:00
bandorf 404fe5e932 Fix:No alarms created if metric name in alarm def. expr. is mix case
Change-Id: I38cb00fe7b10bbe6732022e8fffcecd7e5eab6b5
Story: 2001539
Task: 6349
Depends-On: I739612e96a2975bde12aea91f3f8dfcd6fb15342
2018-02-20 14:44:09 +00:00
Andrea Adams f69cb3152a Revert "Adds tags for inhibit and silence"
This reverts commit 8781a256f0.
Since this only implements part of the silence / group / inhibit
feature, reverting until the rest is ready to go

Change-Id: Ied34507feb5d3580960c918254f905ab90d9691e
2018-01-31 09:56:50 -07:00
James Gu ba43f07726 Add cassandra support
Support Cassandra db installation and Cassandra related
configurations for Monasca api and persister services
in devstack. Add Monasca rest API Cassandra plugin for
retrieving metric, dimension, measurement, statistics
and alarms.

Change-Id: Ie60d668692e1f25f555dda2355f4e513d582736c
story: 2001231
task: 5759
2017-12-15 19:11:00 +00:00
Christoph Held 346898b1df Fix exception handling for python3
Story: 2000975
Task: 5838
Change-Id: I2cdd9882a01b91d562544ad34059c9b91967231e
2017-11-23 08:39:23 +01:00
Andrea Adams 8781a256f0 Adds tags for inhibit and silence
The new silence and inhibit rules will include tags on the alarm
that can be queried via the api. For more information and
documentation see: https://review.openstack.org/#/c/466403

Change-Id: I85b8bfc9338ee17709ec30aeb4b807b3bc12404e
2017-10-25 05:08:57 +00:00
Tomasz Trębski 5d27af4079 Config-generator for monasca-api
Change migrates the monasca-api to use oslo-config-generator in
order to always build newest configuration file. That removes
the need of maintaning the file along with changes to oslo configuration.
The example of the file is also included in the documentation.

Also:
* ported case for launching api under WSGI and allowing the argument
  parsing of oslo to take place

Story: 2000970
Task: 4865

Story: 2000964
Task: 4106

Change-Id: I57547b0e2122e40f58db5f949773900b76214526
2017-08-28 06:58:57 +00:00
Tomasz Trębski 332634f74f Prepare foundation for doc migration
Commit aims at providing the foundation to launch
doc migration for monasca-api:

* api-ref
* releasenotes
* doc

Extra:
* fixed documentation errors to enable codebase documentation

Story: 2001058
Task: 4768

Change-Id: Ic7af65a154dba7e52ffb90d0e6dbf0ae87d5d699
2017-07-31 10:43:49 +00:00
Jenkins 9645052990 Merge "Actions enabled return bool on alarm definition create" 2017-07-26 08:48:30 +00:00
mhoppal c26e674cb5 Actions enabled return bool on alarm definition create
Spec is supposed to be a boolean and current code
has it as a string

Fixed unit tests

Change-Id: Id790dca53af161df40e770322b3af3270264199a
2017-07-25 20:48:55 -06:00
Luong Anh Tuan 4e7cb91a0d Replace basestring with six.string_types
https://wiki.openstack.org/wiki/Python3

Change-Id: I02d3cad58031400af66c1a4eca1e9f3ac669463f
2017-07-10 23:57:20 +07:00
Kaiyan Sheng 157772b16b Fix links in update and patch alarm definitions
Current on_patch and on_put for alarm definitions returns
"links":[
  {"href": "http://localhost:8070/v2.0/alarm-definitions/
ca813286-453a-4b63-9b62-c4be0232db6c/ca813286-453a-4b63-9b6",
   "rel": "self"}]
It has id on the link twice which is wrong.

Change-Id: Ida1d37a606cd03a0a9c043172c00adf15b6ac74c
2017-06-22 13:51:53 -06:00
Habeeb Mohammed 6e81a61900 Fixed HTTP error code for alarm-definitions
Problem: Received HTTP 422 Unprocessible Entity when alarm definition
	id is not specified in query instead of HTTP 400 Bad Request.

	Solution: Modified on_delete(), on_patch(), and on_put() to return
	HTTP 400 Bad Request.

Change-Id: I668d1f7cd257abbdf5d5d6b78552a152bd67aa60
2017-06-16 13:38:06 -06:00
Habeeb Mohammed fcd02568ef Fixed endpoint required parameters for DELETE
Problem: Received HTTP 500 Internal Server Error when using DELETE in query
	without specifying alarm definition id.

	Solution: Modified on_delete() so that if alarm definition id
	is not specified, query response will be HTTP 422 Unprocessible Entity.

Change-Id: Ie4518cb5a082211190f0364673944ecfca43948e
2017-06-14 09:41:26 -06:00
Habeeb Mohammed 3cfe84051c Fixed endpoint required parameters
Problem:
        Received HTTP 500 Internal Server Error when using PATCH or
	PUT in query without specifying alarm definition id.

        Solution:
        Modified on_patch() and on_put() so that if alarm definition id
	is not specified, query response will be HTTP 422 Unprocessible Entity.

Change-Id: I0a212f09cb76d1b4db6f129fe9ca94ec1fc274df
2017-06-08 10:41:26 -06:00
roland-hochmuth c8694aeff8 Remove xrange for run both Python 2 and Python 3
Change-Id: Ibf1b45fe27f1943265cdc36e99b7a53263885eb2
2017-05-31 08:51:43 +02:00
Artur Basiak 4e168edf6e Add healtcheck endpoint
Provide new healtcheck endpoint to monasca-api.
Add simple check for HEAD and complex check for GET.
Complex check contains information about dependent
services like:
- kafka
- relational database (mariadb, postgresql)
- timeseries database (influxdb, cassandra)

Story: 2000974
Task: 4125

Change-Id: I863071194041a512b144262bbffce5024b97086b
2017-05-30 11:30:56 +02:00
Tomasz Trębski ed8238dfdc Use monasca-common json processing
Following replaces usage of standard
json with monasca-common rest layer.

Depends-On: I186abe4cdafd58d998f8aaf36d866795771a9e0a
Change-Id: I2f9d22a2c5e18826c8f9bb1e817ad963731b390f
2017-05-09 11:09:42 +02:00
Artur Basiak c7c3fba304 Use proper type for notification periods
Use int for valid_notification_periods to
have list of integers not list of strings.

Change-Id: I70f5aab2eb4956167b507960d6be441827355720
2017-04-10 12:52:07 +02:00
Artur Basiak ef16dd6cd5 Remove unexpected argument
Remove unexpected argument sqlite_db since it was removed from
oslo.db.

Change-Id: Ic5778b2ac0a4b4c6ad62ee2335a9cc472c949db6
2017-03-29 07:18:59 +02:00
Shinya Kawabata e8831f8229 Add multibyte character support for alarm definition
It was failed that putting multibyte character into
alarm definition name and description by monascaclient.
There were some mistakes about treatment of utf8 encoding.
And mysql connection had no utf8 option, so mysql could not
handle multibyte character.

Change-Id: I8743f89fcc5d5efd4e50f440b76d78abc037e8e7
2017-03-14 15:24:00 +01:00
Jenkins 414b725e37 Merge "Use oslo.db for sqla driver" 2017-03-11 19:39:53 +00:00
Kamil Choroba dcd65110df Bugfix: Forbid colon in dimension name
Monasca-Agent http_check plugin creates
dimensions which contain multiple colon:
url:http://192.168.10.4:5601

This bugfix makes it possible to query for
metrics with such dimensions. Until now an
exception was thrown.

Closes-Bug: 1668937
Change-Id: I39ed6fba99491630f6a7e0c67743b807e3529461
2017-03-10 13:35:04 +01:00
liyingjun f379d71fcb Use oslo.db for sqla driver
Use create_engine in oslo.db instead of the sqlalchemy one to get
the optimization benefit from oslo.db.

Breaking change would be replacing database.url with
database.connection therefore database.url will be still
supported until Pike is released. database.url
has been marked as deprecated option.

Change-Id: Id3cdafa791a7d2558a5b065022a9afc6ff31e004
Closes-bug: #1640419
2017-03-08 10:08:42 +01:00
Jenkins adb4ace41c Merge "Remove unused logging import" 2017-02-20 10:56:43 +00:00