doujie3888 2018-06-21 11:46
浏览 240

如何在Go中将自定义跨度添加到Trace中

My app runs on App Engine Standard and the Go runtime. I have this trace for my recent request:

Trace of my request in Stackdriver Trace

There is a big gap between the "urlfetch" span and the "datastore_v3" span, because my app processes some CPU-bound computation for ~1000ms.

I would love to programmatically add my computation as a custom span into the Trace view, and get something like this:

enter image description here

Is there a way to do this in my app written in go? (source here)

  • 写回答

2条回答 默认 最新

  • doubiaokai4998 2018-06-21 12:09
    关注

    It appears it might be possible. From Setting Up Stackdriver Trace for Go:

    Alpha

    This is an alpha release of the OpenCensus package for Go. These libraries might be changed in backward-incompatible ways and are not recommended for production use. They are not subject to any SLA or deprecation policy.

    Stackdriver Trace can be used by Go applications using the OpenCensus package for Go.

    Stackdriver Trace's Go support is provided by OpenCensus, a set of tracing and application metrics instrumentation libraries that work with multiple backends. The latest details about OpenCensus for Go, along with additional documentation and examples, can be found on its GitHub page.

    Support is enabled by default in the flexible environment, however the docs make no mention about the standard environment (if that's your case I'd say just give it a try). From App Engine:

    On Google App Engine flexible environment, the Stackdriver Trace API access scope is enabled by default, and the OpenCensus client library can be used without needing to provide credentials or a project ID.

    An application code sample is provided on the same page.

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?