使用Cloud ML Engine的Stackdriver记录请求/响应

时间:2018-05-24 19:52:47

标签: google-cloud-platform google-cloud-ml google-cloud-stackdriver

我通过针对部署在云MLEngine中的模型的API调用运行预测功能,并且我已启用日志记录,以便我可以在Stackdriver Logging中查看日志。

当我转到日志时,我看到生成的日志是这样的

{
 httpRequest: {
  latency:  "0.002585s"   
  remoteIp:  "X.X.X.X"   
  requestMethod:  "POST"   
  requestSize:  "259"   
  requestUrl:  "ml.googleapis.com/v1/projects/<project-id>/models/pricing_model/versions/v1:predict"   
  responseSize:  "56"   
  status:  200   
  userAgent:  "google-cloud-sdk gcloud/202.0.0 command/gcloud.beta.ml-engine.predict invocation-id/XXXXXXXXX environment/None environment-version/None interactive/True from-script/False python/2.7.14 (Macintosh; Intel Mac OS X 16.7.0),gzip(gfe)"   
 }
 insertId:  "qd41"  
 jsonPayload: {
  @type:  "type.googleapis.com/google.cloud.ml.v1.PredictionLogEntry"   
  modelLatency:  "0.000507s"   
  numInstances:  "1"   
  requestType:  "LOADED"   
 }
 logName:  "projects/<project-id>/logs/ml.googleapis.com"  
 receiveTimestamp:  "2018-05-23T20:51:42.980326893Z"  
 resource: {
  labels: {…}   
  type:  "cloudml_model_version"   
 }
 severity:  "INFO"  
 timestamp:  "2018-05-23T20:51:42Z"  
}

这不包括请求和响应。有没有办法可以添加该参数,这样每当我运行预测ML Engine中的模型时,我还可以看到请求和响应?

我希望在日志中看到另外两个字段

request:[1068,34,45,89,3245,543543]
prediction(or Response):[34354.43]

0 个答案:

没有答案