@intentius/chant-lexicon-grafana 0.98.0 → 0.100.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -8
- package/dist/actions/grafana.d.ts +24 -0
- package/dist/actions/grafana.d.ts.map +1 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/alerting-build.d.ts +128 -0
- package/dist/alerting-build.d.ts.map +1 -0
- package/dist/alerting.d.ts +273 -0
- package/dist/alerting.d.ts.map +1 -0
- package/dist/annotations.d.ts +61 -0
- package/dist/annotations.d.ts.map +1 -0
- package/dist/api/apply.d.ts +160 -0
- package/dist/api/apply.d.ts.map +1 -0
- package/dist/api/bind.d.ts +32 -0
- package/dist/api/bind.d.ts.map +1 -0
- package/dist/api/client.d.ts +76 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/converge.d.ts +33 -0
- package/dist/api/converge.d.ts.map +1 -0
- package/dist/api/dashboards.d.ts +102 -0
- package/dist/api/dashboards.d.ts.map +1 -0
- package/dist/api/datasources.d.ts +26 -0
- package/dist/api/datasources.d.ts.map +1 -0
- package/dist/api/fake-grafana-writes.d.ts +41 -0
- package/dist/api/fake-grafana-writes.d.ts.map +1 -0
- package/dist/api/fake-grafana.d.ts +63 -0
- package/dist/api/fake-grafana.d.ts.map +1 -0
- package/dist/api/folders.d.ts +146 -0
- package/dist/api/folders.d.ts.map +1 -0
- package/dist/api/library-panels.d.ts +52 -0
- package/dist/api/library-panels.d.ts.map +1 -0
- package/dist/build.d.ts +55 -6
- package/dist/build.d.ts.map +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/codegen/generate.d.ts +7 -1
- package/dist/codegen/generate.d.ts.map +1 -1
- package/dist/codegen/schema-types.d.ts +3 -3
- package/dist/codegen/schema-types.d.ts.map +1 -1
- package/dist/composites/agent-dashboard.d.ts.map +1 -1
- package/dist/composites/catalog.d.ts.map +1 -1
- package/dist/composites/index.d.ts +4 -2
- package/dist/composites/index.d.ts.map +1 -1
- package/dist/composites/red-dashboard.d.ts +21 -2
- package/dist/composites/red-dashboard.d.ts.map +1 -1
- package/dist/composites/shared.d.ts +11 -3
- package/dist/composites/shared.d.ts.map +1 -1
- package/dist/composites/slo-alert-rules.d.ts +92 -0
- package/dist/composites/slo-alert-rules.d.ts.map +1 -0
- package/dist/config.d.ts +111 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/contact-point-secrets.d.ts +17 -0
- package/dist/contact-point-secrets.d.ts.map +1 -0
- package/dist/dashboard.d.ts +51 -9
- package/dist/dashboard.d.ts.map +1 -1
- package/dist/datasource-refs.d.ts +99 -0
- package/dist/datasource-refs.d.ts.map +1 -0
- package/dist/datasource-settings.d.ts +834 -0
- package/dist/datasource-settings.d.ts.map +1 -0
- package/dist/datasource.d.ts +82 -11
- package/dist/datasource.d.ts.map +1 -1
- package/dist/deep-observe-hooks.d.ts +64 -0
- package/dist/deep-observe-hooks.d.ts.map +1 -0
- package/dist/deep-observe.d.ts +47 -0
- package/dist/deep-observe.d.ts.map +1 -0
- package/dist/describe-resources.d.ts +50 -0
- package/dist/describe-resources.d.ts.map +1 -0
- package/dist/detect.d.ts +32 -3
- package/dist/detect.d.ts.map +1 -1
- package/dist/export-resources.d.ts +38 -0
- package/dist/export-resources.d.ts.map +1 -0
- package/dist/folder.d.ts +68 -0
- package/dist/folder.d.ts.map +1 -0
- package/dist/import/alerting.d.ts +40 -0
- package/dist/import/alerting.d.ts.map +1 -0
- package/dist/import/edits.d.ts +47 -0
- package/dist/import/edits.d.ts.map +1 -0
- package/dist/import/embedded.d.ts +14 -0
- package/dist/import/embedded.d.ts.map +1 -0
- package/dist/import/generator.d.ts +60 -0
- package/dist/import/generator.d.ts.map +1 -0
- package/dist/import/live-export.d.ts +108 -0
- package/dist/import/live-export.d.ts.map +1 -0
- package/dist/import/mappings.d.ts +89 -0
- package/dist/import/mappings.d.ts.map +1 -0
- package/dist/import/model.d.ts +105 -0
- package/dist/import/model.d.ts.map +1 -0
- package/dist/import/normalize-alerting.d.ts +26 -0
- package/dist/import/normalize-alerting.d.ts.map +1 -0
- package/dist/import/normalize.d.ts +74 -0
- package/dist/import/normalize.d.ts.map +1 -0
- package/dist/import/parser.d.ts +125 -0
- package/dist/import/parser.d.ts.map +1 -0
- package/dist/import/report.d.ts +26 -0
- package/dist/import/report.d.ts.map +1 -0
- package/dist/import/testdata/fixtures.d.ts +41 -0
- package/dist/import/testdata/fixtures.d.ts.map +1 -0
- package/dist/import/v2.d.ts +73 -0
- package/dist/import/v2.d.ts.map +1 -0
- package/dist/index.d.ts +31 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/init-templates.d.ts +27 -0
- package/dist/init-templates.d.ts.map +1 -0
- package/dist/integrity.json +22 -12
- package/dist/k8s.d.ts +107 -0
- package/dist/k8s.d.ts.map +1 -0
- package/dist/lint/audit-catalog.d.ts +2 -1
- package/dist/lint/audit-catalog.d.ts.map +1 -1
- package/dist/lint/post-synth/graf101.d.ts +2 -2
- package/dist/lint/post-synth/graf102.d.ts +1 -1
- package/dist/lint/post-synth/graf104.d.ts +2 -2
- package/dist/lint/post-synth/graf106.d.ts +2 -2
- package/dist/lint/post-synth/graf107.d.ts +1 -1
- package/dist/lint/post-synth/graf108.d.ts +8 -0
- package/dist/lint/post-synth/graf108.d.ts.map +1 -0
- package/dist/lint/post-synth/graf109.d.ts +8 -0
- package/dist/lint/post-synth/graf109.d.ts.map +1 -0
- package/dist/lint/post-synth/graf110.d.ts +8 -0
- package/dist/lint/post-synth/graf110.d.ts.map +1 -0
- package/dist/lint/post-synth/graf111.d.ts +8 -0
- package/dist/lint/post-synth/graf111.d.ts.map +1 -0
- package/dist/lint/post-synth/graf112.d.ts +8 -0
- package/dist/lint/post-synth/graf112.d.ts.map +1 -0
- package/dist/lint/post-synth/graf113.d.ts +8 -0
- package/dist/lint/post-synth/graf113.d.ts.map +1 -0
- package/dist/lint/post-synth/graf114.d.ts +8 -0
- package/dist/lint/post-synth/graf114.d.ts.map +1 -0
- package/dist/lint/post-synth/graf115.d.ts +8 -0
- package/dist/lint/post-synth/graf115.d.ts.map +1 -0
- package/dist/lint/post-synth/grafana-helpers.d.ts +7 -5
- package/dist/lint/post-synth/grafana-helpers.d.ts.map +1 -1
- package/dist/lint/post-synth/index.d.ts.map +1 -1
- package/dist/lint/rules/literal-secret.d.ts +7 -3
- package/dist/lint/rules/literal-secret.d.ts.map +1 -1
- package/dist/lsp/hover.d.ts.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/members.d.ts +27 -0
- package/dist/members.d.ts.map +1 -0
- package/dist/meta.json +205 -0
- package/dist/okf/index.md +53 -4
- package/dist/okf/rules/GRAF002.md +3 -2
- package/dist/okf/rules/GRAF101.md +3 -2
- package/dist/okf/rules/GRAF102.md +1 -0
- package/dist/okf/rules/GRAF104.md +2 -2
- package/dist/okf/rules/GRAF106.md +2 -2
- package/dist/okf/rules/GRAF108.md +11 -0
- package/dist/okf/rules/GRAF109.md +15 -0
- package/dist/okf/rules/GRAF110.md +11 -0
- package/dist/okf/rules/GRAF111.md +11 -0
- package/dist/okf/rules/GRAF112.md +16 -0
- package/dist/okf/rules/GRAF113.md +16 -0
- package/dist/okf/rules/GRAF114.md +11 -0
- package/dist/okf/rules/GRAF115.md +11 -0
- package/dist/okf/types/AdhocVariable.md +9 -0
- package/dist/okf/types/AlertListPanel.md +9 -0
- package/dist/okf/types/AlertQuery.md +9 -0
- package/dist/okf/types/AlertRule.md +9 -0
- package/dist/okf/types/AlertRuleGroup.md +9 -0
- package/dist/okf/types/AzureMonitorQuery.md +9 -0
- package/dist/okf/types/BarChartPanel.md +9 -0
- package/dist/okf/types/BarGaugePanel.md +9 -0
- package/dist/okf/types/BigQueryQuery.md +9 -0
- package/dist/okf/types/CanvasPanel.md +9 -0
- package/dist/okf/types/ClassicConditionsExpression.md +9 -0
- package/dist/okf/types/CloudMonitoringQuery.md +9 -0
- package/dist/okf/types/CloudWatchQuery.md +9 -0
- package/dist/okf/types/ContactPoint.md +14 -0
- package/dist/okf/types/Dashboard.md +2 -1
- package/dist/okf/types/Datasource.md +3 -2
- package/dist/okf/types/DatasourceProvisioning.md +9 -0
- package/dist/okf/types/ElasticsearchQuery.md +9 -0
- package/dist/okf/types/ExternalDatasource.md +15 -0
- package/dist/okf/types/FlameGraphPanel.md +9 -0
- package/dist/okf/types/Folder.md +9 -0
- package/dist/okf/types/GeomapPanel.md +9 -0
- package/dist/okf/types/GroupByVariable.md +9 -0
- package/dist/okf/types/HistogramPanel.md +9 -0
- package/dist/okf/types/MSSQLQuery.md +9 -0
- package/dist/okf/types/MathExpression.md +9 -0
- package/dist/okf/types/MuteTiming.md +13 -0
- package/dist/okf/types/MySQLQuery.md +9 -0
- package/dist/okf/types/NodeGraphPanel.md +9 -0
- package/dist/okf/types/NotificationPolicy.md +9 -0
- package/dist/okf/types/NotificationTemplate.md +9 -0
- package/dist/okf/types/PieChartPanel.md +9 -0
- package/dist/okf/types/PostgresQuery.md +9 -0
- package/dist/okf/types/PyroscopeQuery.md +9 -0
- package/dist/okf/types/ReduceExpression.md +9 -0
- package/dist/okf/types/ResampleExpression.md +9 -0
- package/dist/okf/types/SqlExpression.md +9 -0
- package/dist/okf/types/StateTimelinePanel.md +9 -0
- package/dist/okf/types/StatusHistoryPanel.md +9 -0
- package/dist/okf/types/SwitchVariable.md +9 -0
- package/dist/okf/types/ThresholdExpression.md +9 -0
- package/dist/okf/types/TrendPanel.md +9 -0
- package/dist/okf/types/XYChartPanel.md +9 -0
- package/dist/op/activities/grafana-apply.d.ts +86 -0
- package/dist/op/activities/grafana-apply.d.ts.map +1 -0
- package/dist/op/activities/index.d.ts +9 -0
- package/dist/op/activities/index.d.ts.map +1 -0
- package/dist/op/builders.d.ts +24 -0
- package/dist/op/builders.d.ts.map +1 -0
- package/dist/ownership.d.ts +78 -0
- package/dist/ownership.d.ts.map +1 -0
- package/dist/panel-options.d.ts +65 -0
- package/dist/panel-options.d.ts.map +1 -0
- package/dist/panels.d.ts +46 -9
- package/dist/panels.d.ts.map +1 -1
- package/dist/pin.d.ts +29 -7
- package/dist/pin.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/promql-check.d.ts +51 -0
- package/dist/promql-check.d.ts.map +1 -0
- package/dist/query-models.d.ts +95 -0
- package/dist/query-models.d.ts.map +1 -0
- package/dist/query.d.ts +116 -18
- package/dist/query.d.ts.map +1 -1
- package/dist/rules/graf101.ts +3 -3
- package/dist/rules/graf102.ts +1 -1
- package/dist/rules/graf104.ts +3 -3
- package/dist/rules/graf106.ts +3 -3
- package/dist/rules/graf107.ts +1 -1
- package/dist/rules/graf108.ts +17 -0
- package/dist/rules/graf109.ts +17 -0
- package/dist/rules/graf110.ts +17 -0
- package/dist/rules/graf111.ts +17 -0
- package/dist/rules/graf112.ts +17 -0
- package/dist/rules/graf113.ts +17 -0
- package/dist/rules/graf114.ts +17 -0
- package/dist/rules/graf115.ts +17 -0
- package/dist/rules/grafana-helpers.ts +27 -10
- package/dist/rules/literal-secret.ts +60 -6
- package/dist/schema/azuremonitor.gen.d.ts +354 -0
- package/dist/schema/azuremonitor.gen.d.ts.map +1 -0
- package/dist/schema/barchart.gen.d.ts +198 -0
- package/dist/schema/barchart.gen.d.ts.map +1 -0
- package/dist/schema/bargauge.gen.d.ts +97 -0
- package/dist/schema/bargauge.gen.d.ts.map +1 -0
- package/dist/schema/bigquery.gen.d.ts +93 -0
- package/dist/schema/bigquery.gen.d.ts.map +1 -0
- package/dist/schema/canvas.gen.d.ts +152 -0
- package/dist/schema/canvas.gen.d.ts.map +1 -0
- package/dist/schema/cloudwatch.gen.d.ts +394 -0
- package/dist/schema/cloudwatch.gen.d.ts.map +1 -0
- package/dist/schema/dashboard.gen.d.ts +196 -21
- package/dist/schema/dashboard.gen.d.ts.map +1 -1
- package/dist/schema/elasticsearch.gen.d.ts +444 -0
- package/dist/schema/elasticsearch.gen.d.ts.map +1 -0
- package/dist/schema/expr.gen.d.ts +606 -0
- package/dist/schema/expr.gen.d.ts.map +1 -0
- package/dist/schema/gauge.gen.d.ts.map +1 -1
- package/dist/schema/geomap.gen.d.ts +100 -0
- package/dist/schema/geomap.gen.d.ts.map +1 -0
- package/dist/schema/googlecloudmonitoring.gen.d.ts +312 -0
- package/dist/schema/googlecloudmonitoring.gen.d.ts.map +1 -0
- package/dist/schema/grafanapyroscope.gen.d.ts +60 -0
- package/dist/schema/grafanapyroscope.gen.d.ts.map +1 -0
- package/dist/schema/heatmap.gen.d.ts.map +1 -1
- package/dist/schema/histogram.gen.d.ts +132 -0
- package/dist/schema/histogram.gen.d.ts.map +1 -0
- package/dist/schema/index.d.ts +18 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/logs.gen.d.ts +1 -0
- package/dist/schema/logs.gen.d.ts.map +1 -1
- package/dist/schema/loki.gen.d.ts.map +1 -1
- package/dist/schema/nodegraph.gen.d.ts +49 -0
- package/dist/schema/nodegraph.gen.d.ts.map +1 -0
- package/dist/schema/piechart.gen.d.ts +127 -0
- package/dist/schema/piechart.gen.d.ts.map +1 -0
- package/dist/schema/prometheus.gen.d.ts.map +1 -1
- package/dist/schema/stat.gen.d.ts.map +1 -1
- package/dist/schema/statetimeline.gen.d.ts +124 -0
- package/dist/schema/statetimeline.gen.d.ts.map +1 -0
- package/dist/schema/statushistory.gen.d.ts +114 -0
- package/dist/schema/statushistory.gen.d.ts.map +1 -0
- package/dist/schema/table.gen.d.ts +35 -3
- package/dist/schema/table.gen.d.ts.map +1 -1
- package/dist/schema/tempo.gen.d.ts.map +1 -1
- package/dist/schema/text.gen.d.ts.map +1 -1
- package/dist/schema/timeseries.gen.d.ts +5 -1
- package/dist/schema/timeseries.gen.d.ts.map +1 -1
- package/dist/schema/trend.gen.d.ts +180 -0
- package/dist/schema/trend.gen.d.ts.map +1 -0
- package/dist/schema/xychart.gen.d.ts +145 -0
- package/dist/schema/xychart.gen.d.ts.map +1 -0
- package/dist/schema-validate.d.ts +39 -4
- package/dist/schema-validate.d.ts.map +1 -1
- package/dist/serializer.d.ts +11 -3
- package/dist/serializer.d.ts.map +1 -1
- package/dist/skill-defs.d.ts.map +1 -1
- package/dist/skills/chant-grafana-alerting.md +49 -0
- package/dist/skills/chant-grafana-operations.md +108 -0
- package/dist/skills/chant-grafana-provisioning.md +3 -3
- package/dist/skills/chant-grafana.md +15 -8
- package/dist/spec/fetch-units-cli.d.ts +3 -0
- package/dist/spec/fetch-units-cli.d.ts.map +1 -0
- package/dist/spec/overlay.d.ts +43 -0
- package/dist/spec/overlay.d.ts.map +1 -0
- package/dist/spec/schemas.d.ts +21 -13
- package/dist/spec/schemas.d.ts.map +1 -1
- package/dist/spec/schemas.gen.d.ts +3 -0
- package/dist/spec/schemas.gen.d.ts.map +1 -0
- package/dist/spec/units.d.ts +35 -0
- package/dist/spec/units.d.ts.map +1 -0
- package/dist/spec/units.gen.d.ts +2 -0
- package/dist/spec/units.gen.d.ts.map +1 -0
- package/dist/transformations.d.ts +459 -0
- package/dist/transformations.d.ts.map +1 -0
- package/dist/util.d.ts +6 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/validate-alerting.d.ts +65 -0
- package/dist/validate-alerting.d.ts.map +1 -0
- package/dist/validate-output.d.ts +62 -9
- package/dist/validate-output.d.ts.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validation.d.ts +14 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/variables.d.ts +109 -7
- package/dist/variables.d.ts.map +1 -1
- package/package.json +12 -4
- package/src/actions/actions.test.ts +24 -0
- package/src/actions/grafana.ts +40 -0
- package/src/actions/index.ts +1 -0
- package/src/alerting-build.ts +376 -0
- package/src/alerting.e2e.test.ts +212 -0
- package/src/alerting.test.ts +272 -0
- package/src/alerting.ts +435 -0
- package/src/annotations.ts +84 -0
- package/src/api/apply.test.ts +256 -0
- package/src/api/apply.ts +394 -0
- package/src/api/bind.ts +58 -0
- package/src/api/client.ts +148 -0
- package/src/api/converge.ts +63 -0
- package/src/api/dashboards.ts +247 -0
- package/src/api/datasources.ts +33 -0
- package/src/api/fake-grafana-writes.ts +201 -0
- package/src/api/fake-grafana.ts +190 -0
- package/src/api/folders.ts +339 -0
- package/src/api/library-panels.ts +101 -0
- package/src/build.test.ts +351 -10
- package/src/build.ts +294 -55
- package/src/catalog.ts +104 -2
- package/src/codegen/docs.ts +50 -10
- package/src/codegen/generate.ts +27 -1
- package/src/codegen/schema-types.ts +16 -6
- package/src/composites/agent-dashboard.ts +6 -3
- package/src/composites/catalog.test.ts +2 -2
- package/src/composites/catalog.ts +82 -0
- package/src/composites/composites.test.ts +73 -9
- package/src/composites/index.ts +4 -2
- package/src/composites/queries.e2e.test.ts +374 -0
- package/src/composites/red-dashboard.ts +83 -12
- package/src/composites/shared.ts +14 -2
- package/src/composites/slo-alert-rules.ts +149 -0
- package/src/config.test.ts +61 -0
- package/src/config.ts +138 -0
- package/src/contact-point-secrets.ts +63 -0
- package/src/dashboard.ts +68 -9
- package/src/datasource-refs.test.ts +56 -0
- package/src/datasource-refs.ts +213 -0
- package/src/datasource-settings.test.ts +106 -0
- package/src/datasource-settings.ts +941 -0
- package/src/datasource.ts +123 -11
- package/src/deep-observe-hooks.ts +267 -0
- package/src/deep-observe.test.ts +311 -0
- package/src/deep-observe.ts +187 -0
- package/src/describe-resources.test.ts +271 -0
- package/src/describe-resources.ts +244 -0
- package/src/detect.ts +82 -5
- package/src/export-resources.test.ts +129 -0
- package/src/export-resources.ts +84 -0
- package/src/folder.ts +118 -0
- package/src/generated/lexicon-grafana.json +205 -0
- package/src/import/alerting-roundtrip.test.ts +161 -0
- package/src/import/alerting.ts +500 -0
- package/src/import/edits.ts +95 -0
- package/src/import/embedded.test.ts +45 -0
- package/src/import/embedded.ts +47 -0
- package/src/import/generated-types.e2e.test.ts +130 -0
- package/src/import/generator.test.ts +210 -0
- package/src/import/generator.ts +463 -0
- package/src/import/live-export.ts +264 -0
- package/src/import/mappings.ts +336 -0
- package/src/import/model.ts +117 -0
- package/src/import/normalize-alerting.ts +101 -0
- package/src/import/normalize.test.ts +117 -0
- package/src/import/normalize.ts +393 -0
- package/src/import/parser.test.ts +516 -0
- package/src/import/parser.ts +1387 -0
- package/src/import/report.ts +62 -0
- package/src/import/roundtrip.test.ts +563 -0
- package/src/import/testdata/fixtures.ts +137 -0
- package/src/import/v2.test.ts +292 -0
- package/src/import/v2.ts +804 -0
- package/src/import.e2e.test.ts +31 -84
- package/src/import.test.ts +9 -3
- package/src/index.ts +308 -14
- package/src/init-templates.test.ts +74 -0
- package/src/init-templates.ts +349 -0
- package/src/k8s.test.ts +98 -0
- package/src/k8s.ts +197 -0
- package/src/lint/audit-catalog.ts +68 -3
- package/src/lint/core-lint.test.ts +43 -0
- package/src/lint/post-synth/graf101.ts +3 -3
- package/src/lint/post-synth/graf102.ts +1 -1
- package/src/lint/post-synth/graf104.ts +3 -3
- package/src/lint/post-synth/graf106.ts +3 -3
- package/src/lint/post-synth/graf107.ts +1 -1
- package/src/lint/post-synth/graf108.ts +17 -0
- package/src/lint/post-synth/graf109.ts +17 -0
- package/src/lint/post-synth/graf110.ts +17 -0
- package/src/lint/post-synth/graf111.ts +17 -0
- package/src/lint/post-synth/graf112.ts +17 -0
- package/src/lint/post-synth/graf113.ts +17 -0
- package/src/lint/post-synth/graf114.ts +17 -0
- package/src/lint/post-synth/graf115.ts +17 -0
- package/src/lint/post-synth/grafana-helpers.ts +27 -10
- package/src/lint/post-synth/index.ts +16 -0
- package/src/lint/post-synth/post-synth.test.ts +333 -12
- package/src/lint/rules/literal-secret.ts +60 -6
- package/src/lint/rules/rules.test.ts +27 -0
- package/src/load-cost.test.ts +35 -0
- package/src/lsp/completions.test.ts +5 -0
- package/src/lsp/hover.test.ts +7 -0
- package/src/lsp/hover.ts +8 -1
- package/src/members.ts +68 -0
- package/src/observe.e2e.test.ts +255 -0
- package/src/op/activities/grafana-apply.e2e.test.ts +184 -0
- package/src/op/activities/grafana-apply.test.ts +243 -0
- package/src/op/activities/grafana-apply.ts +197 -0
- package/src/op/activities/index.ts +8 -0
- package/src/op/builders.test.ts +40 -0
- package/src/op/builders.ts +34 -0
- package/src/ownership.ts +122 -0
- package/src/panel-options.ts +66 -0
- package/src/panels.test.ts +53 -0
- package/src/panels.ts +148 -10
- package/src/pin.ts +69 -6
- package/src/plugin.test.ts +12 -2
- package/src/plugin.ts +75 -0
- package/src/promql-check.test.ts +108 -0
- package/src/promql-check.ts +193 -0
- package/src/query-models.ts +94 -0
- package/src/query.test.ts +166 -0
- package/src/query.ts +190 -20
- package/src/schema/azuremonitor.gen.ts +381 -0
- package/src/schema/barchart.gen.ts +221 -0
- package/src/schema/bargauge.gen.ts +111 -0
- package/src/schema/bigquery.gen.ts +110 -0
- package/src/schema/canvas.gen.ts +176 -0
- package/src/schema/cloudwatch.gen.ts +423 -0
- package/src/schema/dashboard.gen.ts +206 -22
- package/src/schema/elasticsearch.gen.ts +508 -0
- package/src/schema/expr.gen.ts +618 -0
- package/src/schema/gauge.gen.ts +2 -1
- package/src/schema/geomap.gen.ts +112 -0
- package/src/schema/googlecloudmonitoring.gen.ts +330 -0
- package/src/schema/grafanapyroscope.gen.ts +66 -0
- package/src/schema/heatmap.gen.ts +2 -1
- package/src/schema/histogram.gen.ts +151 -0
- package/src/schema/index.ts +18 -0
- package/src/schema/logs.gen.ts +3 -1
- package/src/schema/loki.gen.ts +2 -1
- package/src/schema/nodegraph.gen.ts +58 -0
- package/src/schema/piechart.gen.ts +146 -0
- package/src/schema/prometheus.gen.ts +2 -1
- package/src/schema/stat.gen.ts +2 -1
- package/src/schema/statetimeline.gen.ts +143 -0
- package/src/schema/statushistory.gen.ts +132 -0
- package/src/schema/table.gen.ts +41 -4
- package/src/schema/tempo.gen.ts +2 -1
- package/src/schema/text.gen.ts +2 -1
- package/src/schema/timeseries.gen.ts +7 -2
- package/src/schema/trend.gen.ts +208 -0
- package/src/schema/xychart.gen.ts +167 -0
- package/src/schema-overlay.test.ts +282 -0
- package/src/schema-validate.ts +199 -57
- package/src/schema.test.ts +4 -2
- package/src/serializer.test.ts +13 -1
- package/src/serializer.ts +11 -3
- package/src/skill-defs.ts +34 -0
- package/src/skills/chant-grafana-alerting.md +49 -0
- package/src/skills/chant-grafana-operations.md +108 -0
- package/src/skills/chant-grafana-provisioning.md +3 -3
- package/src/skills/chant-grafana.md +15 -8
- package/src/spec/fetch-cli.ts +3 -3
- package/src/spec/fetch-units-cli.ts +37 -0
- package/src/spec/overlay/canvas.overlay.json +142 -0
- package/src/spec/overlay/dashboard.overlay.json +378 -0
- package/src/spec/overlay/expr.overlay.json +14 -0
- package/src/spec/overlay/geomap.overlay.json +35 -0
- package/src/spec/overlay/logs.overlay.json +14 -0
- package/src/spec/overlay/nodegraph.overlay.json +31 -0
- package/src/spec/overlay/piechart.overlay.json +17 -0
- package/src/spec/overlay/table.overlay.json +103 -0
- package/src/spec/overlay/timeseries.overlay.json +21 -0
- package/src/spec/overlay/trend.overlay.json +17 -0
- package/src/spec/overlay/xychart.overlay.json +16 -0
- package/src/spec/overlay.ts +105 -0
- package/src/spec/schemas/azuremonitor.jsonschema.json +679 -0
- package/src/spec/schemas/barchart.jsonschema.json +419 -0
- package/src/spec/schemas/bargauge.jsonschema.json +224 -0
- package/src/spec/schemas/bigquery.jsonschema.json +290 -0
- package/src/spec/schemas/canvas.jsonschema.json +356 -0
- package/src/spec/schemas/cloudwatch.jsonschema.json +721 -0
- package/src/spec/schemas/dashboardv2.jsonschema.json +3387 -0
- package/src/spec/schemas/elasticsearch.jsonschema.json +1695 -0
- package/src/spec/schemas/expr.jsonschema.json +987 -0
- package/src/spec/schemas/geomap.jsonschema.json +220 -0
- package/src/spec/schemas/googlecloudmonitoring.jsonschema.json +488 -0
- package/src/spec/schemas/grafanapyroscope.jsonschema.json +93 -0
- package/src/spec/schemas/histogram.jsonschema.json +308 -0
- package/src/spec/schemas/nodegraph.jsonschema.json +77 -0
- package/src/spec/schemas/piechart.jsonschema.json +275 -0
- package/src/spec/schemas/statetimeline.jsonschema.json +324 -0
- package/src/spec/schemas/statushistory.jsonschema.json +292 -0
- package/src/spec/schemas/trend.jsonschema.json +449 -0
- package/src/spec/schemas/xychart.jsonschema.json +428 -0
- package/src/spec/schemas.gen.ts +40 -0
- package/src/spec/schemas.ts +30 -16
- package/src/spec/units.gen.ts +281 -0
- package/src/spec/units.ts +77 -0
- package/src/transformations.test.ts +65 -0
- package/src/transformations.ts +574 -0
- package/src/util.ts +8 -0
- package/src/validate-alerting.test.ts +255 -0
- package/src/validate-alerting.ts +430 -0
- package/src/validate-output.ts +427 -104
- package/src/validate.ts +28 -0
- package/src/validation.ts +27 -0
- package/src/variables.ts +120 -8
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identical to timeseries... except it does not have timezone settings
|
|
3
|
+
*/
|
|
4
|
+
export interface Options {
|
|
5
|
+
legend: VizLegendOptions;
|
|
6
|
+
tooltip: VizTooltipOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Name of the x field to use (defaults to first number)
|
|
9
|
+
*/
|
|
10
|
+
xField?: string;
|
|
11
|
+
}
|
|
12
|
+
export type FieldConfig = GraphFieldConfig;
|
|
13
|
+
/**
|
|
14
|
+
* TODO docs
|
|
15
|
+
*/
|
|
16
|
+
export interface VizLegendOptions {
|
|
17
|
+
displayMode: LegendDisplayMode;
|
|
18
|
+
placement: LegendPlacement;
|
|
19
|
+
showLegend: boolean;
|
|
20
|
+
asTable?: boolean;
|
|
21
|
+
isVisible?: boolean;
|
|
22
|
+
sortBy?: string;
|
|
23
|
+
sortDesc?: boolean;
|
|
24
|
+
width?: number;
|
|
25
|
+
calcs: string[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* TODO docs
|
|
29
|
+
*/
|
|
30
|
+
export interface VizTooltipOptions {
|
|
31
|
+
mode: TooltipDisplayMode;
|
|
32
|
+
sort: SortOrder;
|
|
33
|
+
maxWidth?: number;
|
|
34
|
+
maxHeight?: number;
|
|
35
|
+
hideZeros?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* TODO docs
|
|
39
|
+
*/
|
|
40
|
+
export interface GraphFieldConfig {
|
|
41
|
+
drawStyle?: GraphDrawStyle;
|
|
42
|
+
gradientMode?: GraphGradientMode;
|
|
43
|
+
thresholdsStyle?: GraphThresholdsStyleConfig;
|
|
44
|
+
transform?: GraphTransform;
|
|
45
|
+
lineColor?: string;
|
|
46
|
+
lineWidth?: number;
|
|
47
|
+
lineInterpolation?: LineInterpolation;
|
|
48
|
+
lineStyle?: LineStyle;
|
|
49
|
+
fillColor?: string;
|
|
50
|
+
fillOpacity?: number;
|
|
51
|
+
showPoints?: VisibilityMode;
|
|
52
|
+
pointSize?: number;
|
|
53
|
+
pointColor?: string;
|
|
54
|
+
axisPlacement?: AxisPlacement;
|
|
55
|
+
axisColorMode?: AxisColorMode;
|
|
56
|
+
axisLabel?: string;
|
|
57
|
+
axisWidth?: number;
|
|
58
|
+
axisSoftMin?: number;
|
|
59
|
+
axisSoftMax?: number;
|
|
60
|
+
axisGridShow?: boolean;
|
|
61
|
+
scaleDistribution?: ScaleDistributionConfig;
|
|
62
|
+
axisCenteredZero?: boolean;
|
|
63
|
+
barAlignment?: BarAlignment;
|
|
64
|
+
barWidthFactor?: number;
|
|
65
|
+
stacking?: StackingConfig;
|
|
66
|
+
hideFrom?: HideSeriesConfig;
|
|
67
|
+
insertNulls?: boolean | number;
|
|
68
|
+
/**
|
|
69
|
+
* Indicate if null values should be treated as gaps or connected.
|
|
70
|
+
* When the value is a number, it represents the maximum delta in the
|
|
71
|
+
* X axis that should be considered connected. For timeseries, this is milliseconds
|
|
72
|
+
*/
|
|
73
|
+
spanNulls?: boolean | number;
|
|
74
|
+
fillBelowTo?: string;
|
|
75
|
+
pointSymbol?: string;
|
|
76
|
+
axisBorderShow?: boolean;
|
|
77
|
+
barMaxWidth?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Show point values on the graph.
|
|
80
|
+
*/
|
|
81
|
+
showValues?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* TODO docs
|
|
85
|
+
* Note: "hidden" needs to remain as an option for plugins compatibility
|
|
86
|
+
*/
|
|
87
|
+
export type LegendDisplayMode = "list" | "table" | "hidden";
|
|
88
|
+
/**
|
|
89
|
+
* TODO docs
|
|
90
|
+
*/
|
|
91
|
+
export type LegendPlacement = "bottom" | "right";
|
|
92
|
+
/**
|
|
93
|
+
* TODO docs
|
|
94
|
+
*/
|
|
95
|
+
export type TooltipDisplayMode = "single" | "multi" | "none";
|
|
96
|
+
/**
|
|
97
|
+
* TODO docs
|
|
98
|
+
*/
|
|
99
|
+
export type SortOrder = "asc" | "desc" | "none";
|
|
100
|
+
/**
|
|
101
|
+
* TODO docs
|
|
102
|
+
*/
|
|
103
|
+
export type GraphDrawStyle = "line" | "bars" | "points";
|
|
104
|
+
/**
|
|
105
|
+
* TODO docs
|
|
106
|
+
*/
|
|
107
|
+
export type GraphGradientMode = "none" | "opacity" | "hue" | "scheme";
|
|
108
|
+
/**
|
|
109
|
+
* TODO docs
|
|
110
|
+
*/
|
|
111
|
+
export interface GraphThresholdsStyleConfig {
|
|
112
|
+
mode: GraphThresholdsStyleMode;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* TODO docs
|
|
116
|
+
*/
|
|
117
|
+
export type GraphTransform = "constant" | "negative-Y";
|
|
118
|
+
/**
|
|
119
|
+
* TODO docs
|
|
120
|
+
*/
|
|
121
|
+
export type LineInterpolation = "linear" | "smooth" | "stepBefore" | "stepAfter";
|
|
122
|
+
/**
|
|
123
|
+
* TODO docs
|
|
124
|
+
*/
|
|
125
|
+
export interface LineStyle {
|
|
126
|
+
fill?: "solid" | "dash" | "dot" | "square";
|
|
127
|
+
dash?: number[];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* TODO docs
|
|
131
|
+
*/
|
|
132
|
+
export type VisibilityMode = "auto" | "never" | "always";
|
|
133
|
+
/**
|
|
134
|
+
* TODO docs
|
|
135
|
+
*/
|
|
136
|
+
export type AxisPlacement = "auto" | "top" | "right" | "bottom" | "left" | "hidden";
|
|
137
|
+
/**
|
|
138
|
+
* TODO docs
|
|
139
|
+
*/
|
|
140
|
+
export type AxisColorMode = "text" | "series";
|
|
141
|
+
/**
|
|
142
|
+
* TODO docs
|
|
143
|
+
*/
|
|
144
|
+
export interface ScaleDistributionConfig {
|
|
145
|
+
type: ScaleDistribution;
|
|
146
|
+
log?: number;
|
|
147
|
+
linearThreshold?: number;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* TODO docs
|
|
151
|
+
*/
|
|
152
|
+
export type BarAlignment = -1 | 0 | 1;
|
|
153
|
+
/**
|
|
154
|
+
* TODO docs
|
|
155
|
+
*/
|
|
156
|
+
export interface StackingConfig {
|
|
157
|
+
mode?: StackingMode;
|
|
158
|
+
group?: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* TODO docs
|
|
162
|
+
*/
|
|
163
|
+
export interface HideSeriesConfig {
|
|
164
|
+
tooltip: boolean;
|
|
165
|
+
legend: boolean;
|
|
166
|
+
viz: boolean;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* TODO docs
|
|
170
|
+
*/
|
|
171
|
+
export type GraphThresholdsStyleMode = "off" | "line" | "dashed" | "area" | "line+area" | "dashed+area" | "series";
|
|
172
|
+
/**
|
|
173
|
+
* TODO docs
|
|
174
|
+
*/
|
|
175
|
+
export type ScaleDistribution = "linear" | "log" | "ordinal" | "symlog";
|
|
176
|
+
/**
|
|
177
|
+
* TODO docs
|
|
178
|
+
*/
|
|
179
|
+
export type StackingMode = "none" | "normal" | "percent";
|
|
180
|
+
//# sourceMappingURL=trend.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trend.gen.d.ts","sourceRoot":"","sources":["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AAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEnH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
export type PointShape = "circle" | "square";
|
|
2
|
+
export type SeriesMapping = "auto" | "manual";
|
|
3
|
+
export type XYShowMode = "points" | "lines" | "points+lines";
|
|
4
|
+
/**
|
|
5
|
+
* NOTE: (copied from dashboard_kind.cue, since not exported)
|
|
6
|
+
* Matcher is a predicate configuration. Based on the config a set of field(s) or values is filtered in order to apply override / transformation.
|
|
7
|
+
* It comes with in id ( to resolve implementation from registry) and a configuration that’s specific to a particular matcher type.
|
|
8
|
+
*/
|
|
9
|
+
export interface MatcherConfig {
|
|
10
|
+
/**
|
|
11
|
+
* The matcher id. This is used to find the matcher implementation from registry.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* The matcher options. This is specific to the matcher implementation: a field name for byName, a frame index for byIndex.
|
|
16
|
+
*/
|
|
17
|
+
options?: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface FieldConfig {
|
|
20
|
+
show?: XYShowMode;
|
|
21
|
+
pointSize?: {
|
|
22
|
+
fixed?: number;
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
};
|
|
26
|
+
pointShape?: PointShape;
|
|
27
|
+
pointStrokeWidth?: number;
|
|
28
|
+
fillOpacity?: number;
|
|
29
|
+
lineWidth?: number;
|
|
30
|
+
hideFrom?: HideSeriesConfig;
|
|
31
|
+
axisPlacement?: AxisPlacement;
|
|
32
|
+
axisColorMode?: AxisColorMode;
|
|
33
|
+
axisLabel?: string;
|
|
34
|
+
axisWidth?: number;
|
|
35
|
+
axisSoftMin?: number;
|
|
36
|
+
axisSoftMax?: number;
|
|
37
|
+
axisGridShow?: boolean;
|
|
38
|
+
scaleDistribution?: ScaleDistributionConfig;
|
|
39
|
+
axisCenteredZero?: boolean;
|
|
40
|
+
lineStyle?: LineStyle;
|
|
41
|
+
axisBorderShow?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface XYSeriesConfig {
|
|
44
|
+
name?: {
|
|
45
|
+
fixed?: string;
|
|
46
|
+
};
|
|
47
|
+
frame?: {
|
|
48
|
+
matcher: MatcherConfig;
|
|
49
|
+
};
|
|
50
|
+
x?: {
|
|
51
|
+
matcher: MatcherConfig;
|
|
52
|
+
};
|
|
53
|
+
y?: {
|
|
54
|
+
matcher: MatcherConfig;
|
|
55
|
+
};
|
|
56
|
+
color?: {
|
|
57
|
+
matcher: MatcherConfig;
|
|
58
|
+
};
|
|
59
|
+
size?: {
|
|
60
|
+
matcher: MatcherConfig;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface Options {
|
|
64
|
+
mapping: SeriesMapping;
|
|
65
|
+
legend: VizLegendOptions;
|
|
66
|
+
tooltip: VizTooltipOptions;
|
|
67
|
+
series: XYSeriesConfig[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* TODO docs
|
|
71
|
+
*/
|
|
72
|
+
export interface HideSeriesConfig {
|
|
73
|
+
tooltip: boolean;
|
|
74
|
+
legend: boolean;
|
|
75
|
+
viz: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* TODO docs
|
|
79
|
+
*/
|
|
80
|
+
export type AxisPlacement = "auto" | "top" | "right" | "bottom" | "left" | "hidden";
|
|
81
|
+
/**
|
|
82
|
+
* TODO docs
|
|
83
|
+
*/
|
|
84
|
+
export type AxisColorMode = "text" | "series";
|
|
85
|
+
/**
|
|
86
|
+
* TODO docs
|
|
87
|
+
*/
|
|
88
|
+
export interface ScaleDistributionConfig {
|
|
89
|
+
type: ScaleDistribution;
|
|
90
|
+
log?: number;
|
|
91
|
+
linearThreshold?: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* TODO docs
|
|
95
|
+
*/
|
|
96
|
+
export interface LineStyle {
|
|
97
|
+
fill?: "solid" | "dash" | "dot" | "square";
|
|
98
|
+
dash?: number[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* TODO docs
|
|
102
|
+
*/
|
|
103
|
+
export interface VizLegendOptions {
|
|
104
|
+
displayMode: LegendDisplayMode;
|
|
105
|
+
placement: LegendPlacement;
|
|
106
|
+
showLegend: boolean;
|
|
107
|
+
asTable?: boolean;
|
|
108
|
+
isVisible?: boolean;
|
|
109
|
+
sortBy?: string;
|
|
110
|
+
sortDesc?: boolean;
|
|
111
|
+
width?: number;
|
|
112
|
+
calcs: string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* TODO docs
|
|
116
|
+
*/
|
|
117
|
+
export interface VizTooltipOptions {
|
|
118
|
+
mode: TooltipDisplayMode;
|
|
119
|
+
sort: SortOrder;
|
|
120
|
+
maxWidth?: number;
|
|
121
|
+
maxHeight?: number;
|
|
122
|
+
hideZeros?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* TODO docs
|
|
126
|
+
*/
|
|
127
|
+
export type ScaleDistribution = "linear" | "log" | "ordinal" | "symlog";
|
|
128
|
+
/**
|
|
129
|
+
* TODO docs
|
|
130
|
+
* Note: "hidden" needs to remain as an option for plugins compatibility
|
|
131
|
+
*/
|
|
132
|
+
export type LegendDisplayMode = "list" | "table" | "hidden";
|
|
133
|
+
/**
|
|
134
|
+
* TODO docs
|
|
135
|
+
*/
|
|
136
|
+
export type LegendPlacement = "bottom" | "right";
|
|
137
|
+
/**
|
|
138
|
+
* TODO docs
|
|
139
|
+
*/
|
|
140
|
+
export type TooltipDisplayMode = "single" | "multi" | "none";
|
|
141
|
+
/**
|
|
142
|
+
* TODO docs
|
|
143
|
+
*/
|
|
144
|
+
export type SortOrder = "asc" | "desc" | "none";
|
|
145
|
+
//# sourceMappingURL=xychart.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xychart.gen.d.ts","sourceRoot":"","sources":["../../src/schema/xychart.gen.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MA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against the vendored schemas at
|
|
3
|
-
* `GRAFANA_SCHEMA_PIN`, offline.
|
|
3
|
+
* `GRAFANA_SCHEMA_PIN`, with the correction overlay applied, offline.
|
|
4
4
|
*
|
|
5
5
|
* The dashboard is checked against the dashboard schema as it stands. Panel
|
|
6
6
|
* options, `fieldConfig.defaults.custom` and each query are checked against
|
|
7
7
|
* their plugin's schema with every `required` list removed, because Grafana
|
|
8
|
-
* fills in options a panel leaves out
|
|
9
|
-
*
|
|
8
|
+
* fills in options a panel leaves out.
|
|
9
|
+
*
|
|
10
|
+
* Two kinds of problem come back. A value the schema does not allow (a
|
|
11
|
+
* wrong type, an enum value it does not list, a required field missing) is
|
|
12
|
+
* an error. A key the pinned schema does not know is a warning: Grafana
|
|
13
|
+
* adds fields every minor release and keeps what it does not understand, so
|
|
14
|
+
* an unknown key is more often a newer Grafana than a mistake. To tell the
|
|
15
|
+
* two apart each value is validated twice, once with every object opened
|
|
16
|
+
* (`additionalProperties: false` dropped; what fails is an error) and once
|
|
17
|
+
* as pinned (what fails only for an unknown key is a warning).
|
|
18
|
+
*
|
|
19
|
+
* An export shared externally embeds its library panels in `__elements`;
|
|
20
|
+
* each element's `model` is checked the same way as a panel on the grid.
|
|
21
|
+
*
|
|
22
|
+
* `oneOf` is read as `anyOf` throughout. The CUE these schemas come from
|
|
23
|
+
* has disjunctions, which accept a value matching any branch; cog writes
|
|
24
|
+
* them as `oneOf`, which rejects a value matching two, and loosely
|
|
25
|
+
* discriminated unions (a table's `cellOptions: { type: "auto" }` matches
|
|
26
|
+
* several variants) match more than one.
|
|
10
27
|
*/
|
|
28
|
+
import type { SchemaName } from "./pin.js";
|
|
11
29
|
export interface SchemaProblem {
|
|
12
30
|
/** JSON pointer into the dashboard. */
|
|
13
31
|
path: string;
|
|
14
32
|
message: string;
|
|
33
|
+
/** `error` for a value the schema does not allow, `warning` for a key it does not know. */
|
|
34
|
+
severity: "error" | "warning";
|
|
15
35
|
}
|
|
36
|
+
/** Why schema validation cannot run here (ajv did not load), or undefined when it can. */
|
|
37
|
+
export declare function schemaValidationUnavailable(): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* One schema as validation uses it: the vendored file with its overlay
|
|
40
|
+
* applied, from the generated `spec/schemas.gen.ts` (no filesystem read, so
|
|
41
|
+
* it works bundled), parsed on first use.
|
|
42
|
+
*/
|
|
43
|
+
export declare function bundledSchema(name: SchemaName): Record<string, unknown>;
|
|
16
44
|
type Json = Record<string, unknown>;
|
|
17
|
-
/** Everything in one dashboard that the pinned schemas reject. */
|
|
45
|
+
/** Everything in one dashboard that the pinned schemas reject or do not know. */
|
|
18
46
|
export declare function validateDashboardSchema(dashboard: Json): SchemaProblem[];
|
|
47
|
+
/**
|
|
48
|
+
* Check one server-side expression model (an alert rule's `data[].model`
|
|
49
|
+
* whose datasource is `__expr__`) against the pinned `expr` schema, as
|
|
50
|
+
* written: its `type` picks the definition, and every required field must
|
|
51
|
+
* be there, since Grafana fills none in.
|
|
52
|
+
*/
|
|
53
|
+
export declare function validateExpressionSchema(model: Json, prefix?: string): SchemaProblem[];
|
|
19
54
|
export {};
|
|
20
55
|
//# sourceMappingURL=schema-validate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-validate.d.ts","sourceRoot":"","sources":["../src/schema-validate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema-validate.d.ts","sourceRoot":"","sources":["../src/schema-validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAKxC,MAAM,WAAW,aAAa;IAC5B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AA6BD,0FAA0F;AAC1F,wBAAgB,2BAA2B,IAAI,MAAM,GAAG,SAAS,CAGhE;AAUD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOvE;AAoFD,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAwDpC,iFAAiF;AACjF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,IAAI,GAAG,aAAa,EAAE,CAsBxE;AAYD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,SAAK,GAAG,aAAa,EAAE,CAMlF"}
|
package/dist/serializer.d.ts
CHANGED
|
@@ -9,13 +9,21 @@
|
|
|
9
9
|
* - `provisioning/datasources/chant.yaml`: every declared datasource.
|
|
10
10
|
* - `provisioning/dashboards/chant.yaml`: the provider that loads the
|
|
11
11
|
* dashboard files, a default one unless a `DashboardProvider` is declared.
|
|
12
|
+
* - `provisioning/alerting/chant.yaml`: rule groups, contact points, the
|
|
13
|
+
* notification policy tree, mute timings and templates, when the build
|
|
14
|
+
* declares any (see `alerting-build.ts`).
|
|
12
15
|
*
|
|
13
16
|
* Mount `provisioning/` at `/etc/grafana/provisioning` and `dashboards/` at
|
|
14
17
|
* the provider's path (`/var/lib/grafana/dashboards` by default).
|
|
15
18
|
*
|
|
16
|
-
* The primary output is a small JSON index of what was built.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
+
* The primary output is a small JSON index of what was built. The dashboard
|
|
20
|
+
* JSON carries no ownership marker, because Grafana keeps who manages a
|
|
21
|
+
* dashboard outside it, in the resource's metadata on its
|
|
22
|
+
* `dashboard.grafana.app` API. For a file-provisioned dashboard that metadata
|
|
23
|
+
* is the `grafana.app/managerId` annotation Grafana writes, whose value is the
|
|
24
|
+
* provider name in `provisioning/dashboards/chant.yaml`: `chant` unless a
|
|
25
|
+
* `DashboardProvider` names another. That name is the marker chant stamps at
|
|
26
|
+
* synthesis, and ./ownership.ts reads it back.
|
|
19
27
|
*/
|
|
20
28
|
import type { Serializer } from "@intentius/chant/serializer";
|
|
21
29
|
export declare const grafanaSerializer: Serializer;
|
package/dist/serializer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAoB,MAAM,6BAA6B,CAAC;AAIhF,eAAO,MAAM,iBAAiB,EAAE,UAW/B,CAAC"}
|
package/dist/skill-defs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-defs.d.ts","sourceRoot":"","sources":["../src/skill-defs.ts"],"names":[],"mappings":"AAEA,8DAA8D;AAC9D,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"skill-defs.d.ts","sourceRoot":"","sources":["../src/skill-defs.ts"],"names":[],"mappings":"AAEA,8DAA8D;AAC9D,eAAO,MAAM,aAAa,qDA6DxB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
skill: chant-grafana-alerting
|
|
3
|
+
description: Declare Grafana-managed alert rules, server-side expressions, contact points, notification policies and mute timings with chant, turn an Slo into burn-rate rules, and import Grafana's alerting exports
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Grafana-managed alerting with chant
|
|
8
|
+
|
|
9
|
+
Everything is written to `provisioning/alerting/chant.yaml`, Grafana's alerting provisioning file. Mount `dist/grafana/provisioning` at `/etc/grafana/provisioning`.
|
|
10
|
+
|
|
11
|
+
## A rule
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { AlertRule, AlertRuleGroup, PromQuery, ReduceExpression, ThresholdExpression } from "@intentius/chant-lexicon-grafana";
|
|
15
|
+
|
|
16
|
+
const errors = new PromQuery({ datasource: prometheus, expr: 'sum(rate(http_requests_total{code=~"5.."}[5m]))', instant: true });
|
|
17
|
+
const last = new ReduceExpression({ expression: "A", reducer: "last" });
|
|
18
|
+
const high = new ThresholdExpression({ expression: "B", conditions: [{ evaluator: { type: "gt", params: [5] } }] });
|
|
19
|
+
const rule = new AlertRule({ title: "5xx above 5/s", uid: "checkout-5xx", data: [errors, last, high], for: "5m", labels: { severity: "page" } });
|
|
20
|
+
export const checkoutAlerts = new AlertRuleGroup({ name: "checkout", folder: "Checkout", interval: "1m", rules: [rule] });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- refIds follow `data` order (A, B, C); expressions name inputs by refId (`"A"`, or `$A` in a `MathExpression`). `condition` defaults to the last refId.
|
|
24
|
+
- Queries need a `Datasource`, `ExternalDatasource` or `{ type, uid }`; never a `DatasourceVariable`.
|
|
25
|
+
- Any plugin's model: `new AlertQuery({ datasource, model: { ... } })`. A typed query with its own range: `new AlertQuery({ query, relativeTimeRange: { from: "5m" } })`.
|
|
26
|
+
- Set `uid` explicitly on rules whose title may change.
|
|
27
|
+
|
|
28
|
+
## Notifications
|
|
29
|
+
|
|
30
|
+
- `ContactPoint({ name, receivers: [{ type: "slack", settings: { url: "$__env{SLACK_URL}" } }] })`. Secrets always as `$__env{...}` or `$__file{...}`; GRAF002 flags literals.
|
|
31
|
+
- `NotificationPolicy({ receiver: oncall, routes: [{ receiver: tickets, object_matchers: [["severity", "=", "ticket"]], mute_time_intervals: [weekends] }] })`. One per organisation: it replaces the whole tree.
|
|
32
|
+
- `MuteTiming({ name: "weekends", time_intervals: [{ weekdays: ["saturday", "sunday"] }] })`, `NotificationTemplate({ name, template })`.
|
|
33
|
+
- Pass entities rather than names where you can; GRAF113 checks names against what the build declares.
|
|
34
|
+
|
|
35
|
+
## An SLO's burn-rate alerts
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
export const checkoutBurn = SloAlertRules({ slo: checkout, datasource: prometheus, folder: "SLOs" });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
One rule per window pair, reading the `Slo`'s recorded `slo:sli_error:ratio_rate<window>` series, so the `Slo`'s Prometheus rule group must be loaded. Rules carry `severity: page|ticket` for the policy tree, or pass `contactPoint`.
|
|
42
|
+
|
|
43
|
+
## Import
|
|
44
|
+
|
|
45
|
+
`chant import alert-rules.yaml` reads a provisioning file or Grafana's export (`/api/v1/provisioning/alert-rules/export?format=yaml`, and the contact-points, policies and mute-timings exports). Read every warning: guessed datasource types, `[REDACTED]` secrets turned into `$__env{...}`, and delete/reset lists that are not carried.
|
|
46
|
+
|
|
47
|
+
## Checks
|
|
48
|
+
|
|
49
|
+
GRAF108 (PromQL), GRAF111 (condition and expression refIds), GRAF112 (datasources), GRAF113 (contact points, mute timings, matchers), GRAF114 (uids, intervals as multiples of 10s, duplicates).
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
skill: chant-grafana-operations
|
|
3
|
+
description: Start a Grafana project from a template, bring existing dashboards into chant with chant import, find what changed in a running Grafana with chant lifecycle diff --live, export a Grafana as TypeScript, and apply a build over the HTTP API
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Operating Grafana with chant
|
|
8
|
+
|
|
9
|
+
Use this skill when a Grafana already exists: dashboards made in the UI to bring under chant, a provisioned dashboard somebody edited, or a build to push without mounting files. For writing dashboards see the chant-grafana skill; for provisioning files and ConfigMaps, chant-grafana-provisioning; for alert rules, chant-grafana-alerting.
|
|
10
|
+
|
|
11
|
+
## Start a project
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
chant init --lexicon grafana my-dashboards # a Prometheus datasource and one dashboard
|
|
15
|
+
chant init --lexicon grafana --template red my-dashboards # RedDashboard over span metrics, ExternalDatasource, Folder
|
|
16
|
+
chant init --lexicon grafana --template k8s-pods my-dashboards # pod dashboard delivered as sidecar ConfigMaps (k8s + grafana)
|
|
17
|
+
chant init --lexicon grafana --template slo my-dashboards # Slo rules, SloDashboard and SloAlertRules (prometheus + grafana)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Every template builds clean and passes the GRAF checks as written. `k8s-pods` and `slo` ship a `chant.config.ts` naming both lexicons and a `build` script without `--lexicon`, so both outputs and both lexicons' checks run.
|
|
21
|
+
|
|
22
|
+
## Import dashboards you already have
|
|
23
|
+
|
|
24
|
+
Export the dashboard in Grafana (Export > Export as JSON, classic or V2 resource), then:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
chant import checkout.json --output src # inside a project that lists grafana
|
|
28
|
+
chant import checkout.json --lexicon grafana --output src # anywhere else
|
|
29
|
+
chant build src --lexicon grafana -o dist/grafana/index.json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The importer also reads `GET /api/dashboards/uid/<uid>` responses, `dashboard.grafana.app` v1 and v2 resources, and datasource, dashboard and alerting provisioning files. Each dashboard lands in `src/<uid>/`: `dashboard.ts`, `panels.ts`, one `row-<title>.ts` per row, `variables.ts`, and `datasources.ts` with an `ExternalDatasource` per datasource named by uid. Replace an `ExternalDatasource` with a `Datasource` of the same uid to provision it from chant too.
|
|
33
|
+
|
|
34
|
+
Read every import warning. Anything the lexicon can't express is reported, never dropped. Common ones: a v2 dashboard's tabs become rows, an export made for sharing turns `${DS_*}` inputs into `DatasourceVariable`s, and two imported dashboards naming one datasource both declare it (GRAF104; delete one declaration and import it from the other file).
|
|
35
|
+
|
|
36
|
+
A dashboard inside a Kubernetes ConfigMap imports with the k8s lexicon: `chant import grafana-configmaps.yaml` gives a grafana `Dashboard` as the ConfigMap's value.
|
|
37
|
+
|
|
38
|
+
## Point environments at a Grafana
|
|
39
|
+
|
|
40
|
+
Observe, export and apply read `grafana.profiles.<env>` in `chant.config.ts`. Credentials are named by environment variable, never written in the file:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import type { ChantConfig } from "@intentius/chant/config";
|
|
44
|
+
import "@intentius/chant-lexicon-grafana";
|
|
45
|
+
|
|
46
|
+
export default {
|
|
47
|
+
lexicons: ["grafana"],
|
|
48
|
+
ownership: { stack: "shop", env: "prod" },
|
|
49
|
+
grafana: {
|
|
50
|
+
profiles: {
|
|
51
|
+
staging: { url: "https://grafana.staging.example.com", token: { env: "GRAFANA_STAGING_TOKEN" } },
|
|
52
|
+
prod: { url: "https://grafana.example.com", token: { env: "GRAFANA_PROD_TOKEN" }, orgId: 2 },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
} satisfies ChantConfig;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
With no profile, `GRAFANA_URL` plus `GRAFANA_TOKEN` (or `GRAFANA_USER` and `GRAFANA_PASSWORD`) is used. Grafana Cloud also needs `namespace: "stacks-<id>"`. A Viewer service account can observe and export. Applying needs Editor, or a custom role with `grafanaActionsFor("Apply", "Prune")`.
|
|
59
|
+
|
|
60
|
+
## Find what changed in Grafana
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
chant lifecycle diff staging --live
|
|
64
|
+
chant lifecycle diff staging --live --json # the same report as data
|
|
65
|
+
chant lifecycle diff staging --live --update-baseline # accept what it reported
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Paths are in your source's terms: `panels[0].panels[1].title` is the second panel of the first row. A value you declared that differs is drift. A value you never declared, such as a panel added in the UI, is listed as unclaimed and never proposed as a change. What the build fills in (panel ids, auto grid positions, refIds) and what Grafana adds on read are not reported. A dashboard Grafana 13 stores as v2 is read at v2 and diffed after conversion, so a tab added in the UI shows as drift in the rows.
|
|
69
|
+
|
|
70
|
+
Ownership decides what counts as chant's. A dashboard loaded by one of the project's providers (named `chant` unless you declared another `DashboardProvider`), or carrying the `app.kubernetes.io/managed-by: chant` label the applier writes, is `owned`. Anything else is `foreign`. Datasources and dashboards on Grafana 11 are `unknown`, and `--owned` leaves them out.
|
|
71
|
+
|
|
72
|
+
A `DashboardProvider` can't be observed (Grafana serves no API for provisioning files) and is reported as not observed, not missing.
|
|
73
|
+
|
|
74
|
+
## Export a Grafana as TypeScript
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
chant import --from staging --lexicon grafana --output src
|
|
78
|
+
chant import --from staging --lexicon grafana --type Grafana::Dashboard --name checkout --output src
|
|
79
|
+
chant import --from staging --lexicon grafana --owned --output src
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
It writes every dashboard and datasource in the organisation, laid out like a file import. Datasource secrets come back as `"[REDACTED]"`, each with a warning. Replace them with `$__env{NAME}` or `$__file{path}`, which GRAF002 requires.
|
|
83
|
+
|
|
84
|
+
## Apply over the HTTP API
|
|
85
|
+
|
|
86
|
+
When the build's files can't be mounted into Grafana, or you want real folders with pinned uids, apply from an Op:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
// ops/grafana.op.ts, with "build:grafana": "chant build src --lexicon grafana -o dist/grafana.json" in package.json
|
|
90
|
+
import { Op, phase, build } from "@intentius/chant/op";
|
|
91
|
+
import { grafanaApply } from "@intentius/chant-lexicon-grafana";
|
|
92
|
+
|
|
93
|
+
export default Op({
|
|
94
|
+
name: "grafana-prod",
|
|
95
|
+
phases: [
|
|
96
|
+
phase("Build", [build(".", { script: "build:grafana" })]),
|
|
97
|
+
phase("Apply", [grafanaApply("dist/grafana.json", { environment: "prod", prune: true })]),
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Run it with `chant run grafana-prod`, or from an agent through the MCP `op-run`, `op-status` and `op-signal` tools. The applier creates folders parents first with their uids, writes library panels found in `__elements`, and sends each dashboard with the project's labels. A dashboard whose live content already matches is `unchanged` and not written; a panel title edited in the UI is put back. `prune` deletes only dashboards and folders labelled with this project's stack and env. It never touches UI-saved or file-provisioned dashboards, library panels, or anything on Grafana 11, and does nothing when no `ownership.stack` is set. Datasources still come from the provisioning file.
|
|
103
|
+
|
|
104
|
+
## A loop that keeps UI edits
|
|
105
|
+
|
|
106
|
+
1. `chant lifecycle diff prod --live` shows the edit.
|
|
107
|
+
2. Either change the source to match and rebuild, or `chant import --from prod --name <uid>` to pull the dashboard, then copy the changed panel over.
|
|
108
|
+
3. Apply, or let provisioning reload, and diff again. It should report nothing.
|
|
@@ -25,7 +25,7 @@ docker run -p 3000:3000 \
|
|
|
25
25
|
|
|
26
26
|
## Kubernetes
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Use `GrafanaConfigMaps({ entities, namespace })` from `@intentius/chant-lexicon-grafana/k8s` in a k8s build root. It writes one ConfigMap per dashboard labelled `grafana_dashboard: "1"`, with the folder in the `k8s-sidecar-target-directory` annotation. The datasource file goes in a ConfigMap labelled `grafana_datasource: "1"`, and the provider file in a third. The Grafana Helm chart's sidecar picks these up as they are. For a Grafana without the sidecar, spread `grafanaVolumes({ entities })`'s `volumes` and `volumeMounts` into the Deployment: provisioning goes under `/etc/grafana/provisioning`, and each dashboard folder gets a projected volume of its own. `grafanaFiles(entities)` still returns every file by path for any other layout.
|
|
29
29
|
|
|
30
30
|
## Changing where dashboards live
|
|
31
31
|
|
|
@@ -35,8 +35,8 @@ Declare a `DashboardProvider` to change the mount path, pin a folder, or allow U
|
|
|
35
35
|
export const provider = new DashboardProvider({ name: "team", path: "/dashboards", allowUiUpdates: true });
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
With no provider declared, chant writes one named `chant` that reads `/var/lib/grafana/dashboards` and maps subdirectories to folders.
|
|
38
|
+
With no provider declared, chant writes one named `chant` that reads `/var/lib/grafana/dashboards` and maps subdirectories to folders. A provider with `folder` set puts every dashboard in that folder and ignores the dashboards' own `folder`; GRAF109 warns. Two providers on the same or nested paths load every dashboard twice, which GRAF109 reports as an error. A dashboard `folder` of `"Platform/Kubernetes"` nests on Grafana 13.1 and later.
|
|
39
39
|
|
|
40
40
|
## Checking before Grafana does
|
|
41
41
|
|
|
42
|
-
`chant lint` and `chant build` run
|
|
42
|
+
`chant lint` and `chant build` run the GRAF1xx checks on the output, including a check against Grafana's dashboard schema at the pinned version, a PromQL syntax check on every query sent to a Prometheus, and a check that the providers put each dashboard in its declared folder, once. To check against a real Grafana, the lexicon's `import.test.ts` boots `grafana/grafana` with Docker, provisions the example and reads each dashboard back over the HTTP API.
|