Troubleshooting

Access

Could not add Timeseries Insights DataSet Owner to the service account

The "Timeseries Insights DataSet Owner" role might not be shown in the UI. You can use the role ID roles/timeseriesinsights.datasetsOwner with the gcloud command to grant the necessary access.

 gcloud projects add-iam-policy-binding "${PROJECT_ID}" \
      --member="serviceAccount:${SVC_ACCOUNT}" \
      --role=roles/timeseriesinsights.datasetsOwner \
      --condition=None

Anomaly Detection

This section lays out some common debugging steps to understand the Timeseries Insights API responses if they are different from your expectations.

Empty slices

When executing a Timeseries Insights query on a loaded dataset, you might receive an empty response.

Example empty response,
{'name': 'projects/demo-project/datasets/demo-dataset',
'slices': []}

Empty slices indicate that there are no data points in the requested time intervals [detectionTime - TimeseriesParams.forecastHistory, detectionTime + TimeseriesParams.granularity].

You can alternatively try to query for an explicit slice that you expect to be present in the dataset by using the evaluateSlice API. This forces the system to return the time series for the given slice and its evaluation status.

ForecastResult.label INSUFFICIENT_DATA

When executing a Timeseries Insights API query or evaluateSlice, you might observe INSUFFICIENT_DATA as the per slice ForecastResultLabel. This means that we don't have enough data to classify the particular slices.

status code: 3. message: Got density = xx. Min density = yy

In the following code example, the user asked Timeseries Insights API to make the classification if 90% of the data points is present in the requested time intervals [detectionTime - TimeseriesParams.forecastHistory, detectionTime]. Timeseries Insights API can't provide a classification, because only 1% of the data points is non-empty in the time series interval.

"status": {
  "code": 3,
  "message": "Got density = 1. Min density = 90"
}

Try to experiment with the following parameters in the request to understand why the data points might not exist.

  • detectionTime and TimeseriesParams

    • Make sure that [detectionTime - TimeseriesParams.forecastHistory, detectionTime + TimeseriesParams.granularity] is a subrange of all the events available in your dataset so that there is enough history for Timeseries Insights API to work with. This might require you to choose a detectionTime that is close to the end of the time series.

    • Timeseries Insights API builds a time series by going back in time from the detectionTime. How much we go back in time and how many points are included in the time series are determined by TimeseriesParams.forecastHistory and TimeseriesParams.granularity,

    • Start with a minDensity = 0.0 if uncertain about the actual density of the events in the dataset. Fine tune the parameter for better precision later.

Also, see Timeseries concepts for parameter definitions.