Skip to content
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

x/telemetry: stack counters should use logical symbol names #66517

Open
adonovan opened this issue Mar 25, 2024 · 1 comment
Open

x/telemetry: stack counters should use logical symbol names #66517

adonovan opened this issue Mar 25, 2024 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. telemetry x/telemetry issues
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Mar 25, 2024

Currently, the stack counters reported by telemetry use the runtime's symbol names. While they are useful information for binary-based tools, they are hostile to source-based downstream tooling because they obscure the actual package of the function name in the presence of inlining, and this information cannot be restored without type checking the source. See #64654 (comment) for an example.

I propose that x/telemetry post-processes the result of CallersFrames into a form that provides the file, (relative) line and logical (not inlined) symbol name---assuming the runtime frames provide sufficient information to make this feasible.

For example, this symbol in the current format:

golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5

would be translated to something like:

golang.org/x/tools/gopls/internal/protocol/protocol.go:ServerHandler+5

(I suspect the name with the "true" anonymous function suffix "ServerHandler.func1" would not be available, but if it is, let's use that.)

@adonovan
Copy link
Member Author

adonovan commented Mar 25, 2024

Thanks to @prattmic for pointing me at: #60324. In particular, this note from Russ asserts the goal that the canonical symbol names should not be compromised by inlining. So, if that issue gets fixed, we will have reliable filenames and package names for all Go symbols, which will allow us to reliably strip off the portion of the filename to the left of the package name (e.g. /home/alice/src/).

@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. telemetry x/telemetry issues
Projects
None yet
Development

No branches or pull requests

3 participants