diff --git a/Makefile b/Makefile index 79cbbca710f..dbfe41812e7 100644 --- a/Makefile +++ b/Makefile @@ -91,7 +91,7 @@ shellcheck: $(SH_FILES) ## Run checks for shell scripts. build-docker-dev: ## Build Docker image for development (fast). @echo "build development container" @echo "\033[92mInfo:\033[0m the frontend code is expected to be built already." - $(GO) run build.go -goos linux -pkg-arch amd64 ${OPT} build pkg-archive latest + $(GO) run build.go -goos linux -pkg-arch amd64 ${OPT} build latest cp dist/grafana-latest.linux-x64.tar.gz packaging/docker cd packaging/docker && docker build --tag grafana/grafana:dev . @@ -141,7 +141,7 @@ clean: ## Clean up intermediate build artifacts. rm -rf public/build # This repository's configuration is protected (https://readme.drone.io/signature/). -# Use this make target to regenerate the configuration YAML files when +# Use this make target to regenerate the configuration YAML files when # you modify starlark files. drone: drone starlark diff --git a/conf/defaults.ini b/conf/defaults.ini index c801f997c1b..acc60f6187d 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -715,6 +715,11 @@ global_session = -1 # global limit of alerts global_alert_rule = -1 +#################################### Unified Alerting #################### +[unified_alerting] +# Specify the frequency of polling for admin config changes. +admin_config_poll_interval_seconds = 60 + #################################### Alerting ############################ [alerting] # Disable alerting engine & UI features diff --git a/conf/sample.ini b/conf/sample.ini index 241f85c69c4..7c1b1ab93de 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -698,6 +698,11 @@ # global limit of alerts ;global_alert_rule = -1 +#################################### Unified Alerting #################### +[unified_alerting] +# Specify the frequency of polling for admin config changes. +;admin_config_poll_interval_seconds = 60 + #################################### Alerting ############################ [alerting] # Disable alerting engine & UI features diff --git a/contribute/style-guides/documentation-style-guide.md b/contribute/style-guides/documentation-style-guide.md index b8f6035d60f..4d07e8d3e2b 100644 --- a/contribute/style-guides/documentation-style-guide.md +++ b/contribute/style-guides/documentation-style-guide.md @@ -50,6 +50,10 @@ The following guidelines are specific to Grafana documentation. For the most par ### General +Per the [Voice and tone](https://developers.google.com/style/tone) section of the Google developer documentation style guide: + +> In your documents, aim for a voice and tone that's conversational, friendly, and respectful without being overly colloquial or frivolous; a voice that's casual and natural and approachable, not pedantic or pushy. Try to sound like a knowledgeable friend who understands what the developer wants to do. + - Use active voice: - Active: Grafana displays the heatmap visualization. - Passive: The heatmap visualization is displayed. diff --git a/cue/data/gen.cue b/cue/data/gen.cue index c70dc314874..60de8d603fa 100644 --- a/cue/data/gen.cue +++ b/cue/data/gen.cue @@ -73,7 +73,7 @@ Family: scuemata.#Family & { schemaVersion: number | *30 // Version of the dashboard, incremented each time the dashboard is updated. version?: number - panels?: [...#Panel] + panels?: [...(#Panel | #GraphPanel | #RowPanel)] // TODO docs #FieldColorModeId: "thresholds" | "palette-classic" | "palette-saturated" | "continuous-GrYlRd" | "fixed" @cuetsy(targetType="enum") @@ -191,6 +191,12 @@ Family: scuemata.#Family & { // TODO docs maxDataPoints?: number + // TODO docs + thresholds?: [...] + + // TODO docs + timeRegions?: [...] + // TODO docs // TODO tighter constraint interval?: string @@ -205,6 +211,7 @@ Family: scuemata.#Family & { // The values depend on panel type options: {...} + fieldConfig: { defaults: { // The display value for this field. This supports template variables blank is auto @@ -289,6 +296,102 @@ Family: scuemata.#Family & { }] } } + // Row panel + #RowPanel: { + type: "row" + collapsed: bool | *false + title?: string + + // Name of default datasource. + datasource?: string + + gridPos?: { + // Panel + h: number & >0 | *9 + // Panel + w: number & >0 & <=24 | *12 + // Panel x + x: number & >=0 & <24 | *0 + // Panel y + y: number & >=0 | *0 + // true if fixed + static?: bool + } + id: number + panels: [...#Panel | #GraphPanel] + } + // Support for legacy graph panels. + #GraphPanel: { + ... + type: "graph" + thresholds: [...{...}] + timeRegions: [...{...}] + // FIXME this one is quite complicated, as it duplicates the #Panel object's own structure (...?) + seriesOverrides: [...{...}] + + // TODO docs + // TODO tighter constraint + aliasColors?: [string]: string + + // TODO docs + bars: bool | *false + // TODO docs + dashes: bool | *false + // TODO docs + dashLength: number | *10 + // TODO docs + // TODO tighter constraint + fill?: number + // TODO docs + // TODO tighter constraint + fillGradient?: number + + // TODO docs + hiddenSeries: bool | *false + + // FIXME idk where this comes from, leaving it very open and very wrong for now + legend: {...} + + // TODO docs + // TODO tighter constraint + lines: bool | *false + // TODO docs + linewidth?: number + // TODO docs + nullPointMode: *"null" | "connected" | "null as zero" + // TODO docs + percentage: bool | *false + // TODO docs + points: bool | *false + // TODO docs + // FIXME this is the kind of case that makes + // optional/non-default tricky: it's optional because it + // only makes sense when points is true (right?), but if it + // is, then there actually is a default value. Easier way to + // represent this would be to wrap up this handling into a + // struct + pointradius?: number + // TODO docs + // TODO tighter constraint + renderer: string + // TODO docs + spaceLength: number | *10 + // TODO docs + stack: bool | *false + // TODO docs + steppedLine: bool | *false + // TODO docs + tooltip?: { + // TODO docs + shared?: bool + // TODO docs + sort: number | *0 + // TODO docs + // FIXME literally no idea if these values are sane + value_type: *"individual" | "cumulative" + } + + } } ] ] diff --git a/cue/ui/gen.cue b/cue/ui/gen.cue index c52a1535b66..ebd849e93b9 100644 --- a/cue/ui/gen.cue +++ b/cue/ui/gen.cue @@ -40,7 +40,7 @@ LineConfig: { lineWidth?: number lineInterpolation?: LineInterpolation lineStyle?: LineStyle - spanNulls?: bool + spanNulls?: bool | number } @cuetsy(targetType="interface") FillConfig: { fillColor?: string @@ -86,6 +86,8 @@ GraphFieldConfig: LineConfig & FillConfig & PointsConfig & AxisConfig & { VizLegendOptions: { displayMode: LegendDisplayMode placement: LegendPlacement + asTable: bool | *false + isVisible: bool | *false calcs: [...string] } @cuetsy(targetType="interface") VizTooltipOptions: { diff --git a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json index 1b0698addfc..f0da50403d6 100644 --- a/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json +++ b/devenv/dev-dashboards/datasource-elasticsearch/elasticsearch_compare.json @@ -10485,7 +10485,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -10613,7 +10613,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, diff --git a/devenv/dev-dashboards/datasource-testdata/new_features_in_v8.json b/devenv/dev-dashboards/datasource-testdata/new_features_in_v8.json index 2c476f956ca..c680c641050 100644 --- a/devenv/dev-dashboards/datasource-testdata/new_features_in_v8.json +++ b/devenv/dev-dashboards/datasource-testdata/new_features_in_v8.json @@ -259,10 +259,9 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, - "tooltip": false, - "viz": false + "tooltip": false }, "lineInterpolation": "linear", "lineWidth": 1, @@ -549,7 +548,7 @@ "fillOpacity": 74, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -665,7 +664,7 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -806,7 +805,7 @@ "fillOpacity": 50, "gradientMode": "hue", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -924,7 +923,7 @@ "fillOpacity": 40, "gradientMode": "hue", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -1042,7 +1041,7 @@ "fillOpacity": 40, "gradientMode": "hue", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -1183,12 +1182,9 @@ "barAlignment": 0, "drawStyle": "line", "fillOpacity": 10, - "gradientMode": { - "label": "None", - "value": "none" - }, + "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -1289,12 +1285,9 @@ "barAlignment": 0, "drawStyle": "line", "fillOpacity": 10, - "gradientMode": { - "label": "None", - "value": "none" - }, + "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -1399,12 +1392,9 @@ "barAlignment": 0, "drawStyle": "line", "fillOpacity": 10, - "gradientMode": { - "label": "None", - "value": "none" - }, + "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -1533,7 +1523,7 @@ "fillOpacity": 0, "gradientMode": "opacity", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -1768,12 +1758,9 @@ "barAlignment": 0, "drawStyle": "line", "fillOpacity": 0, - "gradientMode": { - "label": "None", - "value": "none" - }, + "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -2093,12 +2080,9 @@ "barAlignment": 0, "drawStyle": "line", "fillOpacity": 0, - "gradientMode": { - "label": "None", - "value": "none" - }, + "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -2420,7 +2404,7 @@ "fillOpacity": 82, "gradientMode": "hue", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, @@ -2566,7 +2550,7 @@ "fillOpacity": 80, "gradientMode": "hue", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false }, diff --git a/devenv/dev-dashboards/panel-barchart/barchart-autosizing.json b/devenv/dev-dashboards/panel-barchart/barchart-autosizing.json index 064fbb20979..8c90171d957 100644 --- a/devenv/dev-dashboards/panel-barchart/barchart-autosizing.json +++ b/devenv/dev-dashboards/panel-barchart/barchart-autosizing.json @@ -35,7 +35,6 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, "legend": false, "tooltip": false, "viz": false @@ -106,7 +105,6 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, "legend": false, "tooltip": false, "viz": false @@ -177,7 +175,6 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, "legend": false, "tooltip": false, "viz": false @@ -247,7 +244,6 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, "legend": false, "tooltip": false, "viz": false @@ -318,7 +314,6 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, "legend": false, "tooltip": false, "viz": false @@ -388,7 +383,6 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, "legend": false, "tooltip": false, "viz": false @@ -460,7 +454,6 @@ "fillOpacity": 80, "gradientMode": "none", "hideFrom": { - "graph": false, "legend": false, "tooltip": false, "viz": false diff --git a/devenv/dev-dashboards/panel-graph/graph-ng-by-value-color-schemes.json b/devenv/dev-dashboards/panel-graph/graph-ng-by-value-color-schemes.json index 29e6d92cc0c..65f44b9ba88 100644 --- a/devenv/dev-dashboards/panel-graph/graph-ng-by-value-color-schemes.json +++ b/devenv/dev-dashboards/panel-graph/graph-ng-by-value-color-schemes.json @@ -1,583 +1,862 @@ { - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], "type": "dashboard" - } - ] - }, - "editable": true, - "graphTooltip": 0, - "links": [], - "panels": [ - { - "datasource": "-- Dashboard --", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 5, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "max": 50, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "orange", - "value": 20 - }, - { - "color": "red", - "value": 30 - } - ] - }, - "unit": "degree" - }, - "overrides": [] }, - "gridPos": { - "h": 7, - "w": 11, - "x": 0, - "y": 0 - }, - "id": 9, - "maxDataPoints": 45, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single" - } - }, - "targets": [ - { - "panelId": 4, - "refId": "A" - } - ], - "title": "Color line by discrete tresholds", - "type": "timeseries" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 84, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 0, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "max": 50, - "min": 0, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "orange", - "value": 20 - }, - { - "color": "red", - "value": 30 - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 7, - "w": 13, - "x": 11, - "y": 0 - }, - "id": 4, - "interval": "80s", - "maxDataPoints": 42, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single" - } - }, - "targets": [ - { - "max": 40, - "min": 0, - "noise": 1, - "refId": "A", - "scenarioId": "random_walk", - "spread": 20, - "startValue": 1 - } - ], - "title": "Color bars by discrete thresholds", - "type": "timeseries" - }, - { - "datasource": "-- Dashboard --", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "max": 50, - "min": 1, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue" - }, - { - "color": "green", - "value": 0 - }, - { - "color": "orange", - "value": 20 - }, - { - "color": "red", - "value": 30 - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 11, - "x": 0, - "y": 7 - }, - "id": 6, - "maxDataPoints": 50, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single" - } - }, - "targets": [ - { - "panelId": 4, - "refId": "A" - } - ], - "title": "Color line by color scale", - "type": "timeseries" - }, - { - "datasource": "-- Dashboard --", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 64, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "max": 50, - "min": 1, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue" - }, - { - "color": "green", - "value": 0 - }, - { - "color": "orange", - "value": 20 - }, - { - "color": "red", - "value": 30 - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 13, - "x": 11, - "y": 7 - }, - "id": 10, - "maxDataPoints": 45, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single" - } - }, - "targets": [ - { - "panelId": 4, - "refId": "A" - } - ], - "title": "Color bars by color scale", - "type": "timeseries" - }, - { - "datasource": "-- Dashboard --", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 64, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "max": 50, - "min": 1, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue" - }, - { - "color": "green", - "value": 0 - }, - { - "color": "orange", - "value": 20 - }, - { - "color": "red", - "value": 30 - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 24, - "x": 0, - "y": 15 - }, - "id": 7, - "maxDataPoints": 50, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single" - } - }, - "targets": [ - { - "panelId": 4, - "refId": "A" - } - ], - "title": "Color line by color scale", - "type": "timeseries" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-GrYlRd" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "points", - "fillOpacity": 10, - "gradientMode": "scheme", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "smooth", - "lineWidth": 3, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "max": 50, - "min": 1, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "blue" - }, - { - "color": "green", - "value": 0 - }, - { - "color": "orange", - "value": 20 - }, - { - "color": "red", - "value": 30 - } - ] - }, - "unit": "degree" - }, - "overrides": [] - }, - "gridPos": { - "h": 13, - "w": 24, - "x": 0, - "y": 21 - }, - "id": 8, - "maxDataPoints": 250, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single" - } - }, - "targets": [ - { - "max": 45, - "min": 20, - "noise": 0, - "refId": "A", - "scenarioId": "random_walk", - "spread": 12, - "startValue": 40 - }, - { - "hide": false, - "max": 20, - "min": 1, - "noise": 0, - "refId": "B", - "scenarioId": "random_walk", - "spread": 10 - } - ], - "title": "Color line by color scale", - "type": "timeseries" + "type": "dashboard" } - ], - "refresh": false, - "schemaVersion": 30, - "style": "dark", - "tags": [ - "gdev", - "panel-tests" - ], - "templating": { - "list": [] + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 37, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 3, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 15 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 0, + "y": 0 + }, + "id": 11, + "maxDataPoints": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "hidden", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "refId": "A", + "scenarioId": "csv_metric_values", + "stringInput": "1,10,20,30,40,50" + } + ], + "title": "15 orange, 30 red", + "type": "timeseries" }, - "time": { - "from": "now-6h", - "to": "now" + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 37, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 3, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 20, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 15 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 8, + "y": 0 + }, + "id": 12, + "maxDataPoints": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "refId": "A", + "scenarioId": "csv_metric_values", + "stringInput": "1,10,20,30,40,50" + } + ], + "title": "15 orange, 30 red", + "type": "timeseries" }, - "timepicker": {}, - "timezone": "", - "title": "Panel Tests - Graph NG - By value color schemes", - "uid": "aBXrJ0R7z", - "version": 20 - } + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 37, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 20, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 15 + }, + { + "color": "red", + "value": 50 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 8, + "x": 16, + "y": 0 + }, + "id": 13, + "maxDataPoints": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "refId": "A", + "scenarioId": "csv_metric_values", + "stringInput": "1,10,20,30,40,50" + } + ], + "title": "15 orange, 50 red", + "type": "timeseries" + }, + { + "datasource": "-- Dashboard --", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 5, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 3, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 20 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 7 + }, + "id": 9, + "maxDataPoints": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "panelId": 4, + "refId": "A" + } + ], + "title": "Color line by discrete tresholds", + "type": "timeseries" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 84, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 0, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 20 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 7 + }, + "id": 4, + "interval": "80s", + "maxDataPoints": 42, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "max": 40, + "min": 0, + "noise": 1, + "refId": "A", + "scenarioId": "random_walk", + "spread": 20, + "startValue": 1 + } + ], + "timeFrom": null, + "title": "Color bars by discrete thresholds", + "type": "timeseries" + }, + { + "datasource": "-- Dashboard --", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 3, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + }, + { + "color": "green", + "value": 0 + }, + { + "color": "orange", + "value": 20 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 14 + }, + "id": 6, + "maxDataPoints": 50, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "panelId": 4, + "refId": "A" + } + ], + "title": "Color line by color scale", + "type": "timeseries" + }, + { + "datasource": "-- Dashboard --", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 64, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + }, + { + "color": "green", + "value": 0 + }, + { + "color": "orange", + "value": 20 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 14 + }, + "id": 10, + "maxDataPoints": 45, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "panelId": 4, + "refId": "A" + } + ], + "title": "Color bars by color scale", + "type": "timeseries" + }, + { + "datasource": "-- Dashboard --", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 64, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + }, + { + "color": "green", + "value": 0 + }, + { + "color": "orange", + "value": 20 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 0, + "y": 21 + }, + "id": 7, + "maxDataPoints": 50, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "panelId": 4, + "refId": "A" + } + ], + "title": "Color line by color scale", + "type": "timeseries" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-GrYlRd" + }, + "custom": { + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "points", + "fillOpacity": 10, + "gradientMode": "scheme", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 3, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "max": 50, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + }, + { + "color": "green", + "value": 0 + }, + { + "color": "orange", + "value": 20 + }, + { + "color": "red", + "value": 30 + } + ] + }, + "unit": "degree" + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 12, + "x": 12, + "y": 21 + }, + "id": 8, + "maxDataPoints": 250, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "single" + } + }, + "targets": [ + { + "max": 45, + "min": 20, + "noise": 0, + "refId": "A", + "scenarioId": "random_walk", + "spread": 12, + "startValue": 40 + }, + { + "hide": false, + "max": 20, + "min": 1, + "noise": 0, + "refId": "B", + "scenarioId": "random_walk", + "spread": 10 + } + ], + "title": "Color line by color scale", + "type": "timeseries" + } + ], + "refresh": false, + "schemaVersion": 30, + "style": "dark", + "tags": [ + "gdev", + "panel-tests" + ], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Panel Tests - Graph NG - By value color schemes", + "uid": "aBXrJ0R7z", + "version": 11 +} \ No newline at end of file diff --git a/devenv/dev-dashboards/panel-graph/graph-ng-nulls.json b/devenv/dev-dashboards/panel-graph/graph-ng-nulls.json index 1914a99e80d..8e322fbf316 100644 --- a/devenv/dev-dashboards/panel-graph/graph-ng-nulls.json +++ b/devenv/dev-dashboards/panel-graph/graph-ng-nulls.json @@ -42,7 +42,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -149,7 +149,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -265,7 +265,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -400,7 +400,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -507,7 +507,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -623,7 +623,7 @@ "fillOpacity": 0, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -758,7 +758,7 @@ "fillOpacity": 10, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -902,7 +902,7 @@ "fillOpacity": 10, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false @@ -1045,7 +1045,7 @@ "fillOpacity": 10, "gradientMode": "none", "hideFrom": { - "graph": false, + "viz": false, "legend": false, "tooltip": false, "viz": false diff --git a/devenv/dev-dashboards/transforms/config-from-query.json b/devenv/dev-dashboards/transforms/config-from-query.json index 2139b024fb6..af802508422 100644 --- a/devenv/dev-dashboards/transforms/config-from-query.json +++ b/devenv/dev-dashboards/transforms/config-from-query.json @@ -49,10 +49,6 @@ }, "showPoints": "auto", "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, "thresholdsStyle": { "mode": "line" } diff --git a/devenv/docker/blocks/influxdb1/docker-compose.yaml b/devenv/docker/blocks/influxdb1/docker-compose.yaml index 39737522937..5a680117a2f 100644 --- a/devenv/docker/blocks/influxdb1/docker-compose.yaml +++ b/devenv/docker/blocks/influxdb1/docker-compose.yaml @@ -1,5 +1,5 @@ influxdb1: - image: influxdb:1.8.6 + image: influxdb:1.8 container_name: influxdb1 ports: - '2004:2004' diff --git a/docs/sources/administration/configuration.md b/docs/sources/administration/configuration.md index 04d54ca2a00..6c30f4ffe12 100644 --- a/docs/sources/administration/configuration.md +++ b/docs/sources/administration/configuration.md @@ -1099,6 +1099,16 @@ Sets a global limit on number of alert rules that can be created. Default is -1
+## [unified_alerting] + +For more information about the Unified Alerting feature in Grafana, refer to [Unified Alerting]({{< relref "../unified-alerting/_index.md" >}}}). + +### admin_config_poll_interval_seconds + +Specify the frequency of polling for admin config changes. The default value is `60`. + +
+ ## [alerting] For more information about the Alerting feature in Grafana, refer to [Alerts overview]({{< relref "../alerting/_index.md" >}}). diff --git a/docs/sources/alerting/old-alerting/notifications.md b/docs/sources/alerting/old-alerting/notifications.md index ad4585dc048..ea83231cb40 100644 --- a/docs/sources/alerting/old-alerting/notifications.md +++ b/docs/sources/alerting/old-alerting/notifications.md @@ -147,6 +147,8 @@ To set up PagerDuty, all you have to do is to provide an integration key. > **Note:** The `state` tag overrides the current alert state inside the `custom_details` payload. +> **Note:** Grafana uses the `Events API V2` integration. This can be configured for each service. + ### VictorOps To configure VictorOps, provide the URL from the Grafana Integration and substitute `$routing_key` with a valid key. diff --git a/docs/sources/developers/plugins/build-a-streaming-data-source-plugin.md b/docs/sources/developers/plugins/build-a-streaming-data-source-plugin.md index 8bf01cf26c7..4f75333e34b 100644 --- a/docs/sources/developers/plugins/build-a-streaming-data-source-plugin.md +++ b/docs/sources/developers/plugins/build-a-streaming-data-source-plugin.md @@ -120,6 +120,7 @@ query(options: DataQueryRequest): Observable { subscriber.next({ data: [frame], key: query.refId, + state: LoadingState.Streaming, }); }, 100); diff --git a/docs/sources/developers/plugins/sign-a-plugin.md b/docs/sources/developers/plugins/sign-a-plugin.md index 8cbc70c615a..5e0623f0245 100644 --- a/docs/sources/developers/plugins/sign-a-plugin.md +++ b/docs/sources/developers/plugins/sign-a-plugin.md @@ -26,7 +26,7 @@ To verify ownership of your plugin, you need to generate an API key that you'll You can find the plugin ID in the `plugin.json` file inside your plugin directory. For example, if your account slug is `acmecorp`, you need to prefix the plugin ID with `acmecorp-`. -1. [Create a Grafana Cloud API key](https://grafana.com/docs/grafana-cloud/cloud-portal/create-api-key/) with the **PluginPublisher** role. +1. [Create a Grafana Cloud API key](https://grafana.com/docs/grafana-cloud/reference/create-api-key/) with the **PluginPublisher** role. ## Sign a public plugin diff --git a/docs/sources/variables/variable-types/add-custom-variable.md b/docs/sources/variables/variable-types/add-custom-variable.md index d6eb46275a8..846e6269cec 100644 --- a/docs/sources/variables/variable-types/add-custom-variable.md +++ b/docs/sources/variables/variable-types/add-custom-variable.md @@ -6,7 +6,7 @@ weight = 200 # Add a custom variable -Use a _custom_ variable for values that do not change. This might be numbers, strings, or even other variables. +Use a _custom_ variable for a value that does not change, such as a number or a string. For example, if you have server names or region names that never change, then you might want to create them as custom variables rather than query variables. Because they do not change, you might use them in [chained variables]({{< relref "chained-variables.md" >}}) rather than other query variables. That would reduce the number of queries Grafana must send when chained variables are updated. @@ -24,7 +24,7 @@ For example, if you have server names or region names that never change, then yo ## Enter Custom Options -1. In the **Values separated by comma** list, enter the values for this variable in a comma-separated list. You can include numbers, strings, other variables or key/value pairs separated by a space and a colon, i.e. `key1 : value1,key2 : value2`. +1. In the **Values separated by comma** list, enter the values for this variable in a comma-separated list. You can include numbers, strings, or key/value pairs separated by a space and a colon. For example, `key1 : value1,key2 : value2`. 1. (optional) Enter [Selection Options]({{< relref "../variable-selection-options.md" >}}). 1. In **Preview of values**, Grafana displays a list of the current variable values. Review them to ensure they match what you expect. 1. Click **Add** to add the variable to the dashboard. diff --git a/go.mod b/go.mod index 21860ef28b9..e4e80a99102 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,7 @@ require ( github.com/gorilla/websocket v1.4.2 github.com/gosimple/slug v1.9.0 github.com/grafana/grafana-aws-sdk v0.7.0 - github.com/grafana/grafana-plugin-sdk-go v0.111.0 + github.com/grafana/grafana-plugin-sdk-go v0.112.0 github.com/grafana/loki v1.6.2-0.20210520072447-15d417efe103 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/hashicorp/go-hclog v0.16.1 @@ -67,6 +67,7 @@ require ( github.com/laher/mergefs v0.1.1 github.com/lib/pq v1.10.0 github.com/linkedin/goavro/v2 v2.10.0 + github.com/m3db/prometheus_remote_client_golang v0.4.4 // indirect github.com/magefile/mage v1.11.0 github.com/mattn/go-isatty v0.0.12 github.com/mattn/go-sqlite3 v1.14.7 diff --git a/go.sum b/go.sum index 796a32b4d37..6519e029347 100644 --- a/go.sum +++ b/go.sum @@ -995,6 +995,8 @@ github.com/grafana/grafana-aws-sdk v0.7.0/go.mod h1:+pPo5U+pX0zWimR7YBc7ASeSQfbR github.com/grafana/grafana-plugin-sdk-go v0.79.0/go.mod h1:NvxLzGkVhnoBKwzkst6CFfpMFKwAdIUZ1q8ssuLeF60= github.com/grafana/grafana-plugin-sdk-go v0.111.0 h1:7eqLgAdDYeELVokRCeDEobYQJy5/E5C43tZkb/xH66Q= github.com/grafana/grafana-plugin-sdk-go v0.111.0/go.mod h1:D7x3ah+1d4phNXpbnOaxa/osSaZlwh9/ZUnGGzegRbk= +github.com/grafana/grafana-plugin-sdk-go v0.112.0 h1:c+3kKJQ1wVZ5pMSF40eUizB5YzGPAbO+2QG0CJ3d4bI= +github.com/grafana/grafana-plugin-sdk-go v0.112.0/go.mod h1:D7x3ah+1d4phNXpbnOaxa/osSaZlwh9/ZUnGGzegRbk= github.com/grafana/loki v1.6.2-0.20210520072447-15d417efe103 h1:qCmofFVwQR9QnsinstVqI1NPLMVl33jNCnOCXEAVn6E= github.com/grafana/loki v1.6.2-0.20210520072447-15d417efe103/go.mod h1:GHIsn+EohCChsdu5YouNZewqLeV9L2FNw4DEJU3P9qE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -1327,6 +1329,8 @@ github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1 github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/lufia/iostat v1.1.0/go.mod h1:rEPNA0xXgjHQjuI5Cy05sLlS2oRcSlWHRLrvh/AQ+Pg= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= +github.com/m3db/prometheus_remote_client_golang v0.4.4 h1:DsAIjVKoCp7Ym35tAOFL1OuMLIdIikAEHeNPHY+yyM8= +github.com/m3db/prometheus_remote_client_golang v0.4.4/go.mod h1:wHfVbA3eAK6dQvKjCkHhusWYegCk3bDGkA15zymSHdc= github.com/magefile/mage v1.9.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/magefile/mage v1.10.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls= diff --git a/package.json b/package.json index 95c0efaa940..1e8776c1167 100644 --- a/package.json +++ b/package.json @@ -183,7 +183,7 @@ "mutationobserver-shim": "0.3.3", "ngtemplate-loader": "2.0.1", "nodemon": "2.0.2", - "optimize-css-assets-webpack-plugin": "5.0.4", + "optimize-css-assets-webpack-plugin": "5.0.5", "postcss-browser-reporter": "0.6.0", "postcss-loader": "3.0.0", "postcss-reporter": "6.0.1", @@ -221,6 +221,9 @@ "@emotion/react": "11.1.5", "@grafana/aws-sdk": "0.0.3", "@grafana/slate-react": "0.22.10-grafana", + "@opentelemetry/api": "1.0.2", + "@opentelemetry/exporter-collector": "0.23.0", + "@opentelemetry/semantic-conventions": "0.23.0", "@popperjs/core": "2.5.4", "@reduxjs/toolkit": "1.5.0", "@sentry/browser": "5.25.0", @@ -265,12 +268,9 @@ "mousetrap": "1.6.5", "mousetrap-global-bind": "1.1.0", "ol": "^6.5.0", - "@opentelemetry/api": "1.0.2", - "@opentelemetry/exporter-collector": "0.23.0", - "@opentelemetry/semantic-conventions": "0.23.0", "papaparse": "5.3.0", "pluralize": "^8.0.0", - "prismjs": "1.23.0", + "prismjs": "1.24.0", "prop-types": "15.7.2", "rc-cascader": "1.0.1", "re-resizable": "^6.2.0", diff --git a/packages/grafana-data/src/themes/colorManipulator.ts b/packages/grafana-data/src/themes/colorManipulator.ts index b76552ed0c1..af7a22d3e80 100644 --- a/packages/grafana-data/src/themes/colorManipulator.ts +++ b/packages/grafana-data/src/themes/colorManipulator.ts @@ -255,6 +255,10 @@ export function emphasize(color: string, coefficient = 0.15) { * @beta */ export function alpha(color: string, value: number) { + if (color === '') { + return '#000000'; + } + value = clamp(value); // hex 6, hex 8 (w/alpha) diff --git a/packages/grafana-data/src/transformations/transformers/ensureColumns.ts b/packages/grafana-data/src/transformations/transformers/ensureColumns.ts index b8068ce3094..5b7f20511de 100644 --- a/packages/grafana-data/src/transformations/transformers/ensureColumns.ts +++ b/packages/grafana-data/src/transformations/transformers/ensureColumns.ts @@ -1,33 +1,28 @@ -import { of } from 'rxjs'; - import { seriesToColumnsTransformer } from './seriesToColumns'; import { DataFrame } from '../../types/dataFrame'; import { getTimeField } from '../../dataframe/processDataFrame'; -import { DataTransformerInfo } from '../../types/transformations'; +import { SynchronousDataTransformerInfo } from '../../types/transformations'; import { DataTransformerID } from './ids'; -import { mergeMap } from 'rxjs/operators'; +import { map } from 'rxjs/operators'; -export const ensureColumnsTransformer: DataTransformerInfo = { +export const ensureColumnsTransformer: SynchronousDataTransformerInfo = { id: DataTransformerID.ensureColumns, name: 'Ensure Columns Transformer', description: 'Will check if current data frames is series or columns. If in series it will convert to columns.', - operator: (options = {}) => (source) => - source.pipe( - mergeMap((data) => { - // Assume timeseries should first be joined by time - const timeFieldName = findConsistentTimeFieldName(data); - if (data.length > 1 && timeFieldName) { - return of(data).pipe( - seriesToColumnsTransformer.operator({ - byField: timeFieldName, - }) - ); - } + operator: (options) => (source) => source.pipe(map((data) => ensureColumnsTransformer.transformer(options)(data))), - return of(data); - }) - ), + transformer: (options: any) => (frames: DataFrame[]) => { + // Assume timeseries should first be joined by time + const timeFieldName = findConsistentTimeFieldName(frames); + + if (frames.length > 1 && timeFieldName) { + return seriesToColumnsTransformer.transformer({ + byField: timeFieldName, + })(frames); + } + return frames; + }, }; /** diff --git a/packages/grafana-data/src/transformations/transformers/histogram.ts b/packages/grafana-data/src/transformations/transformers/histogram.ts index a28aeaf88f9..0e8b2c1da88 100644 --- a/packages/grafana-data/src/transformations/transformers/histogram.ts +++ b/packages/grafana-data/src/transformations/transformers/histogram.ts @@ -1,4 +1,4 @@ -import { DataTransformerInfo } from '../../types'; +import { SynchronousDataTransformerInfo } from '../../types'; import { map } from 'rxjs/operators'; import { DataTransformerID } from './ids'; @@ -73,7 +73,7 @@ export const histogramFieldInfo = { /** * @alpha */ -export const histogramTransformer: DataTransformerInfo = { +export const histogramTransformer: SynchronousDataTransformerInfo = { id: DataTransformerID.histogram, name: 'Histogram', description: 'Calculate a histogram from input data', @@ -81,23 +81,18 @@ export const histogramTransformer: DataTransformerInfo (source) => - source.pipe( - map((data) => { - if (!Array.isArray(data) || data.length === 0) { - return data; - } - const hist = buildHistogram(data, options); - if (hist == null) { - return []; - } - return [histogramFieldsToFrame(hist)]; - }) - ), + operator: (options) => (source) => source.pipe(map((data) => histogramTransformer.transformer(options)(data))), + + transformer: (options: HistogramTransformerOptions) => (data: DataFrame[]) => { + if (!Array.isArray(data) || data.length === 0) { + return data; + } + const hist = buildHistogram(data, options); + if (hist == null) { + return []; + } + return [histogramFieldsToFrame(hist)]; + }, }; /** diff --git a/packages/grafana-data/src/transformations/transformers/seriesToColumns.ts b/packages/grafana-data/src/transformations/transformers/seriesToColumns.ts index 07acaf87a2f..08170d1192b 100644 --- a/packages/grafana-data/src/transformations/transformers/seriesToColumns.ts +++ b/packages/grafana-data/src/transformations/transformers/seriesToColumns.ts @@ -1,6 +1,6 @@ import { map } from 'rxjs/operators'; -import { DataTransformerInfo, FieldMatcher } from '../../types'; +import { DataFrame, SynchronousDataTransformerInfo, FieldMatcher } from '../../types'; import { DataTransformerID } from './ids'; import { outerJoinDataFrames } from './joinDataFrames'; import { fieldMatchers } from '../matchers'; @@ -10,27 +10,29 @@ export interface SeriesToColumnsOptions { byField?: string; // empty will pick the field automatically } -export const seriesToColumnsTransformer: DataTransformerInfo = { +export const seriesToColumnsTransformer: SynchronousDataTransformerInfo = { id: DataTransformerID.seriesToColumns, name: 'Series as columns', // Called 'Outer join' in the UI! description: 'Groups series by field and returns values as columns', defaultOptions: { byField: undefined, // DEFAULT_KEY_FIELD, }, - operator: (options) => (source) => - source.pipe( - map((data) => { - if (data.length > 1) { - let joinBy: FieldMatcher | undefined = undefined; - if (options.byField) { - joinBy = fieldMatchers.get(FieldMatcherID.byName).get(options.byField); - } - const joined = outerJoinDataFrames({ frames: data, joinBy }); - if (joined) { - return [joined]; - } + + operator: (options) => (source) => source.pipe(map((data) => seriesToColumnsTransformer.transformer(options)(data))), + + transformer: (options: SeriesToColumnsOptions) => { + let joinBy: FieldMatcher | undefined = undefined; + return (data: DataFrame[]) => { + if (data.length > 1) { + if (options.byField && !joinBy) { + joinBy = fieldMatchers.get(FieldMatcherID.byName).get(options.byField); } - return data; - }) - ), + const joined = outerJoinDataFrames({ frames: data, joinBy }); + if (joined) { + return [joined]; + } + } + return data; + }; + }, }; diff --git a/packages/grafana-data/src/types/transformations.ts b/packages/grafana-data/src/types/transformations.ts index c1ad5995f61..b7a018093d7 100644 --- a/packages/grafana-data/src/types/transformations.ts +++ b/packages/grafana-data/src/types/transformations.ts @@ -5,6 +5,8 @@ import { RegistryItemWithOptions } from '../utils/Registry'; /** * Function that transform data frames (AKA transformer) + * + * @public */ export interface DataTransformerInfo extends RegistryItemWithOptions { /** @@ -14,6 +16,19 @@ export interface DataTransformerInfo extends RegistryItemWithOpt operator: (options: TOptions) => MonoTypeOperatorFunction; } +/** + * Many transformations can be called with a simple synchronous function. + * When a transformer is defined, it should have identical behavior to using the operator + * + * @public + */ +export interface SynchronousDataTransformerInfo extends DataTransformerInfo { + transformer: (options: TOptions) => (frames: DataFrame[]) => DataFrame[]; +} + +/** + * @public + */ export interface DataTransformerConfig { /** * Unique identifier of transformer diff --git a/packages/grafana-e2e-selectors/src/selectors/components.ts b/packages/grafana-e2e-selectors/src/selectors/components.ts index d032d9c5b74..a0cbd81cfd0 100644 --- a/packages/grafana-e2e-selectors/src/selectors/components.ts +++ b/packages/grafana-e2e-selectors/src/selectors/components.ts @@ -44,7 +44,7 @@ export const Components = { }, Panels: { Panel: { - title: (title: string) => `Panel header ${title}`, + title: (title: string) => `data-testid Panel header ${title}`, headerItems: (item: string) => `Panel header item ${item}`, containerByTitle: (title: string) => `${title} panel`, headerCornerInfo: (mode: string) => `Panel header ${mode}`, diff --git a/packages/grafana-toolkit/src/cli/tasks/plugin/bundle.ts b/packages/grafana-toolkit/src/cli/tasks/plugin/bundle.ts index 7fca11963d2..0527a3924f5 100644 --- a/packages/grafana-toolkit/src/cli/tasks/plugin/bundle.ts +++ b/packages/grafana-toolkit/src/cli/tasks/plugin/bundle.ts @@ -57,17 +57,19 @@ export const bundlePlugin = async ({ watch, production, preserveConsole }: Plugi } else { compiler.run((err: Error, stats: webpack.Stats) => { if (err) { - reject(err.message); - + reject(err); return; } + if (stats.hasErrors()) { stats.compilation.errors.forEach((e) => { console.log(e.message); }); reject('Build failed'); + return; } + console.log('\n', stats.toString({ colors: true }), '\n'); resolve(); }); diff --git a/packages/grafana-toolkit/src/cli/utils/useSpinner.ts b/packages/grafana-toolkit/src/cli/utils/useSpinner.ts index 193778bc2a4..a80df432f52 100644 --- a/packages/grafana-toolkit/src/cli/utils/useSpinner.ts +++ b/packages/grafana-toolkit/src/cli/utils/useSpinner.ts @@ -11,7 +11,8 @@ export const useSpinner = async (label: string, fn: () => Promise, killProc if (err.stdout) { console.error(err.stdout); - } else { + } else if (err.message) { + // Return stack trace if error object console.trace(err); // eslint-disable-line no-console } diff --git a/packages/grafana-ui/package.json b/packages/grafana-ui/package.json index 8691a9d012b..2324276eb4d 100644 --- a/packages/grafana-ui/package.json +++ b/packages/grafana-ui/package.json @@ -74,7 +74,7 @@ "react-transition-group": "4.4.1", "slate": "0.47.8", "tinycolor2": "1.4.1", - "uplot": "1.6.14" + "uplot": "1.6.15" }, "devDependencies": { "@rollup/plugin-commonjs": "16.0.0", diff --git a/packages/grafana-ui/src/components/OptionsUI/multiSelect.tsx b/packages/grafana-ui/src/components/OptionsUI/multiSelect.tsx index 627539fd2dc..c6d45a53d87 100644 --- a/packages/grafana-ui/src/components/OptionsUI/multiSelect.tsx +++ b/packages/grafana-ui/src/components/OptionsUI/multiSelect.tsx @@ -59,6 +59,7 @@ export class MultiSelectValueEditor extends React.PureComponent, Sta const { settings } = item; return ( + menuShouldPortal isLoading={isLoading} value={value} defaultValue={value} diff --git a/packages/grafana-ui/src/components/OptionsUI/select.tsx b/packages/grafana-ui/src/components/OptionsUI/select.tsx index 3023c30f480..ac45c393c91 100644 --- a/packages/grafana-ui/src/components/OptionsUI/select.tsx +++ b/packages/grafana-ui/src/components/OptionsUI/select.tsx @@ -62,6 +62,7 @@ export class SelectValueEditor extends React.PureComponent, State } return ( + menuShouldPortal isLoading={isLoading} value={current} defaultValue={value} diff --git a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx index 86c41af1c10..ddb1212f7be 100644 --- a/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx +++ b/packages/grafana-ui/src/components/PageLayout/PageToolbar.tsx @@ -63,7 +63,7 @@ export const PageToolbar: FC = React.memo( /> )} -