Skip to content

feat: add mapping names to Flamegraph#5201

Open
elizaveta-andreeva wants to merge 1 commit into
grafana:mainfrom
elizaveta-andreeva:feat/add_mapping_names
Open

feat: add mapping names to Flamegraph#5201
elizaveta-andreeva wants to merge 1 commit into
grafana:mainfrom
elizaveta-andreeva:feat/add_mapping_names

Conversation

@elizaveta-andreeva

@elizaveta-andreeva elizaveta-andreeva commented May 28, 2026

Copy link
Copy Markdown

Summary

Adds filename/mapping information to the Flamegraph response, enabling Grafana to apply custom coloring schemes based on kernel/user space symbols. The mapping data exposes the executable for each symbol, allowing Grafana to identify which binary or library a frame belongs to.

Changes

Proto changes:

  • Add mapping_names field ([]string) to FlameGraph and TreeReport proto messages
  • Add mapping field (map<function_name, filename>) to SelectMergeStacktracesResponse and SelectMergeSpanProfileResponse proto messages

Resolver:

  • Add TreeWithMappings() method to Resolver that builds a function name -> filename mapping from symbol data

FlameGraph construction:

  • Populate mapping_names in NewFlameGraph() using the mapping built above
  • Propagate mapping through the query path: queryTree -> TreeReport -> SelectMergeStacktracesResponse / SelectMergeSpanProfileResponse

pprof / OTLP:

  • Add buildMappingFromPprof() and buildMappingFromProfile() helpers to extract mapping from pprof profiles (pprof -> profile -> mapping)
  • Use frameType to distinguish user vs. kernel space symbols when converting OTLP to Google profile format
  • Add [kernel] prefix to kernel symbol mapping filenames during OTLP conversion, so that Grafana can correctly classify and color kernel frames

Tests:

  • Add unit tests covering the new mapping logic

Related PR: grafana/grafana#125627

@cla-assistant

cla-assistant Bot commented May 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cla-assistant

cla-assistant Bot commented May 28, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


e.andreeva seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@elizaveta-andreeva

Copy link
Copy Markdown
Author

@korniltsev-grafanista could you take a look pls?

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.

1 participant