从 GKE 上运行的 Rails 应用收集错误需要哪些步骤?
我已将 stackdriver gem 添加到我的 Rails 应用程序中,并创建了具有errorreporting.errorEvents.create
权限的自定义角色。该角色分配给Compute Engine 默认服务帐号
我解释说在 GKE 上运行时不必进行以下设置的文档:
# Add this to config/environments/*.rb
Rails.application.configure do |config|
# Stackdriver Error Reporting specific parameters
config.google_cloud.error_reporting.project_id = "YOUR-PROJECT-ID"
config.google_cloud.error_reporting.keyfile = "/path/to/service-account.json"
end
我手动创建了一个异常
这给了我宝贵的信息:
irb(main):001:0> Google::Cloud::ErrorReporting.report Exception.new(msg: "from console")
=> nil
irb(main):002:0> {:msg=>"from console"} (Exception)
Google::Cloud::PermissionDeniedError: 7:Stackdriver Error Reporting API has not been used in project NNNNN before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/clouderrorreporting.googleapis.com/overview?project=NNNN then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
启用 API 后,我收到此错误:
irb(main):004:0> {:msg=>"from console"} (Exception)
Google::Cloud::PermissionDeniedError: 7:User not authorized.
那么,我必须向哪个用户授予哪些权限才能完成这项工作?:-|