Google Cloud Functions:监视HTTP状态代码 [英] Google Cloud Functions: monitor HTTP status codes

查看:86
本文介绍了Google Cloud Functions:监视HTTP状态代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置Cloud Monitoring以在我的Cloud Function每次以4xx/5xx HTTP状态代码响应时提醒我.请让我知道如何从Cloud Console实施此操作.

解决方案

您可以为此使用Cloud Logging.

  • 转到云日志"页面并过滤日志
  • 然后选择所需的日志部分(在我的屏幕快照中为200 HTTP响应代码),然后单击显示匹配项"

  • 现在,在查询构建器中,您具有选择的匹配条目

您可以通过>更改值(等于400,而不是200).或<,...因此,您可以在

  • 现在创建指标并命名.

  • 最后,单击右侧的3个点,然后选择在此指标上创建警报

  • 从那里开始,按照向导进行操作.命名您的条件,定义您的阈值和通知渠道.我认为这是最简单的部分(但是,如果您需要指导,请告诉我)

I want to setup Cloud Monitoring to alert me each time my Cloud Function responds with 4xx / 5xx HTTP status codes. Please let me know how to implement this from Cloud Console.

解决方案

You can use Cloud Logging for this.

  • Go to the Cloud Logging page and filter your logs
  • Then select the part of the logs that you want (in my screen shot is the 200 HTTP response code), and click on "show matching entries"

  • Now, in the query builder, you have the matching entry that you select

You can change it, the value (400 instead of 200) the equality by > or <,... So, you can see in the documentation how to build a Cloud Logging filter

  • Then go to Action and click on create metrics

  • Now create your metric and name it.

  • Finally, click on the 3 dots on the right and select create an alert on this metric

  • From there, follow the wizard. Name your condition, define your threshold and notification channels. I think it's the easiest part (but if you need guidance, let me know)

这篇关于Google Cloud Functions:监视HTTP状态代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆