grafana/packages/grafana-flamegraph
Esteban Beltran 0b03344baa
Chore: Update to typescript 5 (#76511)
* Update dependency typescript to v5

* Update yarn.lock

* Fix typescript errors

* Update typescript version sdk

* Revert useDescription.ts

* Fix ts errors

* Fix Typescript errors after Symbol.unscopables type change

* Fix colormanipulator errors

* Update packages/grafana-data/src/vector/FunctionalVector.ts

* Fix ts errors in dashboardmigrator

* Fix sandbox component typescript error

* Update yarn

* Update to typescript 5.2

* Fix typescript error

* update typescript/vscode patch/sdk/whatever

* fix ts errors in elasticsearch

* Fix two errors in alerting

* Fix error in dashboard-scene

* Fix errors in dashboard tests

* Fix errors in explore tests

* Fix error in plugins sandbox

* fix error in DashboardQueryRunner

* fix errors in grafana-data

* fix errors in PanelChrome story

* update betterer

* better fix for cloud monitoring

* fix error in reducer tester

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
2023-11-07 13:20:20 +00:00
..
src Flamegraph: Rendering from tree instead of levels (#76215) 2023-10-18 15:53:07 +02:00
.eslintrc Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02: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 Chore: Update to typescript 5 (#76511) 2023-11-07 13:20:20 +00:00
README.md Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02:00
rollup.config.ts Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02:00
tsconfig.build.json Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02:00
tsconfig.json Flamegraph: Move to package (#73113) 2023-09-12 12:28:48 +02: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.