简体   繁体   English

如何从在 GKE 上运行的 Java 应用程序获取 GCP 错误报告(谷歌 kubernetes 引擎)

[英]How get GCP Error Reporting from Java App running on GKE ( google kubernetes engine )

in case of Java App Engine, if exception occur from Java App, i can get GCP Error reporting automatically like this在 Java App Engine 的情况下,如果 Java App 发生异常,我可以像这样自动获得 GCP 错误报告

But in case of Java App on GKE, i can't get GCP Error Reporting但是对于 GKE 上的 Java App,我无法获得 GCP 错误报告

How does it can?怎么可以?

you should install Stackdriver Kubernetes Monitoring to GKE;您应该将Stackdriver Kubernetes Monitoring安装到 GKE; while one can also use it together with Prometheus .同时也可以与Prometheus一起使用。 theses features are currently still in beta stage (not being covered by any SLA).这些功能目前仍处于测试阶段(未被任何 SLA 覆盖)。 also see the Fluentd data collector, which is rather relevant to the Logging API .另请参阅Fluentd数据收集器,它与Logging API相当相关。 this visual diagram might explain the most reliable who reports to whom:这个可视化图表可以解释谁向谁报告最可靠:

K8架构

this one SLF4J example shows how log from within a Java environment, there there's relevant documentation for Logging Application Events with Java (what you might be actually looking for).这个SLF4J 示例展示了如何从 Java 环境中进行日志记录,有使用 Java 记录应用程序事件的相关文档(您可能正在寻找的内容)。 in principle, the logger within the Java environment needs to tell the local agent, what is going on.原则上,Java 环境中的记录器需要告诉本地代理,发生了什么。

concerning the Logging API in Kubernetes, see Logging Using Stackdriver and Customizing Stackdriver Logs for Kubernetes Engine with Fluentd ;关于 Kubernetes 中的Logging API ,请参阅使用Stackdriver 进行日志记录使用 Fluentd 为 Kubernetes Engine 自定义 Stackdriver 日志 there is more than one way to do that.有不止一种方法可以做到这一点。

the Monitoring API and the Logging API can be used independently, while they nevertheless observe the same resources and the same timeline, that's why utilizing both makes sense. Monitoring APILogging API可以独立使用,但它们观察相同的资源和相同的时间线,这就是为什么同时使用两者是有意义的。

concerning the access scope required:关于所需的访问范围:

You must be an Owner of the project containing your cluster.您必须是包含集群的项目的所有者。

As mentioned in the doc Stackdriver Error Reporting is automatically enabled for App Engine environment applications.正如文档中提到的,Stackdriver 错误报告会自动为 App Engine 环境应用程序启用。 However on GKE, you must add the cloud-platform access scope when creating the cluster.但是在 GKE 上,您必须在创建集群时添加云平台访问范围。 The preferred way to collect the error is to able to post to Stackdriver Error Reporting using the REST API or Error Reporting Client Libraries收集错误的首选方法是能够使用REST API错误报告客户端库发布到 Stackdriver 错误报告

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

相关问题 基于 Java 的 Google App Engine 报告 - Reporting for Java base Google App Engine Google Container Engine(GKE-Kubernetes)上的Redis集群 - Redis cluster on Google Container Engine (GKE - Kubernetes) 带有Java的Google App Engine-运行javac.exe编译器时出错 - Google App Engine with Java - Error running javac.exe compiler Google App Engine的报告框架 - Reporting framework for Google App Engine 如何从谷歌应用程序引擎为java调用谷歌应用程序脚本 - how to call a google app script from google app engine for java 运行google-app-engine演示时出错 - Error running google-app-engine demo 在Google App Engine Flex上运行时,使用Java将文件从Google存储桶移动到Google云端硬盘 - Move file from Google Storage Bucket to Google Drive using Java while running on the Google App Engine Flex 如何在Eclipse for Google App Engine中从Java 7切换到Java 6? - How to switch from Java 7 to Java 6 in Eclipse for Google App Engine? 如何使用Java JSP从Routing-URL Google App Engine获取参数 - How to get parameter from routing-url Google App Engine using Java JSP 如何在 Java 11 Google App Engine 中获取当前应用程序版本? - How to get the current application version in Java 11 Google App Engine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM