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

symbolizer: Symbolization implemented in Go #314

Merged
merged 6 commits into from
Oct 18, 2021
Merged

Conversation

kakkoyun
Copy link
Member

@kakkoyun kakkoyun commented Oct 14, 2021

Fixes #276, #213

  1. Removes pprof and llvm dependencies.
  2. Adds a add2liner that uses DWARF, written in Go (subsequent improvements and optimizations yet to come)
  3. Adds name demangling support

There's a lot of room for improvement (which will be addressed in subsequent PRs)

Mon Oct 18 12:00:42 PM CEST 2021

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Add
demangling support

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
@kakkoyun kakkoyun requested a review from brancz October 14, 2021 16:50
@@ -277,7 +285,7 @@ func TestRealSymbolizer(t *testing.T) {
})
require.Equal(t, 3, len(lines))
require.Equal(t, "/home/brancz/src/github.com/polarsignals/pprof-labels-example/main.go", lines[0].Function.Filename)
require.Equal(t, int64(10), lines[0].Line)
require.Equal(t, int64(7), lines[0].Line) // llvm-addr2line gives 10
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brancz My only concern is this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as long as inlining works in general I'm ok with anything that works consistently and we can improve in the future

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
@kakkoyun kakkoyun changed the title WIP: Native symbolization symbolizer: Native symbolization Oct 18, 2021
@kakkoyun kakkoyun marked this pull request as ready for review October 18, 2021 10:05
@kakkoyun kakkoyun changed the title symbolizer: Native symbolization symbolizer: Symbolization implemented in Go Oct 18, 2021
Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really amazing work! 💯

Nothing that stands out, just a few questions on clarification and making sure we follow up on documentation.

@@ -62,6 +63,8 @@ type Flags struct {

StorageTSDBRetentionTime time.Duration `default:"6h" help:"How long to retain samples in storage."`
StorageTSDBExpensiveMetrics bool `default:"false" help:"Enable really heavy metrics. Only do this for debugging as the metrics are slowing Parca down by a lot." hidden:"true"`

SymbolizerDemangleMode string `default:"simple" help:"Mode to demangle C++ symbols. Default mode is simplified: : no parameters, no templates, no return type" enum:"simple,full,none,templates"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I as a user know what to choose here? Maybe we can at least open an issue on the docs repo to clarify what this is, what it means and how to configure it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

func DWARF(demangler *demangle.Demangler, _ *profile.Mapping, path string) (func(addr uint64) ([]profile.Line, error), error) {
// TODO(kakkoyun): Handle offset, start and limit?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we open an issue for this? I think we will need this to symbolize dynamically linked libraries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
@@ -59,6 +59,8 @@ func (s *Symbolizer) NewLiner(m *profile.Mapping, file string) (liner, error) {
}
if hasDWARF {
level.Debug(s.logger).Log("msg", "using DWARF to resolve symbols", "file", file)
// TODO(kakkoyun): Add cache per file.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -84,6 +84,7 @@ func (s *Symbolizer) symbolize(ctx context.Context, locations []*profile.Locatio
var result *multierror.Error
for id, mapping := range mappings {
level.Debug(s.logger).Log("msg", "storage symbolization request started", "buildid", mapping.BuildID)
// TODO(kakkoyun): Cache failed symbolization attempts per location.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

@kakkoyun kakkoyun merged commit 00c6886 into main Oct 18, 2021
@kakkoyun kakkoyun deleted the native_symbolization branch October 18, 2021 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zombie [llvm-symbolizer] process accumulated in parca container
2 participants