Assigned
Status Update
Comments
ba...@google.com <ba...@google.com>
ba...@google.com <ba...@google.com> #2
I have forwarded this request to the engineering team. We will update this issue with any progress updates and a resolution.
Description
To get an error code and message while reading metric data aligned by mean using python that would be appropriate.
When the "name" [1] field of a ListTimeSeriesRequest [2] is not in the correct format.
It is reporting a 500 which is misleading.
Steps to reproduce:
If you have a typo in the “project_name”(The customer used an organization which does not make a difference in the error [1].) in below code [2]:
from google.cloud import monitoring_v3
client = monitoring_v3.MetricServiceClient()
project_name = f"projects/{project_id}"
now = time.time()
seconds = int(now)
nanos = int((now - seconds) * 10**9)
interval = monitoring_v3.TimeInterval(
{
"end_time": {"seconds": seconds, "nanos": nanos},
"start_time": {"seconds": (seconds - 3600), "nanos": nanos},
}
)
aggregation = monitoring_v3.Aggregation(
{
"alignment_period": {"seconds": 1200}, # 20 minutes
"per_series_aligner": monitoring_v3.Aggregation.Aligner.ALIGN_MEAN,
}
)
results = client.list_time_series(
request={
"name": project_name,
"filter": 'metric.type = "
"interval": interval,
"view": monitoring_v3.ListTimeSeriesRequest.TimeSeriesView.FULL,
"aggregation": aggregation,
}
)
for result in results:
print(result)
Error below:
google.api_core.exceptions.InternalServerError: 500 Internal error
encountered. Please retry after a few seconds. If internal errors persist,
contact support at
Reference:
[1]
[2]