Dimensions with Colons raises malformed exception in monasca-api

Bug #1668937 reported by Kamil Choroba
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Monasca
Fix Released
High
Unassigned

Bug Description

The monasca-api spec definition for dimensions allows the following (https://github.com/openstack/monasca-api/blob/master/docs/monasca-api-spec.md#metric-name-and-dimensions):

The dimension key and value strings may include any characters except the following: > < = { } ( ) , ' " \ ; &

There is no restriction on using COLON ':'.

__Expected behaviour:__

Quering for metrics with dimensions which contain a COLON is possible.

Example Query parameter:

{'start_time': '2017-02-28T06:20:51Z', 'dimensions': 'url:http://192.168.10.4:5601,hostname:monasca.cmm,component:kibana,service:monitoring', 'name': 'http_status'}

At least the url dimension is valid paramter: url:http://192.168.10.4:5601

__Observed behaviour:__

Quering for metrics with dimensions which contain a COLON ':' returns 500 InternalServer.

This error occurs independent of the client. Monasca-cli, Curl and Grafana.

Example Request using Grafana:

http://192.168.10.5/dashboard/monitoring/proxy/metrics/measurements/?dimensions=url:http%253A%252F%252Flocalhost%253A8191%252Fhealthcheck,hostname:monasca.cmm,component:monasca-persister,service:monitoring&name=http_status&start_time=2017-03-01T09:13:51Z

monasca-api.log returns:

DEBUG monasca_api.v2.reference.helpers [req-8b42363e-b933-4a09-ad82-02a47ed54e6a e8138a3a413141b1a6b2c4e940e69713 fe03ce3eb6b3485dbf7c44f055fe0bd4 - default default] Dimensions are malformed get_query_dimensions /opt/monasca-api/lib/python2.7/site-packages/monasca_api/v2/reference/helpers.py:176

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to monasca-api (master)

Reviewed: https://review.openstack.org/439612
Committed: https://git.openstack.org/cgit/openstack/monasca-api/commit/?id=dcd65110df04a84eb5bf2be0c447b98dca2179ef
Submitter: Jenkins
Branch: master

commit dcd65110df04a84eb5bf2be0c447b98dca2179ef
Author: Kamil Choroba <email address hidden>
Date: Wed Mar 1 14:50:29 2017 +0100

    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

Changed in monasca:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to monasca-api (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/444774

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to monasca-api (stable/ocata)

Reviewed: https://review.openstack.org/444774
Committed: https://git.openstack.org/cgit/openstack/monasca-api/commit/?id=4f4927cd85b657ddffa0221e537d84ef5a3d2195
Submitter: Jenkins
Branch: stable/ocata

commit 4f4927cd85b657ddffa0221e537d84ef5a3d2195
Author: Kamil Choroba <email address hidden>
Date: Wed Mar 1 14:50:29 2017 +0100

    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
    (cherry picked from commit dcd65110df04a84eb5bf2be0c447b98dca2179ef)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/monasca-api 1.6.1

This issue was fixed in the openstack/monasca-api 1.6.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/monasca-api 2.0.0

This issue was fixed in the openstack/monasca-api 2.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.