Is there a straightforward way in Go to get information about the GC and heap sizes in order to expose them to a monitoring dashboard. I had a look at the runtime package but there doesnt seem to be anything that does that there. Ideally this shouldnt require any overhead like running the application in profiling mode, etc, but should be production ready.
You can use the GODEBUG=gctrace=1
to get continuous output, which is documented in the runtime package.
Otherwise, you need to collect information from runtime.MemStats
and debug.GCStats
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With