Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hyangah opened this issue Jul 5, 2023 · 3 comments
Assignees
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. telemetry x/telemetry issues
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Jul 5, 2023

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

@gopherbot gopherbot added the telemetry x/telemetry issues label Jul 5, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jul 5, 2023
@pjweinb
Copy link

pjweinb commented Jul 5, 2023 via email

@joedian joedian added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jul 7, 2023
@hyangah
Copy link
Contributor Author

hyangah commented Jul 12, 2023

We will try

  1. increase the maxNameLen (and the page size)
  2. apply a simple name compression rule in counter name generation.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/509175 mentions this issue: internal/counter: increase pageSize and maxNameLen

@golang golang locked and limited conversation to collaborators Jul 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. telemetry x/telemetry issues
Projects
None yet
Development

No branches or pull requests

4 participants