Final "/" when requesting meters: unexpected behaviour

Bug #1202744 reported by Frédéric FAURE
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Undecided
Ildiko Vancsa

Bug Description

When addind final "/" on most of URLs I get 404, which seems standard, but in contradiction with doc: see https://bugs.launchpad.net/ceilometer/+bug/1202739

But when trying on /meters/, I get a result, but different (a bigger list of results) from the one when I tried /meters (without "/").

I was logged as "admin".

Revision history for this message
gordon chung (chungg) wrote :

this seems odd, v2/meters and v2/meters/ both go through the same code path so i don't see how they could generate different sets. is it possible that in the time between both generations, additional meters were triggered?

Changed in ceilometer:
status: New → Incomplete
Revision history for this message
Frédéric FAURE (frederic-faure) wrote : Re: [Bug 1202744] Re: Final "/" when requesting meters: unexpected behaviour

I tried /meters, then /meters/, then /meters and /meters/ again... The
result was idempotent each time for a given test. It seems odd but that s
the way it acts.
If you can't reproduce, I will redo my test on Monday and capture the (very
big) results! :-)
The expected result was a 404 for /meters/ as the other URLs in the API
when adding a final "/", but having a result and moreover different was
very surprising, so maybe there is another bug under the hood.
Le 19 juil. 2013 21:10, "gordon chung" <email address hidden> a écrit :

> this seems odd, v2/meters and v2/meters/ both go through the same code
> path so i don't see how they could generate different sets. is it
> possible that in the time between both generations, additional meters
> were triggered?
>
> ** Changed in: ceilometer
> Status: New => Incomplete
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1202744
>
> Title:
> Final "/" when requesting meters: unexpected behaviour
>
> Status in Ceilometer:
> Incomplete
>
> Bug description:
> When addind final "/" on most of URLs I get 404, which seems standard,
> but in contradiction with doc: see
> https://bugs.launchpad.net/ceilometer/+bug/1202739
>
> But when trying on /meters/, I get a result, but different (a bigger
> list of results) from the one when I tried /meters (without "/").
>
> I was logged as "admin".
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ceilometer/+bug/1202744/+subscriptions
>

Revision history for this message
Frédéric FAURE (frederic-faure) wrote :
Download full text (10.3 KiB)

curl -X 'GET' -H "X-Auth-Token: $token" -H 'Content-Type: application/json' http://localhost:8777/v2/meters > meters.log

[
    {
        "user_id": null,
        "name": "storage.objects.containers",
        "resource_id": "776a9d54aad14287ae4fc0de4d302add",
        "project_id": "776a9d54aad14287ae4fc0de4d302add",
        "type": "gauge",
        "unit": "container"
    },
    {
        "user_id": null,
        "name": "storage.objects",
        "resource_id": "776a9d54aad14287ae4fc0de4d302add",
        "project_id": "776a9d54aad14287ae4fc0de4d302add",
        "type": "gauge",
        "unit": "object"
    },
    {
        "user_id": null,
        "name": "storage.objects.size",
        "resource_id": "776a9d54aad14287ae4fc0de4d302add",
        "project_id": "776a9d54aad14287ae4fc0de4d302add",
        "type": "gauge",
        "unit": "B"
    },
    {
        "user_id": null,
        "name": "image",
        "resource_id": "962266bd-6520-4c60-b7d7-3c9566f2a707",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "gauge",
        "unit": "image"
    },
    {
        "user_id": null,
        "name": "image.size",
        "resource_id": "962266bd-6520-4c60-b7d7-3c9566f2a707",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "gauge",
        "unit": "B"
    },
    {
        "user_id": null,
        "name": "image.update",
        "resource_id": "962266bd-6520-4c60-b7d7-3c9566f2a707",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "delta",
        "unit": "image"
    },
    {
        "user_id": null,
        "name": "image.upload",
        "resource_id": "962266bd-6520-4c60-b7d7-3c9566f2a707",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "delta",
        "unit": "image"
    },
    {
        "user_id": null,
        "name": "image.download",
        "resource_id": "962266bd-6520-4c60-b7d7-3c9566f2a707",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "delta",
        "unit": "B"
    },
    {
        "user_id": null,
        "name": "image.serve",
        "resource_id": "962266bd-6520-4c60-b7d7-3c9566f2a707",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "delta",
        "unit": "B"
    },
    {
        "user_id": null,
        "name": "image",
        "resource_id": "2fb30d75-63b0-47c9-9d39-4ccb1c301a05",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "gauge",
        "unit": "image"
    },
    {
        "user_id": null,
        "name": "image.upload",
        "resource_id": "2fb30d75-63b0-47c9-9d39-4ccb1c301a05",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "delta",
        "unit": "image"
    },
    {
        "user_id": null,
        "name": "image.size",
        "resource_id": "2fb30d75-63b0-47c9-9d39-4ccb1c301a05",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "gauge",
        "unit": "B"
    },
    {
        "user_id": null,
        "name": "image.update",
        "resource_id": "2fb30d75-63b0-47c9-9d39-4ccb1c301a05",
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "type": "delta",
      ...

Revision history for this message
Frédéric FAURE (frederic-faure) wrote :
Download full text (71.7 KiB)

curl -X 'GET' -H "X-Auth-Token: $token" -H 'Content-Type: application/json' http://localhost:8777/v2/meters/ > meters_with_slash.log

[
    {
        "counter_name": "image.size",
        "user_id": null,
        "resource_id": "c5c93bee-21ec-455f-a7db-6dfc7a4c8eab",
        "timestamp": "2013-07-22T08:22:43",
        "resource_metadata": {
            "status": "active",
            "name": "cirros-0.3.1-x86_64-uec",
            "deleted": "False",
            "container_format": "ami",
            "created_at": "2013-07-22T08:03:13",
            "disk_format": "ami",
            "updated_at": "2013-07-22T08:03:15",
            "protected": "False",
            "checksum": "f8a2eeee2dc65b3d9b6e63678955bd83",
            "min_disk": "0",
            "is_public": "True",
            "deleted_at": "None",
            "min_ram": "0",
            "size": "25165824"
        },
        "source": "openstack",
        "counter_unit": "B",
        "counter_volume": 25165824,
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "message_id": "e1769b10-f2a7-11e2-b2ab-080027880ca6",
        "counter_type": "gauge"
    },
    {
        "counter_name": "image.size",
        "user_id": null,
        "resource_id": "2fb30d75-63b0-47c9-9d39-4ccb1c301a05",
        "timestamp": "2013-07-22T08:22:43",
        "resource_metadata": {
            "status": "active",
            "name": "cirros-0.3.1-x86_64-uec-ramdisk",
            "deleted": "False",
            "container_format": "ari",
            "created_at": "2013-07-22T08:03:12",
            "disk_format": "ari",
            "updated_at": "2013-07-22T08:03:13",
            "protected": "False",
            "checksum": "69c33642f44ca552ba4bb8b66ad97e85",
            "min_disk": "0",
            "is_public": "True",
            "deleted_at": "None",
            "min_ram": "0",
            "size": "3714968"
        },
        "source": "openstack",
        "counter_unit": "B",
        "counter_volume": 3714968,
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "message_id": "e176a0d8-f2a7-11e2-b2ab-080027880ca6",
        "counter_type": "gauge"
    },
    {
        "counter_name": "image.size",
        "user_id": null,
        "resource_id": "962266bd-6520-4c60-b7d7-3c9566f2a707",
        "timestamp": "2013-07-22T08:22:43",
        "resource_metadata": {
            "status": "active",
            "name": "cirros-0.3.1-x86_64-uec-kernel",
            "deleted": "False",
            "container_format": "aki",
            "created_at": "2013-07-22T08:03:07",
            "disk_format": "aki",
            "updated_at": "2013-07-22T08:03:12",
            "protected": "False",
            "checksum": "c352f4e7121c6eae958bc1570324f17e",
            "min_disk": "0",
            "is_public": "True",
            "deleted_at": "None",
            "min_ram": "0",
            "size": "4955792"
        },
        "source": "openstack",
        "counter_unit": "B",
        "counter_volume": 4955792,
        "project_id": "a794e2758b4b46bd88dfa1a66c660da8",
        "message_id": "e176a934-f2a7-11e2-b2ab-080027880ca6",
        "counter_type": "gauge"
    },
    {
        "counter_name": "image",
  ...

Revision history for this message
Frédéric FAURE (frederic-faure) wrote :

With a final "/", I get a Sample format.

Revision history for this message
gordon chung (chungg) wrote :

thanks very much Frédéric, i think i can recreate it now.

Changed in ceilometer:
assignee: nobody → gordon chung (chungg)
status: Incomplete → Confirmed
Revision history for this message
gordon chung (chungg) wrote :

this looks like it should be fixed in WSME package... either how it generates docs or in the code.

Revision history for this message
Frédéric FAURE (frederic-faure) wrote :

What is strange is that occurs only with meters/, not with resources/ for example. I wonder why this could come from the WSME package (looks more like a special case) => the fix you commited for the bug https://bugs.launchpad.net/ceilometer/+bug/1202739 (thx by the way) looked more like a general behaviour and that was the case. But I probably missed something! :o)

I have just tried with another user than "admin": I was logged as "demo" in this case. I got the same.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :
gordon chung (chungg)
Changed in ceilometer:
assignee: gordon chung (chungg) → Ildiko Vancsa (ildiko-vancsa)
Revision history for this message
Ryan Petrello (ryan-petrello) wrote :

It seems to me that the behavior described here is actually a bug in Pecan:

https://review.openstack.org/#/c/73429/

Revision history for this message
Ildiko Vancsa (ildiko-vancsa) wrote :

Hi,

Thanks for this patch. We tried it and it works fine. When will this fix be released?

I think that it still would be better to remove the trailing slash from the end of the URLs in the doc (fix for this is here: https://github.com/dreamhost/sphinxcontrib-pecanwsme/pull/12 ). The related part of the RFC standard (http://tools.ietf.org/html/rfc3986 ) says in chapter 3.3 that "the path is terminated by the first question mark ("?") or number sign ("#") character, or by the end of the URI.", which means that the trailing slash is not a valid ending, it means that the request should go to another controller, so in my opinion it would be nicer, if the trailing slash would be removed from the doc.

Best Regards,
Ildiko

Changed in ceilometer:
status: Confirmed → In Progress
Revision history for this message
Ildiko Vancsa (ildiko-vancsa) wrote :
Changed in ceilometer:
status: In Progress → Fix Released
Revision history for this message
Ildiko Vancsa (ildiko-vancsa) wrote :

pecan release number: 0.4.5
sphinxcontrib-pecanwsme release number: 0.7

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.