【问题标题】:Does Google stackdriver error report API support gevent?Google Stackdriver 错误报告 API 是否支持 gevent?
【发布时间】:2019-09-09 16:38:54
【问题描述】:

我正在尝试 GCP 的错误报告 API。

代码挂起并给出 503 Deadline Exceeded 错误。如果删除了“monkey.patch_all()”,则该代码有效。 API 是否支持 gevent?


import gevent
from gevent import monkey
monkey.patch_all()

from google.cloud import error_reporting

client = error_reporting.Client.from_service_account_json(
                'configs/trading-xxxxx.json',service='test2')
print("Start")
client.report('test2313')
print("End")

google.api_core.exceptions.ServiceUnavailable:超过 503 截止日期

【问题讨论】:

    标签: google-cloud-platform google-compute-engine google-cloud-stackdriver


    【解决方案1】:

    我从 Github 得到了答案。 添加以下代码:

    import grpc._cython.cygrpc
    grpc._cython.cygrpc.init_grpc_gevent()
    

    更多细节在这里: https://github.com/googleapis/google-cloud-python/issues/9192

    【讨论】:

      【解决方案2】:

      我相信为了在 Stackdriver 上配置 Gevent,您需要在您的应用程序 requirements.txt 中声明它。这篇关于如何安装 Gunicorn 的文章提到了它 [1]。

      [1]https://cloud.google.com/appengine/docs/flexible/python/runtime#recommended_gunicorn_configuration

      【讨论】:

      • 谢谢。我正在本地进行测试,并计划将其部署在 Google Compute Engine 上。所以我认为关于应用引擎设置的文档是不相关的。另外,依赖都在requirements.txt中。
      猜你喜欢
      • 2018-02-07
      • 1970-01-01
      • 1970-01-01
      • 2018-09-11
      • 1970-01-01
      • 2018-02-27
      • 2017-09-13
      • 1970-01-01
      • 2019-01-07
      相关资源
      最近更新 更多