我拼命想用Sentry监控python 3.9谷歌云功能异常,但无法使其正常工作。即使使用下面显示的微小功能,Sentry也不会包含异常。我已经三次检查DSN了。
# main.py
import sentry_sdk
from sentry_sdk.integrations.gcp import GcpIntegration
sentry_sdk.init(
dsn="https://***@***.ingest.sentry.io/***",
integrations=[GcpIntegration()]
)
def main(request):
return 1 / 0
# requirements.txt
sentry-sdk==1.9.10
# deploy.sh
gcloud functions deploy test_gcf_sentry
--trigger-http
--runtime=python39
--entry-point=main
--memory=1GB
--security-level=secure-always
--region=europe-west1
有人设法从这种云功能中吸收Sentry中的错误吗?
GcpIntegration目前仅适用于Python 3.7-请在此处查看代码参考。
如果您使用serverless_function
装饰器:,您可以使其工作
import sentry_sdk
from sentry_sdk.integrations.serverless import serverless_function
sentry_sdk.init(
dsn="https://***@***.ingest.sentry.io/***",
)
@serverless_function
def main(request):
return 1 / 0