grafana/packages/grafana-flamegraph
Jack Westbrook 8c41137bcf
Frontend: Update to Eslint 9 (#94823)
* chore(eslint): bump all eslint related packages to latest

* chore(eslint): update linting scripts work with v9

* chore(eslint): introduce flat config

* chore(eslint): delete legacy configs

* feat(grafana-eslint-rules): update rules to use eslint 9 APIs

* chore(eslint): migrate all nested eslintrc files over to root config

* chore(packages): bump eslint dependencies

* feat(betterer): make it work with eslint 9

* style(grafana-data): remove non-existant ban-types rule from disable declarations

* chore(wip): [wip] link eslint-config-grafana

* chore(packages): add @eslint/compat

* chore(eslint): add compat to testing library and fix alerting rules

* chore(eslint): bump grafana eslint-config to v8

* chore(explore): delete legacy eslint config

* chore: clean codeowners file, remove grafana/eslint-config from e2e plugins

* test(eslint-rules): fix no-border-radius-literal and no-aria-label-e2e-selectors rule tests

* Add .js to prettier checks so new eslint.config.js file isn't missed

* chore(eslint): move emotion/syntax-preference to grafana/defaults

* test(eslint): use core-js structured-clone

* revert(services): undo merge backend-format githook changes

* test(eslint-rules): remove structured-clone polyfill from tests

* chore(eslint): add back public/lib/monaco to ignore list, sort alphabetically

* chore(e2e-plugins): remove eslint config 7 from plugins package.json

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
2024-11-07 16:31:06 +01:00
..
src React: Use new JSX transform (#88802) 2024-06-25 12:43:47 +01:00
CHANGELOG.md Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02:00
LICENSE_APACHE2 Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02:00
package.json Update dependency @types/node to v20.16.15 2024-10-23 12:59:48 +00:00
project.json Build: Nx improvements (#88341) 2024-10-15 14:25:45 +02:00
README.md Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02:00
rollup.config.ts Fix: Prevent import errors caused by Rollup 4 (#93903) 2024-09-27 12:18:52 +01:00
tsconfig.build.json Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02:00
tsconfig.json React: Use new JSX transform (#88802) 2024-06-25 12:43:47 +01:00

Grafana Flamegraph component

@grafana/flamegraph is currently in BETA.

This is a Flamegraph component that is used in Grafana and Pyroscope web app to display profiles.

Usage

Currently this library exposes single component Flamegraph that renders whole visualization used for profiling which contains a header, a table representation of the data and a flamegraph.

import { Flamegraph } from '@grafana/flamegraph';

<FlameGraph
  getTheme={() => createTheme({ colors: { mode: 'dark' } })}
  data={dataFrame}
  extraHeaderElements={
    <Button onClick={() => {}} variant="secondary">
      Download
    />
  }
  stickyHeader
  vertical
/>

Props

Name Type Description
data DataFrame DataFrame with the profile data. Optional, if missing or empty the flamegraph is not rendered
stickyHeader boolean Whether the header should be sticky and be always visible on the top when scrolling.
getTheme () => GrafanaTheme2 Provides a theme for the visualization on which colors and some sizes are based.
onTableSymbolClick (symbol: string) => void Interaction hook that can be used to report on the interaction. Fires when user click on a name in the table.
onViewSelected (view: string) => void Interaction hook that can be used to report on the interaction. Fires when user changes the view to show (table/graph/both)
onTextAlignSelected (align: string) => void Interaction hook that can be used to report on the interaction. Fires when user changes the text align.
onTableSort (sort: string) => void Interaction hook that can be used to report on the interaction. Fires when user changes the teble sorting.
extraHeaderElements React.ReactNode Elements that will be shown in the header on the right side of the header buttons. Useful for additional functionality.
vertical boolean If true the flamegraph will be rendered on top of the table.
DataFrame schema

The dataFrame needs to have the following fields:

Name Type Description
name string The name of the node.
labels string[] The labels of the node.
level number The nesting level of the node.
value number The total value of the node.
self number The self value of the node.
valueRight number The total value of the node in the right profile. Optional, if present will show a diff version of the flamegraph.
selfRight number The self value of the node in the right profile. Optional, if present will show a diff version of the flamegraph.