Skip to content

Conversation

@ifrost
Copy link
Contributor

@ifrost ifrost commented Jul 25, 2025

Fixes: #108773

Integrates Flame Graph package with Grafana Assistant.

Important notes:

  • grafana/assistant becomes a peerDependency, meaning anyone consuming new version of grafana/flamegraph would need to install it (we can make it optional peerDependency and load it dynamically, but not sure if it's worth it)
  • It's gonna work in core Grafana features (Explore, Dashboards)
  • To include it in Profiles Drilldown we'll need to update the dependency after release of grafana/flamegraph (Profiles Drilldown don't use core Flamegraph but includes its own) + feat(AI): Integrate with Grafana Assistant profiles-drilldown#558
  • This PR implements it for Pyroscope (won't work with Parca)
  • Mocked out grafana/assistant in unit tests because assistant seems to be calling getObservablePluginLinks which fails if Grafana is not loaded
  • Updated grafana/assistant to 0.0.12 to use ChatItemContext (see also https://github.com/grafana/grafana-assistant-app/pull/1035)
  • Adding a feature toggle needed by Profiles Drilldown (more details in Pyroscope: Integrate Flame Graph with Grafana Assistant #108773)

Here's how it works:

Screen.Recording.2025-07-25.at.14.15.46.mov

@ifrost ifrost changed the title ifrost/analyze-flame-graph Flame Graph: Analyze with Grafana Assistant Jul 25, 2025
@github-actions github-actions bot added area/frontend datasource/grafana-pyroscope Grafana pyroscope datasource (previously Phlare) labels Jul 25, 2025
@ifrost ifrost marked this pull request as ready for review July 25, 2025 13:52
@ifrost ifrost requested review from a team as code owners July 25, 2025 13:52
@ifrost ifrost requested review from gabor and removed request for a team July 25, 2025 13:52
@svennergr
Copy link
Contributor

grafana/assistant doesn't export ChatItemContext hence using ReturnType instead

Good call - we can change that!

Great job in the integration.
Raise The Roof Office

@ifrost ifrost self-assigned this Jul 28, 2025
Copy link
Contributor

@svennergr svennergr left a comment

Choose a reason for hiding this comment

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

Feel free to use 0.0.11 of @grafana/assistant

@ifrost
Copy link
Contributor Author

ifrost commented Jul 30, 2025

An alternative approach consistent with how it's implemented for TraceView: #108885 + https://github.com/grafana/grafana-assistant-app/pull/1111

@ifrost ifrost requested review from a team and grafanabot as code owners August 1, 2025 11:41
cursor[bot]

This comment was marked as outdated.

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with ifrost/analyze-flame-graph oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

Error building instance: Contact #proj-ephemeral-hg-instances if it is not a compile error. Logs

@ifrost
Copy link
Contributor Author

ifrost commented Aug 7, 2025

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with ifrost/analyze-flame-graph oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

@github-actions github-actions bot added the type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project label Aug 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2025

💻 Deploy preview deleted.

@ifrost
Copy link
Contributor Author

ifrost commented Aug 8, 2025

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with ifrost/analyze-flame-graph oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

@ifrost
Copy link
Contributor Author

ifrost commented Aug 14, 2025

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with ifrost/analyze-flame-graph oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

Error building instance: Contact #proj-ephemeral-hg-instances if it is not a compile error. Logs

@joey-grafana
Copy link
Contributor

What's going on with the deploys @ifrost? Seems like half the time it fails and the other half it only lasts for less than a day or something?

@ifrost
Copy link
Contributor Author

ifrost commented Aug 18, 2025

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with ifrost/analyze-flame-graph oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

Error building instance: Contact #proj-ephemeral-hg-instances if it is not a compile error. Logs

@ifrost
Copy link
Contributor Author

ifrost commented Aug 18, 2025

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with ifrost/analyze-flame-graph oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

@ifrost
Copy link
Contributor Author

ifrost commented Aug 18, 2025

What's going on with the deploys @ifrost? Seems like half the time it fails and the other half it only lasts for less than a day or something?

Seems like a mix of not being synced with main and some issue in dev environment. The ephemeral is up and running now. I needed it double check flame graph load fine. It incorrectly shows the button for non-pyroscope queries so I need to double check it 🤔

@ifrost ifrost merged commit bbf01a6 into main Aug 19, 2025
152 of 154 checks passed
@ifrost ifrost deleted the ifrost/analyze-flame-graph branch August 19, 2025 07:54
gelicia pushed a commit that referenced this pull request Aug 19, 2025
* Bare-bones mocked integration

* Create correct context based on the query

* Add data source name

* Do not bundle grafana/assistant with flame graph

* Rename component

* Add tests

* Mock grafana/assistant

* Update feature toggle and allow hiding the button

* Update deps

* Update types

* Update yarn.lock

* Fix typo in feature toggle description

* Enable grafanaAssistantInProfilesDrilldown by default

* Enable grafanaAssistantInProfilesDrilldown by default

* Show Analyze Flame Graph button only if there's context for the assistant
leeoniya pushed a commit that referenced this pull request Aug 19, 2025
* Bare-bones mocked integration

* Create correct context based on the query

* Add data source name

* Do not bundle grafana/assistant with flame graph

* Rename component

* Add tests

* Mock grafana/assistant

* Update feature toggle and allow hiding the button

* Update deps

* Update types

* Update yarn.lock

* Fix typo in feature toggle description

* Enable grafanaAssistantInProfilesDrilldown by default

* Enable grafanaAssistantInProfilesDrilldown by default

* Show Analyze Flame Graph button only if there's context for the assistant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add to changelog area/backend area/frontend datasource/grafana-pyroscope Grafana pyroscope datasource (previously Phlare) type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pyroscope: Integrate Flame Graph with Grafana Assistant

3 participants