Skip to content

Commit

Permalink
runtime/metrics definitions for go 1.21 runtime (#537)
Browse files Browse the repository at this point in the history
**Description:** 
Updates for Go 1.21
There are 3 new single gauges, one new class-updowncounter, and a
pattern of non-default-behavior counters from /godebug I think we should
skip.

Part of #257
  • Loading branch information
jmacd authored Oct 27, 2023
1 parent 4a07a0f commit ddcd8f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lightstep/instrumentation/runtime/builtin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func makeTestCaseBuiltin(t *testing.T) (allFunc, readFunc, *builtinDescriptor, t

for goname, realval := range testMap {
mname, munit, descPat, attrs, kind, err := realDesc.findMatch(goname)
if err != nil || mname == "" {
if err != nil || mname == "" || kind == builtinSkip {
continue // e.g., async histogram data, totalized metrics
}
noprefix := mname[len(namePrefix)+1:]
Expand Down
5 changes: 5 additions & 0 deletions lightstep/instrumentation/runtime/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ package runtime

func expectRuntimeMetrics() *builtinDescriptor {
bd := newBuiltinDescriptor()
bd.ignorePattern("/godebug/non-default-behavior/*:events")
bd.classesCounter("/cpu/classes/*:cpu-seconds")
bd.classesCounter("/gc/cycles/*:gc-cycles")
bd.classesUpDownCounter("/memory/classes/*:bytes")
bd.classesUpDownCounter("/gc/scan/*:bytes")
bd.ignoreHistogram("/gc/heap/allocs-by-size:bytes")
bd.ignoreHistogram("/gc/heap/frees-by-size:bytes")
bd.ignoreHistogram("/gc/pauses:seconds")
Expand All @@ -28,7 +30,10 @@ func expectRuntimeMetrics() *builtinDescriptor {
bd.singleCounter("/cgo/go-to-c-calls:calls")
bd.singleCounter("/gc/heap/tiny/allocs:objects")
bd.singleCounter("/sync/mutex/wait/total:seconds")
bd.singleGauge("/gc/gogc:percent")
bd.singleGauge("/gc/gomemlimit:bytes")
bd.singleGauge("/gc/heap/goal:bytes")
bd.singleGauge("/gc/heap/live:bytes")
bd.singleGauge("/gc/limiter/last-enabled:gc-cycle")
bd.singleGauge("/gc/stack/starting-size:bytes")
bd.singleGauge("/sched/gomaxprocs:threads")
Expand Down
4 changes: 4 additions & 0 deletions lightstep/instrumentation/runtime/descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ func (bd *builtinDescriptor) singleGauge(pattern string) {
bd.add(pattern, builtinGauge)
}

func (bd *builtinDescriptor) ignorePattern(pattern string) {
bd.add(pattern, builtinSkip)
}

func (bd *builtinDescriptor) ignoreHistogram(pattern string) {
bd.add(pattern, builtinHistogram)
}
Expand Down

0 comments on commit ddcd8f0

Please sign in to comment.