V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
yujianwjj
V2EX  ›  Go 编程语言

go 有像 Java agent 这种的技术吗?

  •  
  •   yujianwjj · 2023-04-07 13:59:11 +08:00 · 2382 次点击
    这是一个创建于 386 天前的主题,其中的信息可能已经有所发展或是发生改变。

    java agent 可以在不修改源代码的情况下,来对程序做 instrument 。这个在实际中有很多应用,比如搞个 java agent 做可观测性相关的工作。

    请教一下,go 有这种类似的方案和技术吗?

    4 条回复    2023-04-07 15:51:18 +08:00
    monsterxx03
        1
    monsterxx03  
       2023-04-07 14:06:53 +08:00
    做过个类似的东西 https://github.com/monsterxx03/gospy

    不过只能读 runtime 信息,不能动态注入指令, 用处是不很大,但挺好玩的, 具体原理可以看 https://blog.monsterxx03.com/2019/09/20/gospy-non-invasive-goroutine-inspector/
    yanmu6626
        2
    yanmu6626  
       2023-04-07 14:12:58 +08:00
    涉及到 native 层,大多用钩子
    cookgo
        3
    cookgo  
       2023-04-07 15:44:45 +08:00
    ixiaohei
        4
    ixiaohei  
       2023-04-07 15:51:18 +08:00
    现在潮流往 opentelemetry 走,统一的 instrument ,各种中间件厂商自己接入,对于支持 instrument 的组件,应用集成 sdk 就会可以 export 的了; golang 真心不建议走 java 以前玩 APM 的老路,而且 opentelemetry 就是 CNCF 顶级项目
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2825 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:59 · PVG 22:59 · LAX 07:59 · JFK 10:59
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.