Coder Social home page Coder Social logo

Comments (3)

wcn3 avatar wcn3 commented on July 20, 2024

The proposed signature precludes the user from adding their own labels to the profiler, which would be annoying. At least calls to pprof.Do() are nestable, so I could call it twice, once for the tag map, then once for my labels, but that feels clunky.

A signature of

func Do(ctx context.Context, m *Map, l *pprof.LabelSet, f func(c context.Context)) or

func Do(ctx context.Context, m *Map, f func(c context.Context), l ...pprof.LabelSet)

might be more helpful to the user, with a clearly defined behavior that keys in the tag map clobber user-provided keys (for example). The downside of this suggestion is that the collision behavior for identical keys is baked into Do, whereas with the previous approach, calls to Do determine the collision behavior.

Alternatively, if the runtime/pprof API could be modified to include a capability to merge LabelSets into a single LabelSet, that'd be powerful. LabelSets are opaque in the same way tag maps are, so a function to convert tag maps to a LabelSet would be sufficient while retaining the opacity properties of the tag map.

I have a somewhat pressing need for this functionality, and would be delighted to contribute if it can help expedite its existence, hence the thoughts exploring the potential design spaces.

from opencensus-go.

rakyll avatar rakyll commented on July 20, 2024

I haven't done a very comprehensive survey but the mutual use of pprof labels with tags was not that common. That's the main reason the suggested API is opinionated to work against the tags but we need to make the mutual use possible.

@matloob, this case seems to be a very common use case for instrumentation libraries. What do we suggest them to do? I also don't have a good background how the standard library pprof labels APIs have been emerged. In Do, we don't want to apply profiler labels from the incoming context automatically. Is this to avoid user having to write one more line (pprof.WithLabels) or we want them to avoid passing a context with lots of profiler labels around?

from opencensus-go.

matloob avatar matloob commented on July 20, 2024

I think tag.Do is exactly what we need.

from opencensus-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.