3

Google Cloud has a powerful tracing tool for analyzing latency of requests and RPCs. But it seems to just pick some requests that it finds deserving of traces. Sometimes that's good enough, you can just browse through existing traces. But if you are working on a performance enhancement, you want the trace on your particular query right now, you don't want to wait until it is deemed interesting.

Questions are

  • What rules intervene in deciding which queries are traced ?

  • Is there a way to ask for traces to be captured for a given URI ?

Either from within developer console, or by calling some API from within our application ? Or through some app.yaml configuration ? Or do we have to just wait and pray for the great algorithm to chose our request ?

4

3 回答 3

4

您可以通过正确设置云跟踪上下文标头来强制跟踪 HTTP 请求:

$ curl -H "X-Cloud-Trace-Context: 01234567890123456789012345678901;o=1" http://<your-app>.appspot.com/<path>

01234567890123456789012345678901(32 个十六进制字符)是跟踪 ID。你想每次都使用不同的。 o=1启用跟踪。

使用以下 URL 查看跟踪(最后一部分是跟踪 id): http ://console.developer.google.com/traces/details/01234567890123456789012345678901

于 2016-02-26T21:56:59.393 回答
1

哪些规则干预决定跟踪哪些查询?

目前有一个采样率来指导跟踪哪个请求。请求以每个实例每秒的少量请求进行采样。

有没有办法要求为给定的 URI 捕获跟踪?

根据您的情况,以下内容可能会有所帮助。

您可以添加一个跟踪上下文来强制请求对请求进行强制跟踪。Trace Context 本质上是一个 HTTP 标头(X-Cloud-Trace-Context)

这是一个帮助注入跟踪上下文的指针:https ://github.com/liqianluo/gcloud-trace-java/blob/master/cloud-trace-sdk-java-core/src/main/java/com/google /cloud/trace/sdk/TraceContext.java

于 2016-02-24T16:21:22.347 回答
1

既然您对特定请求感兴趣,为什么不使用 appstats 呢? https://cloud.google.com/appengine/docs/python/tools/appstats?hl=en您可以提高性能,打开 appstats 并将其部署到不同的版本,并从 appengine_config.py 进行一些控制

我使用云跟踪来进行聚合分析,以了解每个请求的更多细节,我总是使用 appstats,因为它包含更多信息。

于 2016-01-20T03:47:11.997 回答