Query Log Analytics metrics data using APIs
The Monitor API does not return time-series data for Log Analytics Metrics.
Steps to reproduce.
1. Go to https://docs.microsoft.com/en-us/rest/api/monitor/metrics/list and click "Try it.
2. Enter a resource ID for a Microsoft.OperationalInsights (Log Analytics) that contains a Platform Heartbeat metric.
3. Enter "metricnames" and "Heartbeat", be sure to click "+" after
4. Click Run
The Timeseries collection is empty.
When I run a query like the following through analytics I do see data:
// See the last heartbeat for each computer in the last hour
| where TimeGenerated > ago(1h)
latest_heartbeat = max(TimeGenerated), // time of the most recent heartbeat
OS = strcat(any(OSType),' ',any(OSName)), // OS type and name
Location=any(RemoteIPCountry) // computer location, according to IP address
The API does return a 200 valid response, but the time-series object in the response always seems to be empty regardless of the metric/dimensions requested.
This is not related to the Azure API Management service. Please re-post to the Azure Monitor-Log Analytics forum. Unfortunately we do not have permission to move the feedback.