grafana / pyroscope

Continuous Profiling Platform. Debug performance issues down to a single line of code
https://grafana.com/oss/pyroscope/
GNU Affero General Public License v3.0
9.67k stars 578 forks source link

Baseline support for otelpyroscope #964

Closed petethepig closed 2 years ago

petethepig commented 2 years ago

Context

We have an otel integration located here. It allows users to integrate with tracing providers and store profiles for each span in pyroscope.

Goal

We want to have ability to go from an individual profile (e.g app{profile_id="abcdef"}) to it's "baseline", which would an aggregation of traces in the same execution context.

Proposed Solution

Now that we have support for comparing queries (https://github.com/pyroscope-io/pyroscope/pull/942), the easiest way to implement this would be an extension of otelpyroscope, where instead of (or in additon to) posting the url to an individual profile (e.g http://localhost:4040/render?query=app.cpu{profile_id="abcdef"}, we would post a url to comparison view, e.g http://localhost:4040/render?leftQuery=app.cpu{controller="foo"}&rightQuery=app.cpu{profile_id="abcdef"}

Rperry2174 commented 2 years ago

I think this should be "in addition too" so in the end there should be two fields:

  1. single view (which links directly to current profile_id)
  2. comparson view (which has one "side" being the profile_id and the other side being all of the other tags available in the context (minus profile_id)

Also this relies on #942 which we merged recently

kolesnikovae commented 2 years ago

I'll also add an option to add the current root span name to labels automatically - for those who want one-to-one mapping between a trace and profile but don't want to mess with pprof labels.

Rperry2174 commented 2 years ago

So just to summarize here so we're on the same page... The goal is to make it so that we can easily compare a single trace-specific profile to a baseline of an aggregation of all the "similar" trace-specific-profiles

To illustrate we can use our golang-push example there are two tags:

Now when using the otelpyroscope package we would be able to introduce an extra tag which is span_name corresponding with name of the root span. This would make it so that if we have:

Then if the WithAutoLabels option is set to:

There are a few main benefit and some potential disadvantages to implementing this in otelpyroscope this way:

Benefits:

Disadvantages:

petethepig commented 2 years ago

And after #967 we'll have diff support too.

petethepig commented 2 years ago

Implemented in https://github.com/pyroscope-io/otelpyroscope/pull/1