Skip to content

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

Open
@adonovan

Description

@adonovan

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.)

Activity

added this to the Unreleased milestone on Mar 25, 2024
adonovan

adonovan commented on Mar 25, 2024

@adonovan
MemberAuthor

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/).

added
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
on Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.telemetryx/telemetry issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @adonovan@gopherbot@thanm

        Issue actions

          x/telemetry: stack counters should use logical symbol names · Issue #66517 · golang/go