Analytics API issue

I have 2 environments under same org. I am running the following Analytics API call for both envs.

curl -X GET -v -u adminid:pwd 'http://msip:8080/v1/o/orgname/environments/envname/stats/apiproxy,developer_app,virtual_host?select=sum(message_count)&timeRange=12/20/2018%2000:00~12/20/2018%2023:59&timeUnit=hour'

For Org1 I am only getting 10 hours of data(this varies, sometime 11 hours etc but not 24 hours) but for Org2 I am getting 24 hours of data as expected.

If i check the edge ui dashboard for Org1 , i see correct traffic data.

What could be wrong here? How do i debug this issue?

Regards,

Rajeev S

0 3 194
3 REPLIES 3

Hi Rajeev,

The best way to debug this issue would be to reverse engineer the API call that the Edge UI Analytics dashboard makes.

This is pretty simple to do on most major browsers.

For example on Chrome just open More Tools -> Developer Tools. In the panel that opens, select Network and then XHR. Then open up one of the Analytics pages such as "Proxy Performance". The call should show up underneath the XHR panel. Comparing a working call with your curl command should help diagnose any potential mistake in the curl command. If you are still stuck please share the findings with us.

Regards,

Mark

Thanks @Mark Eccles , i checked the API called internally by edge ui and could see there was a parameter "limit=14400" included there. I added that parameter and now I am getting all 24hrs data.

Any idea on this parameter? Does this limit the number of rows read from PGSQL or the number of rows returned by the analytics api?

Also any idea on the default value if we dont pass limit parameter?

Regards,

Rajeev S

Good news you identified the problem.

The default is 1000 and it's a limit on the number of metrics returned by the API.

You are querying over 24h hours with one hour intervals so I am presuming you have a lot of API Proxies in Org1.

Please read through the API specs for full description of all query params:

https://apidocs.apigee.com/management/apis/get/organizations/%7Borg_name%7D/environments/%7Benv_name...