Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

Commit 274de3b

Browse files
committed
support Grafana 8
1 parent 8393405 commit 274de3b

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pyroscope-pyroscope-grafana",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Pyroscope plugin for grafana",
55
"scripts": {
66
"build": "grafana-toolkit plugin:build",

src/components/FlameGraphRenderer.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ class FlameGraphRenderer extends React.Component {
7070
this.rangeMin = 0;
7171
this.rangeMax = 1;
7272
this.query = '';
73-
this.panelContainer = document.querySelector('.flamegraph-wrapper')?.closest('.panel-wrapper');
73+
this.panelContainer =
74+
document.querySelector('.flamegraph-wrapper')?.closest('.panel-container') ||
75+
document.querySelector('.flamegraph-wrapper')?.closest('.panel-wrapper');
7476
window.addEventListener('focus', this.focusHandler);
7577

7678
if (this.props.shortcut) {
@@ -81,13 +83,15 @@ class FlameGraphRenderer extends React.Component {
8183
}
8284

8385
componentDidUpdate(prevProps, prevState) {
84-
if (this.props.data.series && this.props.data.series.length) {
85-
const name = this.props.data.series[this.props.data.series.length - 1].name;
86-
const from = this.props.data?.timeRange?.raw.from.valueOf();
87-
const until = this.props.data?.timeRange?.raw.to.valueOf();
88-
const prevName = prevProps.data.series[prevProps.data.series.length - 1].name;
89-
const prevFrom = prevProps.data?.timeRange?.raw.from.valueOf();
90-
const prevUntil = prevProps.data?.timeRange?.raw.to.valueOf();
86+
const prevData = prevProps.data ? prevProps.data : prevProps;
87+
const currentData = this.props.data ? this.props.data : this.props;
88+
if (currentData.series && currentData.series.length) {
89+
const name = currentData.series[currentData.series.length - 1].name;
90+
const from = currentData?.timeRange?.raw.from.valueOf();
91+
const until = currentData?.timeRange?.raw.to.valueOf();
92+
const prevName = prevData.series[prevData.series.length - 1].name;
93+
const prevFrom = prevData?.timeRange?.raw.from.valueOf();
94+
const prevUntil = prevData?.timeRange?.raw.to.valueOf();
9195
if (from !== prevFrom || until !== prevUntil || name !== prevName) {
9296
this.updateFlameBearerData();
9397
}

0 commit comments

Comments
 (0)