Commit Graph

38 Commits

Author SHA1 Message Date
Martin Chacon Piza 9dbfe8056e Remove project content on master branch
This is step 2b of repository deprecation process as described in [1].

[1] https://docs.openstack.org/project-team-guide/repository.html#step-2b-remove-project-content

Change-Id: I210c2fe3bbe2a702f42ec1df95f328b8011d8014
2021-02-22 15:16:37 +01:00
Sean McGinnis 2fe47c29c9
Use unittest.mock instead of third party mock
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: I8ac5e339700316b07b7c548f24ffc8dd83110df3
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-18 11:54:45 -05:00
Andreas Jaeger a0c6625d20 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Change-Id: Ica99c9a4affd2b693ef74f1e3ef7c8ea2c6a46d6
2020-03-31 06:49:19 +00:00
Joseph Davis ee80e0f54c Refresh against ceilometer master
There have been a few changes in ceilometer repository, specifically
https://review.openstack.org/#/c/596378/, which warrant an update
post-Rocky.

Change-Id: I9e127e0976be4c44bd56a977a755564a88fc1b44
2018-10-09 16:49:57 -07:00
Joseph Davis 8b0fb6d048 Refactor out Ceilometer V2 API related code
As of Queens the Ceilometer V2 API has been removed.  Storage
driver related code in monasca-ceilometer can thus be removed.

Backport some refactoring that came up in creating
https://review.openstack.org/#/c/562400/
Realized some class names could be clearer and fit better with
Ceilometer.

Update test-requirements.txt with Rocky release of
python-monascaclient.  Also include more license info.

Specify py35 instead of py34 in tox.ini (gates already using py35).

Include updates to devstack configuration to keep up with master
ceilometer.  These include adding values for the [monasca] section
in ceilometer.conf and refreshing setup.cfg as well as updating
how the connection url to Monasca API is configured.

Also include some testing notes in devstack/README.md

Change-Id: I9291dfc06d67f18109a0ff66184bd418c6361977
2018-08-09 10:11:28 -07:00
Luka Peschke cdedb90ed8 Allow unicode for metadata keys in publisher
I encountered a bug whith the following configuration in
monasca_field_definitions.yaml:

  metadata:
    cpu:
        - flavor_id: flavor["id"]
        - flavor_name: flavor["name"]

The problem was in _get_value_metadata_for_key(): sometimes keys
from ceilometer samples can be unicode.

Change-Id: I8914c2238f3a450393f07e6309f57451c8c45cf2
2018-02-13 17:13:00 +01:00
Ashwin Agate 4a2c73685f Monasca Ceilometer in sync with Ceilometer master
Following changes are necessary to keep monasca-ceilometer
in sync with Ceilometer upstream

* Remove api/health.py (since ceilometer v2 api was removed)
* Remove storage/impl_monasca.py (since ceilometer storage drivers were removed)
* Updated opts.py and service.py (to keep in sync with ceilometer master)
* removed api, storage driver tests
* updated /etc/ceilometer/ceilometer.conf with new [monasca] options

Change-Id: I044f3e512db52a128bac8d5c5dcac76549a3b1c2
2018-02-09 13:21:53 -08:00
Ashwin Agate 8cff9c154b Remove oslo config global conf dependency
Ceilometer in Ocata made several changes to
move away from  oslo config's global conf.
Instead ceilometer/service.py now creates a
oslo config object that gets passed to the
publisher.

To keep up with the changes had to make
the following changes in monasca-ceilometer
1.) Monasca Publisher now extends
ConfigPublisherBase, with conf as argument
2.) monasca_client now takes conf as an
argument during intialization.
3.) Added monasca_ceilometer_opts to
intialize all ConfigOpts. This will have
to be regiested in ceilometer/opts.py.
(will need a additional line in opts.py)
4.) Introduced three new properties
service_username, service_password and
service_auth_url since username, password
and auth_url were removed from
[service_credentials] section.
5.) Added api/health.py, service.py
and opts.py from ceilometer code base
which were modified to read
monasca ceilometer options via
monasca_ceilometer_opts.py
6.) Added ostestr to test requirements
and updated tox.ini to run tests in
serial (to avoid problems with
singleton mapping classes, stepping
on each other test values  when
run in parallel)

List of Ceilometer changes to remove
global conf
[1] https://review.openstack.org/#/c/384834
[2] https://review.openstack.org/#/c/384624
[3] https://review.openstack.org/#/c/386025

This change also modifies test-requirements.txt
to bring this master branch up to the stable/pike
version of ceilometer, and python-monascaclient
up to 1.7.1 (pike).

Change-Id: Ieb7962a50fdb5d12ea6238c96ed116e8b2c83c48
2018-01-21 14:40:54 -08:00
Hangdong Zhang 3a12eb4bd4 Update the documentation link for doc migration
Change-Id: Ib36aca9dd3b1927937a4e56b25b1cde3a084a196
2017-07-21 10:59:43 +08:00
Luong Anh Tuan 1e36f23561 Using fixtures instead of deprecated mockpatch module
This module mockpatch of oslotest[1] is deprecated since version 1.13
and may be removed in version 2.0. Use fixtures.Mock* classes instead[2]

[1]OpenStack Testing Framework and Utilities
[2]https://docs.openstack.org/developer/oslotest/api/oslotest.mockpatch.html#module-oslotest.mockpatch

Change-Id: Ie54cc051829cc2370cab9cd3a7d9542e2abc51ab
2017-05-29 22:56:36 +07:00
chenaidong1 ed66241798 Fix a typo
Change-Id: I1190c51ccb4b541b75b37033add2680f04e9f7dd
2017-05-05 11:31:43 +08:00
Joseph Davis 46e76a488a Support jsonpath definitions in monasca_field_definitions.yaml
To enhance flexibility when mapping a ceilometer sample to the
monasca fields, add support for jsonpath parsing of metadata.
For example, the cinder samples have metadata stored in lists,
which the current parsing (including . notation) cannot handle.
Similar requests have been made in the past, and this should
give enough power to meet most requests.

For a jsonpath that does not resolve to a simple leaf (string
value), a CeiloscaMappingDefinitionException is raised.

See https://storyboard.openstack.org/#!/story/2000954

Change-Id: I8d7f5e1b87a1de6078b4d397e96dab624fde42bb
2017-04-13 11:53:16 -07:00
Jenkins e8cce1d696 Merge "Ceilosca pagination hanging problem" 2017-04-06 11:06:41 +00:00
Jenkins 0cf05e5c1b Merge "Using fixtures.MockPatch instead of mockpatch.Patch" 2017-04-02 12:34:52 +00:00
Ashwin Agate fa1b90255b Ceilosca pagination hanging problem
If enable_api_pagination is turned on
ceilometer statistics api call with group by
did not return any results. This review fixes
problem with indentation. Also fixing similar
problems with metric_list and measurement list
calls in monasca client.
Also added unit tests to test metrics list,
measurement list and statistics list when
pagination is enabled and also when disabled.

Change-Id: I2394da8c0c32d8516ac8136fcaaef87e546966b0
2017-03-31 12:33:27 -07:00
hnyang eddc07c58b Remove log translations
Log messages are no longer being translated. This removes all use of the
_LE, _LI, and _LW translation markers to simplify logging and to avoid
confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: I471d79a86d88e98688246ffbdc29fb579f5fd52a
2017-03-22 12:33:12 +08:00
gecong1973 00ef4fe14f Using fixtures.MockPatch instead of mockpatch.Patch
This module has been deprecated in favor of fixtures.MockPatch.

Change-Id: I0f0efc4167407a03ba0682b629dd7b8de3cd38ba
2017-03-09 11:43:04 +08:00
Atul Aggarwal a0f873f413 Adding query metric mappings, dimensions, futurist, paging
Adding capabilities to ceilosca to be able to query metrics that
are already being collected by monasca using mappings files
there are two types of mappings:
  1. Static Mapping: Currently it is used to map any static info
     about ceilometer meters like the type of meter or unit
  2. Extensive monasca mapping: currently it is used to map any
     monasca metric to a ceilometer meter example:
     meter_metric_map:
       - name: "disk.device.write.requests"
            monasca_metric_name: "vm.io.write_ops"
            resource_id: $.dimensions.resource_id
            project_id: $.dimensions.tenant_id
            user_id: $.dimensions.user_id
            region: "NA"
            type: "cumulative"
            unit: "request"
            source: "NA"
            resource_metadata: $.measurement[0][2]
     As you can see for this mapping fields on left side of ":"
     are used to map ceilometer fields and fields on right side
     for referring to monasca fields

Both of these mapping files are configurable and can be set in
ceilometer configuration file

cloud_name, cluster_name, and control plane fields
are now added as dimensions by monasca publisher when
publishing metrics to monasca api which is necessary
in multi-region deployment of notification agent.

monasca publisher does not use oslo.service LoopingCall
but instead uses futurist periodics library to enable
batching.

monasca client now pages through monasca api results
if enable_api_pagination is enabled in configuration.
This flag is disabled by default but should be enabled
if monasca api supports paging using "offsets"
parameter.

Tox testing is now targeting stable/newton branch of
ceilometer.

DocImpact

Change-Id: I83b96325cb79d82858cf529935e5d699a509f6c3
2017-03-01 16:26:44 -08:00
Nguyen Hung Phuong c0f8072949 Clean imports in code
In some part in the code we import objects. In the Openstack style
guidelines they recommend to import only modules.

http://docs.openstack.org/developer/hacking/#imports

Change-Id: Ibdb1fc5b52b07ab9098dd9a72aecd938d1515132
2016-09-15 15:08:23 +07:00
Atul Aggarwal ac78ecbb02 Fixing performance for ceilometer statistics list and use
monasca's group_by option to avoid metrics-list calll which is
not necessary.

Change-Id: Id65549088d15141daccc78ef90e735c550da63c8
2016-08-30 16:48:28 -07:00
Srinivas Sakhamuri 02ca4e80fe Uses devstack plugins to deploy ceilosca in devstack
- Leverages monsaca devstack and uses new devstack plugin model
to setup ceilosca.
- Also some refactoring in directory structure

Change-Id: I097c86f92e1ec09ceeb3d0d4831ff8c51c3aa1a3
2016-05-31 14:36:12 +00:00
Atul Aggarwal 6c2780af1e Allowing Ceilometer to use timestamp in metriclist query
When available metric list should include the timestamp for metric
list query as well to have better performance in avg case.

Change-Id: I5200e90454c419d24f554c69bcfa3c8c97c0353d
2016-03-23 00:31:39 -07:00
ZhiQiang Fan 143a308b8c Implement complex query API
Complex query computes the single complex query to multiple simple
queries which only use AND operator, each simple query will invoke
get_samples() method. Complex query collects all the results till
limit constraint is satisfied.

Change-Id: I0da398d4d3627fcbfe2c686acf5b0fa9a68492b7
2015-12-23 01:14:05 -07:00
Rohit Jaiswal ff9bbb979a get_resources and get_samples uses iterative approach
Implements get_resources and get_samples using
iterative approach with limit, monasca measurements
api accepts a limit, but cannot be used here since
user can query for measurements from different metrics.

Change-Id: I87d070c60af3435d20917ffc5d07adf8ed749ee2
2015-12-18 09:29:27 -08:00
Rohit Jaiswal b704e3f9c7 Implements groupby for statistics API
Queries for metrics to obtain all dimensions
before quering for statistics with merge_metrics
as False, which returns response with dimensions.

The statistics response with dimensions is used to
perform in-memory computations based on the groupby
dimension. Only a single groupby is supported.

The current implementation is memory-intensive and
can be improved further to constrain memory usage.
This patch is an initial step in that direction.

Change-Id: I98ad72337ed50b2f6703afc2e7c4e4689590b2c7
2015-12-11 17:07:08 +00:00
Rohit Jaiswal 9c2c1e878e Handles input aggregate for statistics
When statistics API is used with custom
aggregates as input, there is an attribute
error in client as it expects an aggregate
dict in response.

This adds the aggregate dict in response
when input has an aggregate function.

Change-Id: Ide13f5d16b6e4ef11cdcb9c98d85200efaf0cb91
2015-12-11 17:06:45 +00:00
Rohit Jaiswal 948d96f76c Fixes statistics API when timestamp is specified
When timestamp/timestamp range is specified,
statistics API fails because timestamps are not
being converted to ISO 8601 formatted times, also
when parsing the response, the timezone offsets are
not being dropped.

Monasca API expects timestamps in ISO 8601 format
and ceilometer statistics API expects timestamp in
response in a timezone-naive format.

This patch fixes that so that statistics API works
when timestamps are specified in input filter.

Change-Id: I67055a661478fc15a06c3714f431c484f303658c
2015-12-11 17:04:09 +00:00
Rohit Jaiswal 865dab02b7 Migrate monasca-ceilometer to be liberty compatible
List of changes:
* Changed oslo-incubator imports to oslo-service
* Refactored tests to functional and unit packages
* Upgraded test requirement versions
* Added py34 test capability
* Upgraded hacking(pep8) version
* Added devstack plugin and settings to deploy Ceilosca
* Modified setup.cfg to use liberty entry points
* Refactored storage driver to compatible with v2 api liberty changes

Change-Id: Id6711e6661cde14df3decba6f56e52d391981f42
2015-11-18 16:52:53 +00:00
Fabio Giannetti 3f823deee6 Remove Null Data from Publisher
Monasca has added a check for null data. When the publisher does not
find the meter value or metadata it defaults it to Null.

This causes Monasca API to reject the sample. This is particularly
evident in the Central and Compute Agents since they collect data
that may be null.

Change-Id: I51ca07ec10c6b414b6a26c057edc09487053f982
2015-11-12 17:04:53 -08:00
Rohit Jaiswal fa6a78c71d get_samples uses concurrent querying
Instead of sequentially querying for
measurements of a metric with different
dimensions, this patch queries them
at same time using mult-tasking.

Change-Id: Ief0d588ed1cc6d6ed0d1a198e888d545c32c188c
2015-10-19 20:28:58 +00:00
Fabio Giannetti f9cab54558 Enabled Batching
The batching is disabled by default, but we really want to show
how the feature improve performance and I think we should have
it on by default. The batch size has been changed to 1000 also to
be more performant.
The batch timeout has been reduced to 15s.

Change-Id: I276f0e3fa20927a9ccbbedc36238c88c753dab57
2015-09-17 04:17:48 +00:00
Jenkins f729929f7b Merge "Ceilosca deployer scripts" 2015-08-27 18:37:57 +00:00
Srinivas Sakhamuri 0116647915 Ceilosca deployer scripts
These scripts allow installtion of ceilosca on a local machine.

 - Sets up devstack
 - Sets up ceilosca, modifies config and copies files
 - Sets up monasca on the same local box

Necessary information is in deployer/README.md

Change-Id: I2da63ee7075cee5401594408d44dd8f5881d9fe6
2015-08-24 23:04:02 +00:00
Jenkins 2df54f6f75 Merge "Adds support to Mon publisher to archive on error" 2015-08-17 19:40:53 +00:00
yeungp 98729deed1 Simple metaquery for get samples and resources
Currently, monasca does not return metadata for get meters and statistics,
so metaquery for meters and statistics cannot be supported in ceilosca yet.

Change-Id: I2772e936a6b4aa928048c4fb916a036b9f3df61c
2015-08-14 14:53:40 +00:00
Rohit Jaiswal 5d5dd50ecc Adds support to Mon publisher to archive on error
When publishing metrics to Monasca-api fails, the
failed metrics need to be handled in some manner,
otherwise risk data loss.

Currently, Ceilometer notification agent does not
support requeuing of samples on publisher error.

This patch adds the ability to enable metrics
archival (via conf) using FilePublisher in Ceilometer.
This ability is switched off by default.

Change-Id: I482d4466ae106e5292d12a768e8acd4a240f4049
2015-08-13 00:56:05 +00:00
Rohit Jaiswal 652d414be2 Enabling API unit tests
API unit tests are enabled by copying the
ceilometer config files in venv and using
test instance of Stevedore which allows
control over building extensions using custom
entry points.

Change-Id: I601c301d7e0353392498b374a8d6e4741487dac7
2015-08-06 22:04:54 +00:00
Srinivas Sakhamuri f38c9f6c4a Improve unit tests
- Force pep8 to use correct python interpreter
- Add py27 checks
- Use smaller requirements file for pep8 checks

Change-Id: I4a2a642f60c17986739355187c67f403febb79fc
2015-07-23 17:15:50 +00:00