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

feat(FlameGraph): Add missing export menu #132

Merged
merged 11 commits into from
Aug 27, 2024
Merged

Conversation

grafakus
Copy link
Contributor

@grafakus grafakus commented Aug 26, 2024

✨ Description

Related issue(s): solves #104, is blocked by #129

📖 Summary of the changes

Most of the code already existed, this PR just uses it in a new SceneExportMenu class.

Note that, because the Scenes app uses data frames, but the JSON and the flamegraph.com exports require the Flamebearer format, we have to fetch the Flamebearer profile before being able to proceed to the export.

Ideally, in the near future, we should just convert the data frames to the Flamebearer format without any request to the API.

🧪 How to test?

Manually, by exporting to the 4 different formats and verifying that the data is correct.

For JSON and PPROF, this can be done by uploading them in the AdHoc view (http://localhost:3000/a/grafana-pyroscope-app/ad-hoc) and verify that they match.

Again, very soon, we should automate by adding E2E tests.

@grafakus grafakus changed the title Fix/flame graph export feat(FlameGraph): Add missing export menu Aug 26, 2024
Copy link
Contributor

github-actions bot commented Aug 26, 2024

Unit test coverage

Lines Statements Branches Functions
Coverage: 10%
10.59% (469/4426) 8.19% (134/1636) 8% (108/1350)

@grafakus grafakus requested a review from ifrost August 26, 2024 11:18
@grafakus grafakus changed the base branch from main to fix/ai-feature August 26, 2024 11:19
@@ -0,0 +1,28 @@
import { Field, Message } from 'protobufjs/light';

export class PprofRequestWithoutMaxNodes extends Message<PprofRequestWithoutMaxNodes> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just renamed it to prevent runtime errors (protobufjs/protobuf.js#1408). This class will be removed very soon because it was used for the legacy comparison pages.

Base automatically changed from fix/ai-feature to main August 26, 2024 12:59
# Conflicts:
#	src/pages/ProfilesExplorerView/components/SceneAiPanel/infrastructure/useFetchDotProfiles.ts
#	src/pages/ProfilesExplorerView/components/SceneExploreServiceFlameGraph/SceneFlameGraph.tsx
@@ -14,6 +15,8 @@ export function useExportMenu({ profile, enableFlameGraphDotComExport }: ExportD
const [timeRange] = useTimeRangeFromUrl();

const downloadPng = () => {
reportInteraction('g_pyroscope_export_profile', { format: 'png' });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding missing tracking here as well.

@grafakus grafakus requested a review from aleks-p August 26, 2024 13:26
@aleks-p
Copy link
Contributor

aleks-p commented Aug 26, 2024

I just gave it a quick test:

PNG ✅

  • works as expected for different profile types

JSON ✅

  • the resulting JSON works fine when uploaded to flamegraph.com

PPROF ✅ ⚠️

  • works as expected with go tool pprof for different profile types
  • when I manually uploaded the pprof for a cpu profile to flamegraph.com, the unit broke - a profile with 4s total time got converted to a 1.4 years profile

flamegraph.com ✅

  • works as expected for different profile types

Unsure if the minor PPROF issue I encountered is due to something we are doing or something flamegraph.com is missing but I am leaning towards the latter because go tool pprof was able to show the correct data.

@grafakus grafakus merged commit f57b0ca into main Aug 27, 2024
6 of 7 checks passed
@grafakus grafakus deleted the fix/flame-graph-export branch August 27, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants