Troubleshooting the Monitoring API

[time-intervals}: /monitoring/custom-metrics/reading-metrics#time_intervals

This guide explains some of the issues that might arise when you use the Monitoring API v3.

API Explorer

If you are having trouble with an API call, use the API Explorer (Try this API) widget on the reference page for that API call to debug your problem. See API Explorer for more information.

General API errors

Here are some of the errors you may see from your API calls:

  • 404. The requested URL was not found on this server. Some part of the URL is incorrect. Compare the URL against the expected values for the API methods. Check for spelling errors ("project" instead of "projects") and capitalization problems ("TimeSeries" instead of "timeSeries").

  • User is not authorized to access the project (or metric). This might be an authorization problem, but it can also mean that you simply misspelled a project ID or metric type name. Check your spelling and capitalization.

    If you are not using the APIs Explorer, then try using it. If your API call works in the Explorer, then you probably do have an authorization issue in the environment you're using for your API call. Check in the API manager page to verify that the Monitoring API v3 is enabled for your project.

  • Field filter had an invalid value: Check the spelling and formatting of your monitoring filter. For more information, see Monitoring Filters.

  • Request was missing field interval.endTime: You also see this message if the end time is present but is not properly formatted. If you are using the APIs Explorer, do not quote the value of the time field. Here are some examples of correct time specifications:

    2016-05-11T01:23:45Z
    2016-05-11T01:23:45.678Z
    2016-05-11T01:23:45.678+05:00
    2016-05-11T01:23:45.678-04:30
    

Missing results

If your API call returns status code 200 and an empty response, there are several possibilities:

  • If your call uses a filter, then the filter might not have matched anything. The filter match is case-sensitive. To resolve filter problems, start by specifying only one filter component, such as metric.type, and see if you get results. Add the other filter components one-by-one.

  • If you are working with a custom metric, you might not have specified the project where your custom metric is defined.

If you are fetching time series data and some of the data points seem to be missing, then check the following additional causes:

  • If the data is more than a few weeks old, it might have expired. See the Quota Policy for more information on data retention.

  • If the data was just written, it might not yet be in Monitoring. For more information, see Latency of metric data.

  • Check that you specified the time interval correctly:

    • Check that the end time is correct.
    • Check that the start time is correct, and earlier than the end time. If the start time is missing or malformed, it defaults to the end-time value, and the time interval will match only points whose start and end times are exactly the interval's end time. (This is valid for GAUGE metrics, which measure a point in time, but not for CUMULATIVE or DELTA metrics, which measure across time intervals. For more information, see [Time Intervals][time-intervals].
Was this page helpful? Let us know how we did:

Send feedback about...

Stackdriver Monitoring