Reputation: 121
Im on Google App Engine, I try to call the a specific method of the Monitoring API via Google API Client. When I call the timeSeries.list
with interval.startTime
then the error is SyntaxError: keyword can't be an expression
. When I replace interval.startTime
and interval.EndTime
with interval=intervalobj
the error is:
File "/base/data/home/apps/e~bwm2-bgi/scaler:
scaling-readmon.412218217025616715/lib/googleapiclient/discovery.py",
line 716, in method raise TypeError
('Got an unexpected keyword argument "%s"' % name)
TypeError: Got an unexpected keyword argument "interval"
I used the Compute API in the same manner like interval=intervalobl
and it worked. Any tip is appreciated.
CODE:
import webapp2
import logging
from google.appengine.ext import vendor
vendor.add('lib')
from google.appengine.api import app_identity
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
monitoring = discovery.build('monitoring','v3', credentials=GoogleCredentials.get_application_default())
class Scaler(webapp2.RequestHandler):
def post(self):
'''
req = monitoring.projects().metricDescriptors().list(name='projects/PROJ')
res = req.execute()
logging.info(res)
'''
intervalobj = {
'startTime': '2018-08-10T11:01:23.045123456Z',
'endTime': '2018-08-10T11:01:23.045123456Z'
}
res = monitoring.projects().timeSeries().list(
name = 'projects/bwm2-bgi',
filter = 'metric.type="appengine.googleapis.com/http/server/response_style_count"',
interval.startTime = '2018-08-10T11:01:23.045123456Z',
interval.endTime = '2018-08-28T11:01:23.045123456Z').execute()
logging.info(res)
app = webapp2.WSGIApplication([
('/scaler', Scaler)
], debug=True)
Upvotes: 3
Views: 251
Reputation: 21
Using interval_startTime
and interval_endTime
worked in place of the interval.startTime
and interval.endTime
for me.
request = monitor.projects().timeSeries().list(name=project_name,
interval_startTime='2019-03-19T06:00:00.045123456Z',
interval_endTime='2019-03-19T07:00:00.045123456Z',
filter='metric.type="appengine.googleapis.com/http/server/response_style_count"')
I believe setting a point interval with interval.endTime is used when specifying points with the monitoring_v3.MetricServiceClient TimeSeries but not with the discovery resource.
Upvotes: 2