Skip to content

x/telemetry/internal/counter: TestStack fails if test function name is slightly longer #61181

@hyangah

Description

@hyangah

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 exceed maxNameLen (=256).

It looks like we need more efficient encoding & datastructure for the stack info.

cc @pjweinb @jamalc @rsc

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.telemetryx/telemetry issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions