[PDB-1391] Inconsistent behaviour of the distinct_resources request parameter Created: 2015/04/03  Updated: 2015/07/10  Resolved: 2015/04/29

Status: Closed
Project: PuppetDB
Component/s: None
Affects Version/s: None
Fix Version/s: PDB 3.0.0

Type: Bug Priority: Normal
Reporter: Michal Ruzicka Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Story Points: 3
Sprint: PuppetDB 2015-05-06

 Description   

Error messages returned by PuppetDB are not conclusive/consistent enough about the use of the distinct_resources request parameter. See the following example queries (which only differ in the distinct_resources parameter) and the corresponding responses returned by PuppetDB:

  • distinct_resources query parameter not specified

    curl -i -gG http://localhost:8080/v4/aggregate-event-counts --data-urlencode 'distinct_start_time=2015-04-02T21:48:24Z' --data-urlencode 'distinct_end_time=2015-04-03T21:48:24Z' --data-urlencode 'query=["<","report_receive_time","2015-04-03T21:48:24Z"]' --data-urlencode 'summarize_by=containing_class' 
    HTTP/1.1 500 'distinct_resources' query parameter requires accompanying parameters 'distinct_start_time' and 'distinct_end_time'
    Date: Fri, 03 Apr 2015 23:01:32 GMT
    Cache-Control: must-revalidate,no-cache,no-store
    Content-Type: text/html; charset=ISO-8859-1
    Content-Length: 409
    Connection: close
    Server: Jetty(9.2.10.v20150310)
     
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
    <title>Error 500 </title>
    </head>
    <body>
    <h2>HTTP ERROR: 500</h2>
    <p>Problem accessing /v4/aggregate-event-counts. Reason:
    <pre>    'distinct_resources' query parameter requires accompanying parameters 'distinct_start_time' and 'distinct_end_time'</pre></p>
    <hr /><i><small>Powered by Jetty://</small></i>
    </body>
    </html>
    

  • distinct_resources=false

    curl -i -gG http://localhost:8080/v4/aggregate-event-counts --data-urlencode 'distinct_start_time=2015-04-02T21:48:24Z' --data-urlencode 'distinct_end_time=2015-04-03T21:48:24Z' --data-urlencode 'query=["<","report_receive_time","2015-04-03T21:48:24Z"]' --data-urlencode 'summarize_by=containing_class' --data-urlencode 'distinct_resources=false'
    HTTP/1.1 200 OK
    Date: Fri, 03 Apr 2015 23:02:08 GMT
    Content-Type: application/json; charset=utf-8
    Content-Length: 84
    Server: Jetty(9.2.10.v20150310)
     
    {
      "successes" : 1,
      "failures" : 5,
      "noops" : 1,
      "skips" : 2,
      "total" : 6
    }
    

  • distinct_resources=true

    curl -i -gG http://localhost:8080/v4/aggregate-event-counts --data-urlencode 'distinct_start_time=2015-04-02T21:48:24Z' --data-urlencode 'distinct_end_time=2015-04-03T21:48:24Z' --data-urlencode 'query=["<","report_receive_time","2015-04-03T21:48:24Z"]' --data-urlencode 'summarize_by=containing_class' --data-urlencode 'distinct_resources=true'
    HTTP/1.1 400 Bad Request
    Date: Fri, 03 Apr 2015 23:02:30 GMT
    Content-Length: 76
    Server: Jetty(9.2.10.v20150310)
     
    < operator does not support object 'report_receive_time' for resource event
    

Note that the last example is reported separately as PDB-1390


Generated at Sun Jun 16 16:44:17 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.