简体   繁体   English

在 python 中使用堆栈驱动程序记录器的资源类型?

[英]Resource type for using stackdriver logger in python?

I'm currently using stackdriver for cloud logging my python code.我目前正在使用 stackdriver 来记录我的 python 代码。 I am trying to setup notifications which requires me to specify a resource type but I can't find which resource type I am using?我正在尝试设置需要我指定资源类型的通知,但我找不到我正在使用的资源类型?

You can start by going to the resources menu on the left panel of the Stackdriver interface, and click on Metrics Explorer.您可以先转到 Stackdriver 界面左侧面板上的资源菜单,然后单击 Metrics Explorer。 Once you are in metrics explorer you can start by typing Global, and then scroll up until you see global.进入指标资源管理器后,您可以首先键入 Global,然后向上滚动直到看到 global。 From there click on Global under Resource types.从那里单击资源类型下的全局。 This will narrow down the metrics for you to search.这将缩小您要搜索的指标。 Once you find the resource you are trying to monitor, you can then note it and create an alert for it.找到您要监控的资源后,您可以记下它并为其创建警报。 For more information about Python and Stackdriver check out this link .有关 Python 和 Stackdriver 的更多信息,请查看此链接

The resource type will depend on where your code is running.资源类型将取决于您的代码运行的位置。 For example, if you're running on a VM in GCE, the resource type will be "gce_instance".例如,如果您在 GCE 中的 VM 上运行,则资源类型将为“gce_instance”。 If it's running in a container in GKE, it'll be "k8s_container", and etc. If you're running the code outside of GCP, it may be logged under the "global" resource.如果它在 GKE 的容器中运行,它将是“k8s_container”等。如果您在 GCP 之外运行代码,它可能会记录在“全局”资源下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM