Heatmap: Replace the heatmap panel with new implementation (#50229)

This commit is contained in:
Ryan McKinley 2022-06-23 11:48:28 -07:00 committed by GitHub
parent 497310a9cb
commit dd5a3b7747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 90 additions and 55 deletions

View File

@ -58,6 +58,7 @@ export interface FeatureToggles {
autoMigrateGraphPanels?: boolean; autoMigrateGraphPanels?: boolean;
prometheusWideSeries?: boolean; prometheusWideSeries?: boolean;
canvasPanelNesting?: boolean; canvasPanelNesting?: boolean;
useLegacyHeatmapPanel?: boolean;
cloudMonitoringExperimentalUI?: boolean; cloudMonitoringExperimentalUI?: boolean;
logRequestsInstrumentedAsUnknown?: boolean; logRequestsInstrumentedAsUnknown?: boolean;
dataConnectionsConsole?: boolean; dataConnectionsConsole?: boolean;

View File

@ -40,7 +40,8 @@ var skipPaths = []string{
"public/app/plugins/panel/barchart/models.cue", "public/app/plugins/panel/barchart/models.cue",
"public/app/plugins/panel/canvas/models.cue", "public/app/plugins/panel/canvas/models.cue",
"public/app/plugins/panel/histogram/models.cue", "public/app/plugins/panel/histogram/models.cue",
"public/app/plugins/panel/heatmap-new/models.cue", "public/app/plugins/panel/heatmap/models.cue",
"public/app/plugins/panel/heatmap-old/models.cue",
"public/app/plugins/panel/candlestick/models.cue", "public/app/plugins/panel/candlestick/models.cue",
"public/app/plugins/panel/state-timeline/models.cue", "public/app/plugins/panel/state-timeline/models.cue",
"public/app/plugins/panel/status-history/models.cue", "public/app/plugins/panel/status-history/models.cue",

View File

@ -120,7 +120,7 @@ func verifyCorePluginCatalogue(t *testing.T, ctx context.Context, pm *PluginMana
"gettingstarted": {}, "gettingstarted": {},
"graph": {}, "graph": {},
"heatmap": {}, "heatmap": {},
"heatmap-new": {}, "heatmap-old": {},
"histogram": {}, "histogram": {},
"icon": {}, "icon": {},
"live": {}, "live": {},

View File

@ -238,6 +238,11 @@ var (
State: FeatureStateAlpha, State: FeatureStateAlpha,
FrontendOnly: true, FrontendOnly: true,
}, },
{
Name: "useLegacyHeatmapPanel",
Description: "Continue to use the angular/flot based heatmap panel",
State: FeatureStateStable,
},
{ {
Name: "cloudMonitoringExperimentalUI", Name: "cloudMonitoringExperimentalUI",
Description: "Use grafana-experimental UI in Cloud Monitoring", Description: "Use grafana-experimental UI in Cloud Monitoring",

View File

@ -175,6 +175,10 @@ const (
// Allow elements nesting // Allow elements nesting
FlagCanvasPanelNesting = "canvasPanelNesting" FlagCanvasPanelNesting = "canvasPanelNesting"
// FlagUseLegacyHeatmapPanel
// Continue to use the angular/flot based heatmap panel
FlagUseLegacyHeatmapPanel = "useLegacyHeatmapPanel"
// FlagCloudMonitoringExperimentalUI // FlagCloudMonitoringExperimentalUI
// Use grafana-experimental UI in Cloud Monitoring // Use grafana-experimental UI in Cloud Monitoring
FlagCloudMonitoringExperimentalUI = "cloudMonitoringExperimentalUI" FlagCloudMonitoringExperimentalUI = "cloudMonitoringExperimentalUI"

View File

@ -628,16 +628,7 @@
"url": "https://grafana.com" "url": "https://grafana.com"
}, },
"description": "Like a histogram over time", "description": "Like a histogram over time",
"links": [ "links": null,
{
"name": "Brendan Gregg - Heatmaps",
"url": "http://www.brendangregg.com/heatmaps.html"
},
{
"name": "Brendan Gregg - Latency Heatmaps",
"url": " http://www.brendangregg.com/HeatMaps/latency.html"
}
],
"logos": { "logos": {
"small": "public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg", "small": "public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg",
"large": "public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg" "large": "public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg"
@ -662,9 +653,9 @@
"signatureOrg": "" "signatureOrg": ""
}, },
{ {
"name": "Heatmap (new)", "name": "Heatmap (legacy)",
"type": "panel", "type": "panel",
"id": "heatmap-new", "id": "heatmap-old",
"enabled": true, "enabled": true,
"pinned": false, "pinned": false,
"info": { "info": {
@ -672,11 +663,20 @@
"name": "Grafana Labs", "name": "Grafana Labs",
"url": "https://grafana.com" "url": "https://grafana.com"
}, },
"description": "This heatmap panel will replace the heatmap panel in 9.1", "description": "Legacy heatmap panel based on angular, d3, and flot",
"links": null, "links": [
{
"name": "Brendan Gregg - Heatmaps",
"url": "http://www.brendangregg.com/heatmaps.html"
},
{
"name": "Brendan Gregg - Latency Heatmaps",
"url": " http://www.brendangregg.com/HeatMaps/latency.html"
}
],
"logos": { "logos": {
"small": "public/app/plugins/panel/heatmap-new/img/icn-heatmap-panel.svg", "small": "public/app/plugins/panel/heatmap-old/img/icn-heatmap-panel.svg",
"large": "public/app/plugins/panel/heatmap-new/img/icn-heatmap-panel.svg" "large": "public/app/plugins/panel/heatmap-old/img/icn-heatmap-panel.svg"
}, },
"build": {}, "build": {},
"screenshots": null, "screenshots": null,
@ -690,9 +690,9 @@
}, },
"latestVersion": "", "latestVersion": "",
"hasUpdate": false, "hasUpdate": false,
"defaultNavUrl": "/plugins/heatmap-new/", "defaultNavUrl": "/plugins/heatmap-old/",
"category": "", "category": "",
"state": "beta", "state": "deprecated",
"signature": "internal", "signature": "internal",
"signatureType": "", "signatureType": "",
"signatureOrg": "" "signatureOrg": ""

View File

@ -224,11 +224,18 @@ export class PanelModel implements DataConfigSource, IPanelModel {
(this as any)[property] = model[property]; (this as any)[property] = model[property];
} }
// Special 'graph' migration logic switch (this.type) {
if (this.type === 'graph' && config?.featureToggles?.autoMigrateGraphPanels) { case 'graph':
if (config?.featureToggles?.autoMigrateGraphPanels) {
this.autoMigrateFrom = this.type; this.autoMigrateFrom = this.type;
this.type = 'timeseries'; this.type = 'timeseries';
} }
break;
case 'heatmap-new':
this.autoMigrateFrom = this.type;
this.type = 'heatmap';
break;
}
// defaults // defaults
defaultsDeep(this, cloneDeep(defaults)); defaultsDeep(this, cloneDeep(defaults));

View File

@ -40,6 +40,7 @@ const tempoPlugin = async () =>
const alertmanagerPlugin = async () => const alertmanagerPlugin = async () =>
await import(/* webpackChunkName: "alertmanagerPlugin" */ 'app/plugins/datasource/alertmanager/module'); await import(/* webpackChunkName: "alertmanagerPlugin" */ 'app/plugins/datasource/alertmanager/module');
import { config } from '@grafana/runtime';
import * as alertGroupsPanel from 'app/plugins/panel/alertGroups/module'; import * as alertGroupsPanel from 'app/plugins/panel/alertGroups/module';
import * as alertListPanel from 'app/plugins/panel/alertlist/module'; import * as alertListPanel from 'app/plugins/panel/alertlist/module';
import * as annoListPanel from 'app/plugins/panel/annolist/module'; import * as annoListPanel from 'app/plugins/panel/annolist/module';
@ -50,7 +51,6 @@ import * as dashListPanel from 'app/plugins/panel/dashlist/module';
import * as debugPanel from 'app/plugins/panel/debug/module'; import * as debugPanel from 'app/plugins/panel/debug/module';
import * as gaugePanel from 'app/plugins/panel/gauge/module'; import * as gaugePanel from 'app/plugins/panel/gauge/module';
import * as gettingStartedPanel from 'app/plugins/panel/gettingstarted/module'; import * as gettingStartedPanel from 'app/plugins/panel/gettingstarted/module';
import * as heatmapPanelNG from 'app/plugins/panel/heatmap-new/module';
import * as histogramPanel from 'app/plugins/panel/histogram/module'; import * as histogramPanel from 'app/plugins/panel/histogram/module';
import * as livePanel from 'app/plugins/panel/live/module'; import * as livePanel from 'app/plugins/panel/live/module';
import * as logsPanel from 'app/plugins/panel/logs/module'; import * as logsPanel from 'app/plugins/panel/logs/module';
@ -73,10 +73,24 @@ const canvasPanel = async () => await import(/* webpackChunkName: "canvasPanel"
const iconPanel = async () => await import(/* webpackChunkName: "iconPanel" */ 'app/plugins/panel/icon/module'); const iconPanel = async () => await import(/* webpackChunkName: "iconPanel" */ 'app/plugins/panel/icon/module');
const graphPanel = async () => await import(/* webpackChunkName: "graphPlugin" */ 'app/plugins/panel/graph/module'); const graphPanel = async () => await import(/* webpackChunkName: "graphPlugin" */ 'app/plugins/panel/graph/module');
const heatmapPanel = async () => const heatmapPanel = async () =>
await import(/* webpackChunkName: "heatmapPlugin" */ 'app/plugins/panel/heatmap/module'); await import(/* webpackChunkName: "heatmapPanel" */ 'app/plugins/panel/heatmap/module');
const heatmapPanelOLD = async () =>
await import(/* webpackChunkName: "heatmapPanelOLD" */ 'app/plugins/panel/heatmap-old/module');
const tableOldPanel = async () => const tableOldPanel = async () =>
await import(/* webpackChunkName: "tableOldPlugin" */ 'app/plugins/panel/table-old/module'); await import(/* webpackChunkName: "tableOldPlugin" */ 'app/plugins/panel/table-old/module');
// Automatically migrate heatmap panel.
if (config.featureToggles.useLegacyHeatmapPanel) {
const heatmap = config.panels['heatmap'];
const legacy = config.panels['heatmap-old'];
legacy.id = heatmap.id;
legacy.module = heatmap.module;
legacy.state = heatmap.state;
config.panels['heatmap'] = legacy;
}
delete config.panels['heatmap-old'];
const builtInPlugins: any = { const builtInPlugins: any = {
'app/plugins/datasource/graphite/module': graphitePlugin, 'app/plugins/datasource/graphite/module': graphitePlugin,
'app/plugins/datasource/cloudwatch/module': cloudwatchPlugin, 'app/plugins/datasource/cloudwatch/module': cloudwatchPlugin,
@ -112,8 +126,7 @@ const builtInPlugins: any = {
'app/plugins/panel/dashlist/module': dashListPanel, 'app/plugins/panel/dashlist/module': dashListPanel,
'app/plugins/panel/alertlist/module': alertListPanel, 'app/plugins/panel/alertlist/module': alertListPanel,
'app/plugins/panel/annolist/module': annoListPanel, 'app/plugins/panel/annolist/module': annoListPanel,
'app/plugins/panel/heatmap/module': heatmapPanel, 'app/plugins/panel/heatmap/module': config.featureToggles.useLegacyHeatmapPanel ? heatmapPanelOLD : heatmapPanel,
'app/plugins/panel/heatmap-new/module': heatmapPanelNG,
'app/plugins/panel/table/module': tablePanel, 'app/plugins/panel/table/module': tablePanel,
'app/plugins/panel/table-old/module': tableOldPanel, 'app/plugins/panel/table-old/module': tableOldPanel,
'app/plugins/panel/news/module': newsPanel, 'app/plugins/panel/news/module': newsPanel,

View File

@ -1,18 +0,0 @@
{
"type": "panel",
"name": "Heatmap (new)",
"id": "heatmap-new",
"state": "beta",
"info": {
"description": "This heatmap panel will replace the heatmap panel in 9.1",
"author": {
"name": "Grafana Labs",
"url": "https://grafana.com"
},
"logos": {
"small": "img/icn-heatmap-panel.svg",
"large": "img/icn-heatmap-panel.svg"
}
}
}

View File

@ -1,4 +1,4 @@
# Heatmap Panel (NEXT GEN) - Native Plugin # Heatmap Panel - Native Plugin
The Heatmap panel allows you to view histograms over time and is **included** with Grafana. The Heatmap panel allows you to view histograms over time and is **included** with Grafana.

View File

@ -155,6 +155,9 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this)); this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this));
this.onCardColorChange = this.onCardColorChange.bind(this); this.onCardColorChange = this.onCardColorChange.bind(this);
// Make sure we do not save the version so migration to react version is kicked off
delete this.panel.pluginVersion;
} }
onInitEditMode() { onInitEditMode() {

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,22 @@
{
"type": "panel",
"name": "Heatmap (legacy)",
"id": "heatmap-old",
"state": "deprecated",
"info": {
"description": "Legacy heatmap panel based on angular, d3, and flot",
"author": {
"name": "Grafana Labs",
"url": "https://grafana.com"
},
"logos": {
"small": "img/icn-heatmap-panel.svg",
"large": "img/icn-heatmap-panel.svg"
},
"links": [
{ "name": "Brendan Gregg - Heatmaps", "url": "http://www.brendangregg.com/heatmaps.html" },
{ "name": "Brendan Gregg - Latency Heatmaps", "url": " http://www.brendangregg.com/HeatMaps/latency.html" }
]
}
}

View File

@ -47,7 +47,7 @@ describe('Heatmap Migrations', () => {
}, },
"color": Object { "color": Object {
"exponent": 0.5, "exponent": 0.5,
"fill": "dark-orange", "fill": "#b4ff00",
"max": 100, "max": 100,
"min": 5, "min": 5,
"mode": "scheme", "mode": "scheme",

View File

@ -140,6 +140,7 @@ export function angularToReactHeatmap(angular: any): { fieldConfig: FieldConfigS
break; break;
} }
} }
options.color.fill = color.cardColor;
options.color.min = color.min; options.color.min = color.min;
options.color.max = color.max; options.color.max = color.max;

View File

@ -17,7 +17,7 @@ package grafanaschema
import "github.com/grafana/thema" import "github.com/grafana/thema"
Panel: thema.#Lineage & { Panel: thema.#Lineage & {
name: "heatmap-new" name: "heatmap"
seqs: [ seqs: [
{ {
schemas: [ schemas: [

View File

@ -12,10 +12,6 @@
"logos": { "logos": {
"small": "img/icn-heatmap-panel.svg", "small": "img/icn-heatmap-panel.svg",
"large": "img/icn-heatmap-panel.svg" "large": "img/icn-heatmap-panel.svg"
}, }
"links": [
{ "name": "Brendan Gregg - Heatmaps", "url": "http://www.brendangregg.com/heatmaps.html" },
{ "name": "Brendan Gregg - Latency Heatmaps", "url": " http://www.brendangregg.com/HeatMaps/latency.html" }
]
} }
} }

View File

@ -25,7 +25,7 @@ export class HeatmapSuggestionsSupplier {
builder.getListAppender<PanelOptions, {}>({ builder.getListAppender<PanelOptions, {}>({
name: '', name: '',
pluginId: 'heatmap-new', pluginId: 'heatmap',
options: {}, options: {},
fieldConfig: { fieldConfig: {
defaults: { defaults: {