Go: Add opt-in CPU metric, and detailed opt-in attributes#3627
Open
dashpole wants to merge 1 commit intoopen-telemetry:mainfrom
Open
Go: Add opt-in CPU metric, and detailed opt-in attributes#3627dashpole wants to merge 1 commit intoopen-telemetry:mainfrom
dashpole wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
7abb803 to
92f13d6
Compare
92f13d6 to
d04c7e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3354
Related to open-telemetry/opentelemetry-go-contrib#6321
Also includes a request from golang/go#67120 (comment) for detailed CPU metrics.
Changes
All additions are all opt-in:
go.cpu.time, which hasgo.cpu.stateandgo.cpu.detailed_state.go.memory.detailed_typetogo.memory.usage.My goals with this are:
The approach i've taken is to use two attributes:
go.cpu.stateorgo.memory.type, which has a set of stable, well-defined constants that are useful to most users and highly unlikely to change. E.g. "stack" for memory, or "gc" for CPU.go.cpu.detailed_stateandgo.memory.detailed_type, which will provide all of the categories offered by the go runtime for each version: https://pkg.go.dev/runtime/metrics#hdr-Supported_metrics based on a prefix (cpu/classes/* and memory/classes/* respectively).Enabling the opt-in attribute increases cardinality, since multiple detailed types/states can apply to each of the high-level types/states.
Alternatives Considered
We could instead have separate metrics for detailed and basic attributes. This is more expensive without much benefit.
We could instead change the values reported to the detailed ones based on user configuration. This would break existing usage of the high-level attributes when a user enables the detailed ones.
Merge requirement checklist
[chore]Gemini helped me copy descriptions over from the runtime metrics documentation.
@open-telemetry/go-approvers @jmacd