Skip to content

x/telemetry/internal/counter: allow StackCounter to skip custom call depth #61234

@hyangah

Description

@hyangah

Currently StackCounter.Inc captures the Inc caller's stack using runtime.Callers(2, ...).
One use case we want to explore is to have a StackCounter to track calls to gopls/internal/bug.report.

If we call StackCounter.Inc from this report function (wrapper of StackCounter.Inc), the first couple of entries are always the functions in this gopls/internal/bug package, which isn't very interesting while taking up a good fraction of the counter name which already has pretty small max limit (#61181).

Can we allow the api to configure custom skip depth like runtime.Callers or log.Logger.Output?

Or alternatively, can we have StackCounter.Inc take pcs ?

cc @golang/tools-team @rsc

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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions