x/telemetry/internal/counter: TestStack fails if test function name is slightly longer #61181
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
telemetry
x/telemetry issues
Milestone
https://github.com/golang/telemetry/blob/2375252a9134bc3b5cb502adb82264656851a7b9/internal/counter/counter_test.go#L363C7-L363C7
This function
f
is currently used to test the stack counter's behavior.If we rename it to something slightly longer, e.g.
recursiveFn
, the test starts to fail due to the truncated counter name.Currently, stack counter names are constructed by concatenating full func loc info in a call stack https://github.com/golang/telemetry/blob/2375252a9134bc3b5cb502adb82264656851a7b9/internal/counter/stackcounter.go#L62 The function loc info is of the form
<package>.<func>:<linenumber>
and the package path itself can be long, and the concatenation can easily exceedmaxNameLen
(=256).It looks like we need more efficient encoding & datastructure for the stack info.
cc @pjweinb @jamalc @rsc
The text was updated successfully, but these errors were encountered: