Open liustanley opened 1 year ago
Please link to the relevant OTel semantic conventions these metrics will be mapped to.
Not sure if this helps @liustanley, but I've been maintaining a module of instrumentation that simply derives from the Go runtime/metrics
source.
https://github.com/lightstep/otel-launcher-go/tree/main/lightstep/instrumentation/runtime
The way this works is a human has to read and interpret the changes in https://pkg.go.dev/runtime/metrics#hdr-Supported_metrics at each new release and decide how these concepts map into OTel concepts. I've been tracking this for two major releases now, with support for the standard toolchain's metrics produced in 1.19, 1.20, and 1.21. When unrecognized metrics appear from the library, a message is logged so the developers know to go looking for updates.
I'd be glad to help get it migrated into this repo. Here's an example where I added go-1.21 support https://github.com/lightstep/otel-launcher-go/pull/537. The new cpu and garbage collection metrics have been invaluable, and I don't think we need to block on OTel semantic conventions, maybe.
Problem Statement
I noticed that there a number of metrics that are missing from the current runtime instrumentation, and I'd like to request for the following runtime metrics to be added:
runtime.NumCPU() runtime.MemStats.Alloc runtime.MemStats.TotalAlloc runtime.MemStats.Sys runtime.MemStats.Mallocs runtime.MemStats.Frees runtime.MemStats.TotalAlloc runtime.MemStats.StackInuse runtime.MemStats.StackSys runtime.MemStats.MSpanInuse runtime.MemStats.MSpanSys runtime.MemStats.MCacheInuse runtime.MemStats.MCacheSys runtime.MemStats.BuckHashSys runtime.MemStats.GCSys runtime.MemStats.OtherSys runtime.MemStats.NextGC runtime.MemStats.LastGC runtime.MemStats.NumForcedGC runtime.MemStats.GCCPUFraction runtime/debug.GCStats.PauseQuantiles
Proposed Solution
I believe most of these metrics can be added easily in this file: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/runtime/runtime.go