implement an agent in go to export metrics from the API directly
Opened this issue · 4 comments
similar to parfait-agent
I'm guessing this need cgo
bindings to libpcp_pmda
so we can build a daemon PMDA in Go?
No, actually parfait-agent (in the java project) is a standalone Java application that on launch with an application automatically starts exporting important stuff about the application. @natoscott would have more knowledge since he maintains the project. From what I remember correctly it makes use of the JVM instrumentation API and the premain
functionality. https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html
@suyash @saurvs there's two modes of operation for the Java parfait-agent:
- Running as a -javaagent jar (i.e. running directly inside the instrumented application)
- "Proxy" mode, where parfait-agent runs as a separate process to the instrumented application, and communicates to the application using JMX protocol.
Both modes use parfait-core, and parfait/dxm to generate MMV format. It is all pure Java code - no native bindings or anything like that.
@natoscott Thanks for the clarification.
There is apparently no equivalent of -javaagent
for Go, so we can't profile an unmodified Go binary. We could instead implement a PCPInstanceMetric
like I mentioned in #42, which updates runtime metrics periodically, and which the user can start or stop anywhere in their code.
There's also https://github.com/davecheney/gmx, which is similar to Java's jmx. When it's imported into a Go program, the package automatically opens a UNIX socket that we can query for runtime metrics from a different process and write them to an MMV file.