gtrace:用于检测Go组件的代码生成工具

时间:2024-03-28 07:42:57
【文件属性】:

文件名称:gtrace:用于检测Go组件的代码生成工具

文件大小:31KB

文件格式:ZIP

更新时间:2024-03-28 07:42:57

go golang tracing instrumenting Go

跟踪 命令行工具gtrace生成用于Go组件跟踪(也称为Instrumentation )的样板代码。 用法 作为某个模块的开发者(无论其库或应用程序模块是什么),您应该定义跟踪点(或挂钩),然后代码的用户可以在运行时使用某些函数(也称为Probes )进行初始化。 TL; DR gtrace建议您使用包含与组件相关的所有挂钩的结构(标记为//gtrace:gen ),并在它们周围生成辅助函数,以便您可以合并此类结构并在不检查nil情况下调用这些挂钩。 它还可以生成上下文感知帮助器,以调用与上下文关联的挂钩。 生成代码的示例在。 基本的 假设我们有一个名为lib包和一些lib.Client结构,该包在内部保存net.Conn并在用户调用Client.Do()发出请求之前每次对其进行ping操作。 为了简单起见,我们不讨论拨号,ping或其他任何事情的发生方式。 type Clien


【文件预览】:
gtrace-master
----cmd()
--------gtrace()
----.github()
--------workflows()
----test()
--------test_gtrace_windows.go(634B)
--------test_tags_dup_gtrace.go(5KB)
--------test_shortcut.go(141B)
--------test_test.go(4KB)
--------test.go(682B)
--------test_imports.go(265B)
--------test_gtrace_darwin_arm64.go(639B)
--------internal()
--------test_windows.go(129B)
--------test_linux.go(127B)
--------test_imports_gtrace.go(2KB)
--------test_darwin.go(142B)
--------test_tags_dup.go(259B)
--------test_tags_dup_gtrace_stub.go(3KB)
--------test_gtrace_darwin_amd64.go(639B)
--------test_tags_gtrace.go(5KB)
--------test_tags.go(252B)
--------test_shortcut_gtrace.go(899B)
--------test_darwin_arm64.go(134B)
--------test_darwin_amd64.go(134B)
--------types.go(165B)
--------test_tags_gtrace_stub.go(3KB)
--------test_gtrace_linux.go(632B)
----LICENSE(1KB)
----examples()
--------pinger()
--------buildtags()
----.gitignore(48B)
----Makefile(974B)
----README.md(7KB)
----go.mod(41B)

网友评论