mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
65b2834420
* chore(storybook): run yarn dlx storybook@latest upgrade * chore(storybook): remove storybook/blocks patch * chore(yarn): clean up storybook dependencies * feat(storybook): migrate to v8 config via migration codemods * refactor(storybook): update stories to use v8 types via codemod * refactor(storybook): update stories to use preview-api instead of client-api * refactor(storybook): replace mdx usage of ArgsTable with PureArgsTable * refactor(storybook): migrate remaining mdx files to v8 storybook/blocks api * refactor(storybook): clean up mdx imports and blocks component names * chore(storybook): clean up typescript configuration * fix(frontend): align types/react versions across monorepo so grafana ui can be built * fix(storybook): pub back react-docgen-typescript and use ArgTypes so props tables work * chore(storybook): patch blocks package to expose Preview component * revert(storybook): revert changes related to using Canvas component in mdx files * Storybook upgrade: Fix icon typing (#87793) fix iconOptions typing * refactor(storybook): prefer as const over asserting types * revert(storybook): put back correct case in box.mdx --------- Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com> |
||
---|---|---|
.. | ||
src | ||
.eslintrc | ||
CHANGELOG.md | ||
LICENSE_APACHE2 | ||
package.json | ||
README.md | ||
rollup.config.ts | ||
tsconfig.build.json | ||
tsconfig.json |
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. |