-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ifrost/refactor-actions
- Loading branch information
Showing
67 changed files
with
213 additions
and
15 deletions.
There are no files selected for viewing
Binary file modified
BIN
+17.7 KB
(110%)
...s/Single-view-uploads-Multiple-profile-types-Pprof-uploads-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+18.6 KB
(110%)
...s/Single-view-uploads-Multiple-profile-types-Pprof-uploads-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+19.2 KB
(110%)
...s/Single-view-uploads-Multiple-profile-types-Pprof-uploads-3-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+8.77 KB
(110%)
...gle-view-uploads-Single-profile-type-Gzipped-Pprof-uploads-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+8.77 KB
(110%)
...hots/Single-view-uploads-Single-profile-type-Pprof-uploads-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.15 KB
(100%)
...rvices.spec.ts-snapshots/All-services-view-Layout-switcher-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.81 KB
(100%)
...vices.spec.ts-snapshots/All-services-view-Main-UI-elements-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.53 KB
(100%)
...-snapshots/All-services-view-Panel-actions-Favorite-action-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+17 KB
(110%)
...apshots/All-services-view-Panel-actions-Flame-graph-action-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9.79 KB
(100%)
...ts-snapshots/All-services-view-Panel-actions-Labels-action-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.92 KB
(110%)
...shots/All-services-view-Panel-actions-Profile-types-action-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.95 KB
(110%)
....spec.ts-snapshots/All-services-view-Profile-type-selector-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+20.1 KB
(110%)
...ph-view-Baseline-panel-Baseline-flame-graph-selection-mode-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.05 KB
(100%)
.../Diff-flame-graph-view-Baseline-panel-Baseline-time-picker-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.54 KB
(100%)
...ph-view-Baseline-panel-Baseline-time-picker-selection-mode-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+21.3 KB
(110%)
...iew-Comparison-panel-Comparison-flame-graph-selection-mode-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.3 KB
(100%)
...f-flame-graph-view-Comparison-panel-Comparison-time-picker-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.25 KB
(100%)
...iew-Comparison-panel-Comparison-time-picker-selection-mode-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+23.4 KB
(110%)
...ts-snapshots/Diff-flame-graph-view-Filters-Adding-a-filter-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+20.4 KB
(110%)
...h.spec.ts-snapshots/Diff-flame-graph-view-Main-UI-elements-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+21.3 KB
(110%)
...c.ts-snapshots/Diff-flame-graph-view-Profile-type-selector-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.04 KB
(100%)
...h.spec.ts-snapshots/Diff-flame-graph-view-Service-selector-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+8.12 KB
(100%)
...-view-Sync-time-ranges-Syncing-flame-graph-range-selection-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+20.7 KB
(110%)
...-view-Sync-time-ranges-Syncing-time-picker-range-selection-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.45 KB
(100%)
...ites-view.spec.ts-snapshots/Favorites-view-Layout-switcher-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.23 KB
(100%)
...tes-view.spec.ts-snapshots/Favorites-view-Main-UI-elements-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+2.6 KB
(100%)
...snapshots/Favorites-view-Panel-actions-Expand-panel-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+16.9 KB
(110%)
...-snapshots/Favorites-view-Panel-actions-Flame-graph-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+6.56 KB
(100%)
...s/Favorites-view-Panel-actions-Labels-action-with-group-by-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+9.8 KB
(100%)
...avorites-view-Panel-actions-Labels-action-without-group-by-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+8.61 KB
(110%)
...spec.ts-snapshots/Flame-graph-view-Filters-Adding-a-filter-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+13.6 KB
(110%)
...-graph.spec.ts-snapshots/Flame-graph-view-Main-UI-elements-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+1.57 KB
(100%)
...s-snapshots/Flame-graph-view-Panel-actions-Favorite-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+7.48 KB
(100%)
....ts-snapshots/Flame-graph-view-Panel-actions-Labels-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+19.8 KB
(110%)
...h.spec.ts-snapshots/Flame-graph-view-Profile-type-selector-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+14.7 KB
(100%)
...-graph.spec.ts-snapshots/Flame-graph-view-Service-selector-1-chromium-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+9.58 KB
(100%)
...bels.spec.ts-snapshots/Labels-view-Filters-Adding-a-filter-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+3.27 KB
(100%)
...er-sel-508a8-set-the-main-timeseries-Profile-type-selector-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+2.28 KB
(100%)
...er-sel-c73f2-ch-reset-the-main-timeseries-Service-selector-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+1.9 KB
(100%)
...fter-sel-dbe5f-n-items-then-clicking-on-the-Compare-button-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+2.12 KB
(100%)
...fter-sel-f81f2-on-item-then-clicking-on-the-Compare-button-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+13.3 KB
(110%)
...r-After-selecting-a-label-Panel-actions-Flame-graph-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+3.82 KB
(110%)
...r-Selects-a-label-and-displays-the-breakdown-in-a-new-grid-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+126 KB
(130%)
...-view/labels.spec.ts-snapshots/Labels-view-Layout-switcher-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+7.68 KB
(100%)
...view/labels.spec.ts-snapshots/Labels-view-Main-UI-elements-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+1.78 KB
(100%)
...ts-snapshots/Labels-view-Panel-actions-Expand-panel-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+3.82 KB
(110%)
....spec.ts-snapshots/Labels-view-Panel-actions-Select-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+2.62 KB
(100%)
...w/labels.spec.ts-snapshots/Labels-view-Panel-type-switcher-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
-6.98 KB
(91%)
...w/labels.spec.ts-snapshots/Labels-view-Panel-type-switcher-2-chromium-linux.png
Oops, something went wrong.
Binary file added
BIN
+83.2 KB
...w/labels.spec.ts-snapshots/Labels-view-Panel-type-switcher-3-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+10 KB
(110%)
...labels.spec.ts-snapshots/Labels-view-Profile-type-selector-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+6.26 KB
(110%)
...view/labels.spec.ts-snapshots/Labels-view-Service-selector-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+15 KB
(110%)
...types.spec.ts-snapshots/Profile-types-view-Layout-switcher-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+8.16 KB
(110%)
...ypes.spec.ts-snapshots/Profile-types-view-Main-UI-elements-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+2.44 KB
(110%)
...snapshots/Profile-types-view-Panel-actions-Favorite-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+19.8 KB
(110%)
...pshots/Profile-types-view-Panel-actions-Flame-graph-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+9.79 KB
(100%)
...s-snapshots/Profile-types-view-Panel-actions-Labels-action-1-chromium-linux.png
Oops, something went wrong.
Binary file modified
BIN
+11.8 KB
(110%)
...ypes.spec.ts-snapshots/Profile-types-view-Service-selector-1-chromium-linux.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
167 changes: 167 additions & 0 deletions
167
src/pages/ProfilesExplorerView/components/SceneLabelValuesTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
import { css } from '@emotion/css'; | ||
import { DataFrame, DataTransformerID, LoadingState } from '@grafana/data'; | ||
import { | ||
PanelBuilders, | ||
SceneComponentProps, | ||
SceneDataTransformer, | ||
sceneGraph, | ||
SceneObjectBase, | ||
SceneObjectState, | ||
VizPanel, | ||
VizPanelState, | ||
} from '@grafana/scenes'; | ||
import { useStyles2 } from '@grafana/ui'; | ||
import { getProfileMetric, ProfileMetricId } from '@shared/infrastructure/profile-metrics/getProfileMetric'; | ||
import React from 'react'; | ||
|
||
import { EventTimeseriesDataReceived } from '../domain/events/EventTimeseriesDataReceived'; | ||
import { ProfileMetricVariable } from '../domain/variables/ProfileMetricVariable'; | ||
import { getColorByIndex } from '../helpers/getColorByIndex'; | ||
import { buildTimeSeriesQueryRunner } from '../infrastructure/timeseries/buildTimeSeriesQueryRunner'; | ||
import { GridItemData } from './SceneByVariableRepeaterGrid/types/GridItemData'; | ||
|
||
interface SceneLabelValuesTableState extends SceneObjectState { | ||
body: VizPanel; | ||
} | ||
|
||
export class SceneLabelValuesTable extends SceneObjectBase<SceneLabelValuesTableState> { | ||
constructor({ | ||
item, | ||
headerActions, | ||
}: { | ||
item: GridItemData; | ||
headerActions: (item: GridItemData) => VizPanelState['headerActions']; | ||
}) { | ||
super({ | ||
key: 'table-label-values', | ||
body: PanelBuilders.table() | ||
.setTitle(item.label) | ||
.setData( | ||
new SceneDataTransformer({ | ||
$data: buildTimeSeriesQueryRunner(item.queryRunnerParams), | ||
transformations: [ | ||
{ | ||
id: DataTransformerID.reduce, | ||
options: { | ||
reducers: ['max'], | ||
labelsToFields: true, | ||
}, | ||
}, | ||
{ | ||
id: DataTransformerID.filterFieldsByName, | ||
options: { | ||
exclude: { | ||
names: ['Field'], | ||
}, | ||
}, | ||
}, | ||
{ | ||
id: DataTransformerID.renameByRegex, | ||
options: { | ||
regex: 'Max', | ||
renamePattern: 'max', | ||
}, | ||
}, | ||
{ | ||
id: DataTransformerID.sortBy, | ||
options: { | ||
sort: [ | ||
{ | ||
field: 'max', | ||
desc: true, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
}) | ||
) | ||
.setHeaderActions(headerActions(item)) | ||
.build(), | ||
}); | ||
|
||
this.addActivationHandler(this.onActivate.bind(this, item)); | ||
} | ||
|
||
onActivate(item: GridItemData) { | ||
const { body } = this.state; | ||
|
||
const sub = (body.state.$data as SceneDataTransformer)!.subscribeToState((newState) => { | ||
if (newState.data?.state !== LoadingState.Done) { | ||
return; | ||
} | ||
|
||
const { series } = newState.data; | ||
|
||
if (series?.length) { | ||
body.setState(this.getConfig(item, series)); | ||
} | ||
|
||
// we publish the event only after setting the new config so that the subscribers can modify it | ||
this.publishEvent(new EventTimeseriesDataReceived({ series }), true); | ||
}); | ||
|
||
return () => { | ||
sub.unsubscribe(); | ||
}; | ||
} | ||
|
||
getConfig(item: GridItemData, series: DataFrame[]) { | ||
const cardinality = series[0].fields[0].values.length; | ||
|
||
const profileMetricId = sceneGraph.findByKeyAndType(this, 'profileMetricId', ProfileMetricVariable).state | ||
.value as ProfileMetricId; | ||
const unitValue = getProfileMetric(profileMetricId).unit; | ||
|
||
return { | ||
title: cardinality > 1 ? `${item.label} (${cardinality})` : item.label, | ||
fieldConfig: { | ||
defaults: { | ||
custom: { | ||
filterable: true, | ||
cellOptions: {}, | ||
}, | ||
}, | ||
overrides: [ | ||
{ | ||
matcher: { | ||
id: 'byName', | ||
options: 'max', | ||
}, | ||
properties: [ | ||
{ | ||
id: 'unit', | ||
value: unitValue, | ||
}, | ||
{ | ||
id: 'custom.width', | ||
value: 100, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}; | ||
} | ||
|
||
static Component({ model }: SceneComponentProps<SceneLabelValuesTable>) { | ||
const styles = useStyles2(getStyles); // eslint-disable-line react-hooks/rules-of-hooks | ||
const { body } = model.useState(); | ||
|
||
return ( | ||
<span className={styles.container}> | ||
<body.Component model={body} /> | ||
</span> | ||
); | ||
} | ||
} | ||
|
||
const getStyles = () => ({ | ||
// couldn't find a better way just by configuring the table panel :man_shrug: | ||
container: css` | ||
[data-testid='data-testid table body'] [role='row']:first-child { | ||
color: ${getColorByIndex(3)}; | ||
font-weight: 500; | ||
} | ||
`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/pages/ProfilesExplorerView/helpers/formatSingleSeriesDisplayName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { DataFrame, getValueFormat } from '@grafana/data'; | ||
|
||
import { getSeriesStatsValue } from '../infrastructure/helpers/getSeriesStatsValue'; | ||
|
||
export function formatSingleSeriesDisplayName(label: string, s: DataFrame) { | ||
const metricFieldUnit = s.fields[1].config.unit; | ||
|
||
const allValuesSum = getSeriesStatsValue(s, 'allValuesSum') || 0; | ||
const allValuesSumFormatted = getValueFormat(metricFieldUnit)(allValuesSum); | ||
|
||
const maxValue = getSeriesStatsValue(s, 'maxValue') || 0; | ||
const maxValueFormatted = getValueFormat(metricFieldUnit)(maxValue); | ||
|
||
return `total ${label} = ${allValuesSumFormatted.text}${allValuesSumFormatted.suffix} / max = ${maxValueFormatted.text}${maxValueFormatted.suffix}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters