@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,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed step builder for this lexicon's activity (chant #1288 Stage 2),
|
|
3
|
+
* beside its `*Args` interface for the reason `lexicons/k8s/src/op/builders.ts`
|
|
4
|
+
* gives: core cannot import a lexicon's types. `opts` is
|
|
5
|
+
* {@link GrafanaApplyArgs} itself (via `Omit`/`WithStepRefs`), never
|
|
6
|
+
* restated.
|
|
7
|
+
*/
|
|
8
|
+
import { type ActivityStep, type NamedActivityStep, type WithStepRefs } from "@intentius/chant/op";
|
|
9
|
+
import type { GrafanaApplyArgs } from "./activities/grafana-apply.js";
|
|
10
|
+
/** Extra opts the builder accepts alongside the activity's own fields. */
|
|
11
|
+
type StepOpts = {
|
|
12
|
+
profile?: ActivityStep["profile"];
|
|
13
|
+
id?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Apply a grafana build to the environment's Grafana over its HTTP API
|
|
17
|
+
* (#2948): folders, library panels and dashboards, stamped with chant's
|
|
18
|
+
* ownership labels, and with `prune`, this project's orphans deleted.
|
|
19
|
+
* `opts` is {@link GrafanaApplyArgs} minus the positional `indexPath`.
|
|
20
|
+
* Defaults to the `longInfra` profile, as the other API appliers do.
|
|
21
|
+
*/
|
|
22
|
+
export declare const grafanaApply: (indexPath: string, opts?: WithStepRefs<Omit<GrafanaApplyArgs, "indexPath">> & StepOpts) => NamedActivityStep;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,0EAA0E;AAC1E,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GACvB,WAAW,MAAM,EACjB,OAAO,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC,GAAG,QAAQ,KAClE,iBAGF,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whose a live dashboard is (#2946).
|
|
3
|
+
*
|
|
4
|
+
* `serializer.ts` used to say Grafana had no metadata channel. It has two,
|
|
5
|
+
* both on the `dashboard.grafana.app` resource and neither in the dashboard
|
|
6
|
+
* JSON:
|
|
7
|
+
*
|
|
8
|
+
* - **`metadata.labels`**, which Grafana keeps as written for a dashboard
|
|
9
|
+
* created or updated through `/apis`. chant's marker there is the shared
|
|
10
|
+
* Kubernetes label convention, `LABEL_OWNERSHIP_KEYS`
|
|
11
|
+
* (`app.kubernetes.io/managed-by: chant` plus the stack and env labels).
|
|
12
|
+
* The API applier (#2948) stamps it with {@link grafanaOwnershipLabels};
|
|
13
|
+
* this reads it back, stack and env included.
|
|
14
|
+
* - **`metadata.annotations`**, which Grafana writes itself for a
|
|
15
|
+
* file-provisioned dashboard: `grafana.app/managedBy:
|
|
16
|
+
* classic-file-provisioning` and `grafana.app/managerId: <provider name>`.
|
|
17
|
+
* The provider name is the one chant writes into
|
|
18
|
+
* `provisioning/dashboards/chant.yaml` (`chant` unless a
|
|
19
|
+
* `DashboardProvider` names another), so a dashboard whose manager is one
|
|
20
|
+
* of the project's providers is chant's. That channel carries no stack or
|
|
21
|
+
* env, so it gives a verdict and never a marker.
|
|
22
|
+
*
|
|
23
|
+
* Anything else a read can see (a dashboard saved in the UI, one another
|
|
24
|
+
* provider or tool manages) is `foreign`.
|
|
25
|
+
*
|
|
26
|
+
* Two reads have no channel at all, and say `unknown` rather than guess:
|
|
27
|
+
* the legacy `/api/dashboards/uid` read Grafana 11 is observed through, and
|
|
28
|
+
* every datasource read (`/api/datasources` returns no labels, and the
|
|
29
|
+
* `readOnly` flag says a datasource is provisioned, not by whom).
|
|
30
|
+
*/
|
|
31
|
+
import { type ChannelKeys, type OwnershipMarker } from "@intentius/chant/ownership";
|
|
32
|
+
import type { LiveDashboard } from "./api/dashboards.js";
|
|
33
|
+
import type { LiveFolder } from "./api/folders.js";
|
|
34
|
+
/** The label keys chant's marker uses on a `dashboard.grafana.app` resource. */
|
|
35
|
+
export declare const GRAFANA_OWNERSHIP_KEYS: ChannelKeys;
|
|
36
|
+
export declare const MANAGED_BY_ANNOTATION = "grafana.app/managedBy";
|
|
37
|
+
export declare const MANAGER_ID_ANNOTATION = "grafana.app/managerId";
|
|
38
|
+
/** `grafana.app/managedBy` for a dashboard loaded by a file provider. */
|
|
39
|
+
export declare const FILE_PROVISIONING_MANAGER = "classic-file-provisioning";
|
|
40
|
+
/**
|
|
41
|
+
* The provider name the build writes when a project declares none. It is
|
|
42
|
+
* chant's managed-by value on purpose: it comes back from Grafana as the
|
|
43
|
+
* `grafana.app/managerId` of every dashboard the provider loads.
|
|
44
|
+
*/
|
|
45
|
+
export declare const DEFAULT_PROVIDER_NAME = "chant";
|
|
46
|
+
export type OwnershipVerdict = "owned" | "foreign" | "unknown";
|
|
47
|
+
/** The labels the API applier (#2948) writes on a dashboard it creates, for this build's stack and env. */
|
|
48
|
+
export declare function grafanaOwnershipLabels(ownership: {
|
|
49
|
+
stack: string;
|
|
50
|
+
env?: string;
|
|
51
|
+
}): Record<string, string>;
|
|
52
|
+
/**
|
|
53
|
+
* The provider names that load this project's dashboards: every declared
|
|
54
|
+
* `DashboardProvider`, or the default one the build writes when there is
|
|
55
|
+
* none.
|
|
56
|
+
*/
|
|
57
|
+
export declare function chantProviderNames(entities: Iterable<{
|
|
58
|
+
entityType: string;
|
|
59
|
+
props: Record<string, unknown>;
|
|
60
|
+
}>): Set<string>;
|
|
61
|
+
/** Why a verdict is what it is, for an `owned: true` read to put in its `filtered` detail. */
|
|
62
|
+
export declare function ownershipGap(dashboard: LiveDashboard): string;
|
|
63
|
+
/** A dashboard's ownership verdict, and the stack/env marker when its labels carry one. */
|
|
64
|
+
export declare function dashboardOwnership(dashboard: LiveDashboard, providers: ReadonlySet<string>): {
|
|
65
|
+
ownership: OwnershipVerdict;
|
|
66
|
+
marker?: OwnershipMarker;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* A folder's ownership verdict, read the way a dashboard's is: chant's labels
|
|
70
|
+
* (the API applier's), else the manager annotations Grafana writes on a
|
|
71
|
+
* folder that file provisioning made for one of this project's providers.
|
|
72
|
+
* A folder read over `/api/folders` (Grafana 11) has neither: `unknown`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function folderOwnership(folder: LiveFolder, providers: ReadonlySet<string>): {
|
|
75
|
+
ownership: OwnershipVerdict;
|
|
76
|
+
marker?: OwnershipMarker;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=ownership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership.d.ts","sourceRoot":"","sources":["../src/ownership.ts"],"names":[],"mappings":"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AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG;IAAE,SAAS,EAAE,gBAAgB,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,CAU7I"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-written option types for the built-in panels that have no schema.
|
|
3
|
+
*
|
|
4
|
+
* The alert list and flame graph panels define their options in TypeScript
|
|
5
|
+
* inside Grafana's frontend, with no CUE kind, so foundation-sdk publishes
|
|
6
|
+
* no JSON Schema for them and `npm run generate` has nothing to read. The
|
|
7
|
+
* types here follow Grafana's source at v13.2.2, cited per type. GRAF107
|
|
8
|
+
* checks these panels' envelope (the dashboard schema's `Panel`) but not
|
|
9
|
+
* their `options`; the traces panel is in the same position and keeps
|
|
10
|
+
* untyped options.
|
|
11
|
+
*/
|
|
12
|
+
import type { ThresholdsConfig, ValueMapping } from "./schema/dashboard.gen.js";
|
|
13
|
+
/**
|
|
14
|
+
* How the alert list orders rules: `SortOrder` in
|
|
15
|
+
* public/app/plugins/panel/alertlist/types.ts:4-10 (a numeric enum starting at 1).
|
|
16
|
+
* 1 alphabetical ascending, 2 descending, 3 by importance, 4 time ascending, 5 time descending.
|
|
17
|
+
*/
|
|
18
|
+
export type AlertListSortOrder = 1 | 2 | 3 | 4 | 5;
|
|
19
|
+
/** Which rule states the alert list shows: `StateFilter`, public/app/plugins/panel/alertlist/types.ts:22-30. */
|
|
20
|
+
export interface AlertListStateFilter {
|
|
21
|
+
firing: boolean;
|
|
22
|
+
pending: boolean;
|
|
23
|
+
/** Kept for dashboards saved before 9.x. */
|
|
24
|
+
inactive: boolean;
|
|
25
|
+
recovering: boolean;
|
|
26
|
+
noData: boolean;
|
|
27
|
+
normal: boolean;
|
|
28
|
+
error: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The alert list panel's options: `UnifiedAlertListOptions`,
|
|
32
|
+
* public/app/plugins/panel/alertlist/types.ts:32-49 at v13.2.2. Defaults are in
|
|
33
|
+
* public/app/plugins/panel/alertlist/module.tsx.
|
|
34
|
+
*/
|
|
35
|
+
export interface AlertListOptions {
|
|
36
|
+
maxItems: number;
|
|
37
|
+
sortOrder: AlertListSortOrder;
|
|
38
|
+
/** Only rules from the dashboard the panel is on. */
|
|
39
|
+
dashboardAlerts: boolean;
|
|
40
|
+
groupMode: "default" | "custom";
|
|
41
|
+
groupBy: string[];
|
|
42
|
+
alertName: string;
|
|
43
|
+
showInstances: boolean;
|
|
44
|
+
/** Only rules in this folder; null for any. */
|
|
45
|
+
folder: {
|
|
46
|
+
uid: string;
|
|
47
|
+
title: string;
|
|
48
|
+
} | null;
|
|
49
|
+
stateFilter: AlertListStateFilter;
|
|
50
|
+
alertInstanceLabelFilter: string;
|
|
51
|
+
/** The rule source's datasource name, or null for all. */
|
|
52
|
+
datasource: string | null;
|
|
53
|
+
viewMode: "list" | "stat";
|
|
54
|
+
showInactiveAlerts: boolean;
|
|
55
|
+
/** `BigValueColorMode`, packages/grafana-ui/src/components/BigValue/BigValueTypes.ts:8-13. */
|
|
56
|
+
statColorMode: "background" | "background_solid" | "none" | "value";
|
|
57
|
+
statThresholds: ThresholdsConfig;
|
|
58
|
+
statValueMappings: ValueMapping[];
|
|
59
|
+
}
|
|
60
|
+
/** The flame graph panel's options: `Options`, public/app/plugins/panel/flamegraph/types.ts:1-3 at v13.2.2. */
|
|
61
|
+
export interface FlameGraphOptions {
|
|
62
|
+
/** Hide the top table and show only the flame graph. */
|
|
63
|
+
showFlameGraphOnly: boolean;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=panel-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel-options.d.ts","sourceRoot":"","sources":["../src/panel-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,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AAwD;IACxD,kBAAkB,EAAE,OAAO,CAAC;CAC7B"}
|
package/dist/panels.d.ts
CHANGED
|
@@ -11,15 +11,17 @@
|
|
|
11
11
|
*
|
|
12
12
|
* `gridPos` is optional. A panel without `x` and `y` is placed by the
|
|
13
13
|
* dashboard: left to right in declaration order, wrapping at Grafana's
|
|
14
|
-
* 24-column width, below the previous row of panels
|
|
15
|
-
* placed exactly there
|
|
14
|
+
* 24-column width, below the previous row of panels, and around any cells
|
|
15
|
+
* already taken. A panel with both is placed exactly there and reserves its
|
|
16
|
+
* cells first; GRAF105 reports overlaps between explicit panels. A panel
|
|
17
|
+
* with only `x` or only `y` keeps that column or line.
|
|
16
18
|
*/
|
|
17
19
|
import type { Declarable } from "@intentius/chant/declarable";
|
|
18
20
|
import type { DeepPartial } from "./util.js";
|
|
19
21
|
import type { DatasourceInput, QueryEntity } from "./query.js";
|
|
20
22
|
import type { VariableEntity } from "./variables.js";
|
|
21
23
|
import type { SchemaName } from "./pin.js";
|
|
22
|
-
import type { DashboardLink,
|
|
24
|
+
import type { DashboardLink, FieldConfig, FieldConfigSource, GridPos } from "./schema/dashboard.gen.js";
|
|
23
25
|
import type * as timeseries from "./schema/timeseries.gen.js";
|
|
24
26
|
import type * as stat from "./schema/stat.gen.js";
|
|
25
27
|
import type * as gauge from "./schema/gauge.gen.js";
|
|
@@ -27,6 +29,19 @@ import type * as table from "./schema/table.gen.js";
|
|
|
27
29
|
import type * as logs from "./schema/logs.gen.js";
|
|
28
30
|
import type * as heatmap from "./schema/heatmap.gen.js";
|
|
29
31
|
import type * as text from "./schema/text.gen.js";
|
|
32
|
+
import type * as barchart from "./schema/barchart.gen.js";
|
|
33
|
+
import type * as bargauge from "./schema/bargauge.gen.js";
|
|
34
|
+
import type * as piechart from "./schema/piechart.gen.js";
|
|
35
|
+
import type * as statetimeline from "./schema/statetimeline.gen.js";
|
|
36
|
+
import type * as statushistory from "./schema/statushistory.gen.js";
|
|
37
|
+
import type * as histogram from "./schema/histogram.gen.js";
|
|
38
|
+
import type * as nodegraph from "./schema/nodegraph.gen.js";
|
|
39
|
+
import type * as xychart from "./schema/xychart.gen.js";
|
|
40
|
+
import type * as trend from "./schema/trend.gen.js";
|
|
41
|
+
import type * as canvas from "./schema/canvas.gen.js";
|
|
42
|
+
import type * as geomap from "./schema/geomap.gen.js";
|
|
43
|
+
import type { AlertListOptions, FlameGraphOptions } from "./panel-options.js";
|
|
44
|
+
import type { Transformation } from "./transformations.js";
|
|
30
45
|
/** `fieldConfig` with `defaults.custom` typed for the panel. */
|
|
31
46
|
export interface PanelFieldConfig<C> {
|
|
32
47
|
defaults?: DeepPartial<Omit<FieldConfig, "custom">> & {
|
|
@@ -51,7 +66,8 @@ export interface PanelProps<O = Record<string, unknown>, C = Record<string, unkn
|
|
|
51
66
|
/** The panel plugin's own options, typed from its schema. */
|
|
52
67
|
options?: DeepPartial<O>;
|
|
53
68
|
fieldConfig?: PanelFieldConfig<C>;
|
|
54
|
-
|
|
69
|
+
/** Typed per transformer: `{ id: "organize", options: { ... } }`, `transformation(id, options)`, or `customTransformation()` for an id or option the types don't know. */
|
|
70
|
+
transformations?: Transformation[];
|
|
55
71
|
links?: PanelLink[];
|
|
56
72
|
/** Repeat the panel once per value of this variable. */
|
|
57
73
|
repeat?: VariableEntity | string;
|
|
@@ -100,12 +116,12 @@ export declare function panelDefinitionFor(type: string): PanelDefinition | unde
|
|
|
100
116
|
*
|
|
101
117
|
* @example
|
|
102
118
|
* ```ts
|
|
103
|
-
* interface
|
|
119
|
+
* interface ClockOptions { mode?: "time" | "countdown"; clockType?: "24 hour" | "12 hour" }
|
|
104
120
|
*
|
|
105
|
-
* export const
|
|
106
|
-
* type: "
|
|
107
|
-
* className: "
|
|
108
|
-
* defaultSize: { w:
|
|
121
|
+
* export const ClockPanel = definePanel<ClockOptions>()({
|
|
122
|
+
* type: "grafana-clock-panel",
|
|
123
|
+
* className: "ClockPanel",
|
|
124
|
+
* defaultSize: { w: 6, h: 4 },
|
|
109
125
|
* });
|
|
110
126
|
* ```
|
|
111
127
|
*/
|
|
@@ -119,6 +135,19 @@ export declare const LogsPanel: PanelClass<"logs", logs.Options, Record<string,
|
|
|
119
135
|
export declare const TracesPanel: PanelClass<"traces", Record<string, unknown>, Record<string, unknown>>;
|
|
120
136
|
export declare const HeatmapPanel: PanelClass<"heatmap", heatmap.Options, heatmap.FieldConfig>;
|
|
121
137
|
export declare const TextPanel: PanelClass<"text", text.Options, Record<string, unknown>>;
|
|
138
|
+
export declare const BarChartPanel: PanelClass<"barchart", barchart.Options, barchart.FieldConfig>;
|
|
139
|
+
export declare const BarGaugePanel: PanelClass<"bargauge", bargauge.Options, Record<string, unknown>>;
|
|
140
|
+
export declare const PieChartPanel: PanelClass<"piechart", piechart.Options, piechart.HideableFieldConfig>;
|
|
141
|
+
export declare const StateTimelinePanel: PanelClass<"state-timeline", statetimeline.Options, statetimeline.FieldConfig>;
|
|
142
|
+
export declare const StatusHistoryPanel: PanelClass<"status-history", statushistory.Options, statushistory.FieldConfig>;
|
|
143
|
+
export declare const HistogramPanel: PanelClass<"histogram", histogram.Options, histogram.FieldConfig>;
|
|
144
|
+
export declare const NodeGraphPanel: PanelClass<"nodeGraph", nodegraph.Options, Record<string, unknown>>;
|
|
145
|
+
export declare const XYChartPanel: PanelClass<"xychart", xychart.Options, xychart.FieldConfig>;
|
|
146
|
+
export declare const TrendPanel: PanelClass<"trend", trend.Options, trend.GraphFieldConfig>;
|
|
147
|
+
export declare const CanvasPanel: PanelClass<"canvas", canvas.Options, Record<string, unknown>>;
|
|
148
|
+
export declare const GeomapPanel: PanelClass<"geomap", geomap.Options, Record<string, unknown>>;
|
|
149
|
+
export declare const FlameGraphPanel: PanelClass<"flamegraph", FlameGraphOptions, Record<string, unknown>>;
|
|
150
|
+
export declare const AlertListPanel: PanelClass<"alertlist", AlertListOptions, Record<string, unknown>>;
|
|
122
151
|
export interface RowProps {
|
|
123
152
|
title: string;
|
|
124
153
|
/** Collapsed rows keep their panels inside the row until opened. */
|
|
@@ -128,6 +157,14 @@ export interface RowProps {
|
|
|
128
157
|
repeat?: VariableEntity | string;
|
|
129
158
|
datasource?: DatasourceInput<any>;
|
|
130
159
|
id?: number;
|
|
160
|
+
/**
|
|
161
|
+
* The grid line the row header sits on. Without it, the row goes on the
|
|
162
|
+
* first free line below everything declared before it. A row header is
|
|
163
|
+
* always full width and one line high, so `y` is all it takes.
|
|
164
|
+
*/
|
|
165
|
+
gridPos?: {
|
|
166
|
+
y: number;
|
|
167
|
+
};
|
|
131
168
|
}
|
|
132
169
|
export interface RowEntity extends Declarable {
|
|
133
170
|
readonly props: RowProps;
|
package/dist/panels.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../src/panels.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../src/panels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,OAAO,EACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,KAAK,KAAK,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,KAAK,KAAK,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,KA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AAE,GAAG,CAAC,EAAE,CAAC;IACjC,sDAAsD;IACtD,MAAM,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAEjC,UAAU,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;IAClC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACzB;AAED,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B;AAID,4EAA4E;AAC5E,eAAO,MAAM,GAAG,EAEA,KAAK,KAAK,EAAE,QAAQ,KAAK,SAAS,CAAC;AAGnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D"}
|
package/dist/pin.d.ts
CHANGED
|
@@ -5,12 +5,19 @@
|
|
|
5
5
|
* kinds. `grafana/grafana-foundation-sdk` runs them through cog and
|
|
6
6
|
* publishes, beside its builder libraries, one JSON Schema per kind under
|
|
7
7
|
* `jsonschema/`. This lexicon vendors the files it uses into `src/spec/schemas/`
|
|
8
|
-
* (exact bytes, at the commit below)
|
|
9
|
-
*
|
|
8
|
+
* (exact bytes, at the commit below), applies the correction overlay in
|
|
9
|
+
* `src/spec/overlay/` (see `src/spec/overlay.ts`), and generates
|
|
10
|
+
* `src/schema/*.gen.ts` from the result. Nothing is fetched at build or test
|
|
11
|
+
* time.
|
|
12
|
+
*
|
|
13
|
+
* The types track Grafana 12.4 and 13.x: v0.0.20 is labelled with the
|
|
14
|
+
* v11.6.x kind registry, but its dashboard schema largely matches those
|
|
15
|
+
* releases, and the overlay covers the rest.
|
|
10
16
|
*
|
|
11
17
|
* Bumping the pin: change `ref` and `commit`, run `just fetch-schemas`
|
|
12
18
|
* (downloads and prints the new digests), paste the digests here, run
|
|
13
|
-
* `npm run generate
|
|
19
|
+
* `npm run generate` (it refuses overlay patches the new schemas already
|
|
20
|
+
* carry; delete those), and review the diff of `src/schema/`.
|
|
14
21
|
*/
|
|
15
22
|
export interface GrafanaSchemaPin {
|
|
16
23
|
/** Where the schema files come from. */
|
|
@@ -19,14 +26,29 @@ export interface GrafanaSchemaPin {
|
|
|
19
26
|
ref: string;
|
|
20
27
|
/** The exact commit the vendored files were taken from. */
|
|
21
28
|
commit: string;
|
|
22
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* The kind registry label the SDK publishes the schemas under. It lags the
|
|
31
|
+
* content: the v0.0.20 schemas are labelled v11.6.x and cover 12.4 and 13.x.
|
|
32
|
+
*/
|
|
23
33
|
kindRegistry: string;
|
|
24
34
|
/** sha256 of each vendored file, keyed by schema name (`src/spec/schemas/<name>.jsonschema.json`). */
|
|
25
|
-
files: Readonly<Record<
|
|
35
|
+
files: Readonly<Record<VendoredSchemaName, string>>;
|
|
26
36
|
}
|
|
27
|
-
export declare const SCHEMA_NAMES: readonly ["dashboard", "timeseries", "stat", "gauge", "table", "logs", "heatmap", "text", "prometheus", "tempo", "loki"];
|
|
37
|
+
export declare const SCHEMA_NAMES: readonly ["dashboard", "timeseries", "stat", "gauge", "table", "logs", "heatmap", "text", "barchart", "bargauge", "piechart", "statetimeline", "statushistory", "histogram", "nodegraph", "xychart", "trend", "canvas", "geomap", "prometheus", "tempo", "loki", "elasticsearch", "cloudwatch", "azuremonitor", "googlecloudmonitoring", "bigquery", "grafanapyroscope", "expr"];
|
|
28
38
|
export type SchemaName = (typeof SCHEMA_NAMES)[number];
|
|
39
|
+
/**
|
|
40
|
+
* Schemas vendored from the same commit for reading, not for types: no
|
|
41
|
+
* `.gen.ts` is generated from them and GRAF107 does not use them, since chant
|
|
42
|
+
* builds classic dashboards. `dashboardv2` is the v2 dashboard kind the
|
|
43
|
+
* importer reads (#2947); `src/import/v2.test.ts` checks the importer knows
|
|
44
|
+
* every key it defines.
|
|
45
|
+
*/
|
|
46
|
+
export declare const IMPORT_ONLY_SCHEMA_NAMES: readonly ["dashboardv2"];
|
|
47
|
+
export type ImportOnlySchemaName = (typeof IMPORT_ONLY_SCHEMA_NAMES)[number];
|
|
48
|
+
/** Every schema file under `src/spec/schemas/`. */
|
|
49
|
+
export type VendoredSchemaName = SchemaName | ImportOnlySchemaName;
|
|
50
|
+
export declare const VENDORED_SCHEMA_NAMES: readonly VendoredSchemaName[];
|
|
29
51
|
export declare const GRAFANA_SCHEMA_PIN: GrafanaSchemaPin;
|
|
30
52
|
/** The raw URL of one schema file at the pinned commit. */
|
|
31
|
-
export declare function schemaUrl(name:
|
|
53
|
+
export declare function schemaUrl(name: VendoredSchemaName, pin?: GrafanaSchemaPin): string;
|
|
32
54
|
//# sourceMappingURL=pin.d.ts.map
|
package/dist/pin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../src/pin.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pin.d.ts","sourceRoot":"","sources":["../src/pin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,sGAAsG;IACtG,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,YAAY,kXA8Bf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,0BAA2B,CAAC;AAEjE,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,mDAAmD;AACnD,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAEnE,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAAmD,CAAC;AAEnH,eAAO,MAAM,kBAAkB,EAAE,gBAqC/B,CAAC;AAEH,2DAA2D;AAC3D,wBAAgB,SAAS,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,GAAE,gBAAqC,GAAG,MAAM,CAEtG"}
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAmD9D;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,EAAE,aAkI3B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GRAF108: the PromQL a dashboard sends to Prometheus, syntax-checked with
|
|
3
|
+
* the prometheus lexicon's `checkPromql` (the grammar behind the Prometheus
|
|
4
|
+
* web UI's editor, `@prometheus-io/lezer-promql`).
|
|
5
|
+
*
|
|
6
|
+
* Only queries that reach a Prometheus datasource are parsed, as
|
|
7
|
+
* `datasourceUses()` resolves them: a query's own ref, else its panel's, a
|
|
8
|
+
* datasource variable's plugin type, or an undeclared ref's own `type`. A
|
|
9
|
+
* query whose datasource can't be told (no ref at all, a `-- Mixed --` panel
|
|
10
|
+
* query with none of its own) is left alone.
|
|
11
|
+
*
|
|
12
|
+
* Grafana interpolates template variables before Prometheus sees the query,
|
|
13
|
+
* so `$var`, `${var}`, `${var:format}`, `[[var]]` and the `$__` macros are
|
|
14
|
+
* replaced with a placeholder that parses where they stand: a duration
|
|
15
|
+
* inside `[...]` or after `offset`, a number for the `_ms`/`_s` macros and
|
|
16
|
+
* `$__from`/`$__to`, an identifier anywhere else. Inside a string literal
|
|
17
|
+
* they are left as they are.
|
|
18
|
+
*/
|
|
19
|
+
import { type KnownDatasource } from "./datasource-refs.js";
|
|
20
|
+
type Json = Record<string, unknown>;
|
|
21
|
+
export interface Substituted {
|
|
22
|
+
text: string;
|
|
23
|
+
/** Maps an offset in `text` back to one in the original query. */
|
|
24
|
+
originalOffset(at: number): number;
|
|
25
|
+
}
|
|
26
|
+
/** Replace every template variable outside a string literal with a placeholder that parses in its place. */
|
|
27
|
+
export declare function substituteTemplateVariables(query: string): Substituted;
|
|
28
|
+
export type PromqlSyntax = {
|
|
29
|
+
ok: true;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
message: string;
|
|
33
|
+
};
|
|
34
|
+
/** Check one query's PromQL syntax after substituting its template variables. */
|
|
35
|
+
export declare function checkGrafanaPromql(query: string): PromqlSyntax;
|
|
36
|
+
/**
|
|
37
|
+
* The PromQL inside a Prometheus query variable's query. Grafana handles
|
|
38
|
+
* `label_names()`, `label_values(selector, label)`, `metrics(regex)` and
|
|
39
|
+
* `query_result(expr)` itself and sends only the selector or expression; any
|
|
40
|
+
* other text is a series selector (`/api/v1/series?match[]=`).
|
|
41
|
+
*/
|
|
42
|
+
export declare function variablePromql(query: string): string[];
|
|
43
|
+
/** One piece of PromQL a dashboard sends to Prometheus, and where it is written. */
|
|
44
|
+
export interface PromqlUse {
|
|
45
|
+
where: string;
|
|
46
|
+
expr: string;
|
|
47
|
+
}
|
|
48
|
+
/** Every PromQL query a dashboard sends to Prometheus: panel queries, query variables and the library panels an export embeds in `__elements`. */
|
|
49
|
+
export declare function prometheusQueries(dashboard: Json, known: ReadonlyMap<string, KnownDatasource>): PromqlUse[];
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=promql-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promql-check.d.ts","sourceRoot":"","sources":["../src/promql-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAA+B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEtF,KAAK,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAsBpC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,4GAA4G;AAC5G,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CA0DtE;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAS9D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAWtD;AASD,oFAAoF;AACpF,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAuBD,kJAAkJ;AAClJ,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,SAAS,EAAE,CAa3G"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-written query models for the datasources that have no schema.
|
|
3
|
+
*
|
|
4
|
+
* PostgreSQL, MySQL and Microsoft SQL Server share one query model, defined
|
|
5
|
+
* in TypeScript in Grafana's `@grafana/sql` package with no CUE kind, so
|
|
6
|
+
* foundation-sdk publishes no JSON Schema for it and `npm run generate` has
|
|
7
|
+
* nothing to read. The types here follow `packages/grafana-sql/src` at
|
|
8
|
+
* Grafana v13.2.2, cited per type. The three plugins bundled with
|
|
9
|
+
* grafana/grafana:13.2.2 (grafana-postgresql-datasource 13.0.3, mysql 13.1.2,
|
|
10
|
+
* mssql 13.0.5) use this model unchanged. GRAF107 does not check these
|
|
11
|
+
* queries' fields; the dashboard schema's `Panel` still checks the panel.
|
|
12
|
+
*/
|
|
13
|
+
/** `QueryEditorExpressionType`, packages/grafana-sql/src/expressions.ts:34-42. */
|
|
14
|
+
export type SqlExpressionType = "property" | "operator" | "or" | "and" | "groupBy" | "function" | "functionParameter";
|
|
15
|
+
/** `QueryEditorProperty`, packages/grafana-sql/src/expressions.ts:5-8 (its type is the one-member `QueryEditorPropertyType`). */
|
|
16
|
+
export interface SqlProperty {
|
|
17
|
+
type: "string";
|
|
18
|
+
name?: string;
|
|
19
|
+
}
|
|
20
|
+
/** `QueryEditorFunctionParameterExpression`, packages/grafana-sql/src/expressions.ts:64-67. */
|
|
21
|
+
export interface SqlFunctionParameterExpression {
|
|
22
|
+
type: "functionParameter";
|
|
23
|
+
name?: string;
|
|
24
|
+
}
|
|
25
|
+
/** `QueryEditorFunctionExpression`, packages/grafana-sql/src/expressions.ts:57-62: a selected column, optionally wrapped in an aggregation. */
|
|
26
|
+
export interface SqlFunctionExpression {
|
|
27
|
+
type: "function";
|
|
28
|
+
name?: string;
|
|
29
|
+
alias?: string;
|
|
30
|
+
parameters?: SqlFunctionParameterExpression[];
|
|
31
|
+
}
|
|
32
|
+
/** `QueryEditorGroupByExpression`, packages/grafana-sql/src/expressions.ts:52-55. */
|
|
33
|
+
export interface SqlGroupByExpression {
|
|
34
|
+
type: "groupBy";
|
|
35
|
+
property: SqlProperty;
|
|
36
|
+
}
|
|
37
|
+
/** `QueryEditorPropertyExpression`, packages/grafana-sql/src/expressions.ts:29-32. */
|
|
38
|
+
export interface SqlPropertyExpression {
|
|
39
|
+
type: "property";
|
|
40
|
+
property: SqlProperty;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The visual builder's query: `SQLExpression`, packages/grafana-sql/src/types.ts:67-77.
|
|
44
|
+
* `whereJsonTree` is react-awesome-query-builder's `JsonTree`, carried as data.
|
|
45
|
+
*/
|
|
46
|
+
export interface SqlBuilderQuery {
|
|
47
|
+
columns?: SqlFunctionExpression[];
|
|
48
|
+
whereJsonTree?: Record<string, unknown>;
|
|
49
|
+
whereString?: string;
|
|
50
|
+
filters?: Array<{
|
|
51
|
+
name: string;
|
|
52
|
+
value: string;
|
|
53
|
+
}>;
|
|
54
|
+
groupBy?: SqlGroupByExpression[];
|
|
55
|
+
orderBy?: SqlPropertyExpression;
|
|
56
|
+
orderByDirection?: "ASC" | "DESC";
|
|
57
|
+
limit?: number;
|
|
58
|
+
offset?: number;
|
|
59
|
+
}
|
|
60
|
+
/** `QueryFormat`, packages/grafana-sql/src/types.ts:39-42. */
|
|
61
|
+
export type SqlQueryFormat = "time_series" | "table";
|
|
62
|
+
/**
|
|
63
|
+
* A PostgreSQL, MySQL or MSSQL query: `SQLQuery`, packages/grafana-sql/src/types.ts:46-56,
|
|
64
|
+
* over `DataQuery` from @grafana/schema (refId, hide, key, queryType, datasource).
|
|
65
|
+
*
|
|
66
|
+
* In code mode (`editorMode: "code"`, `rawQuery: true`) `rawSql` is the
|
|
67
|
+
* query; in builder mode `dataset`, `table` and `sql` describe it and Grafana
|
|
68
|
+
* writes the generated SQL to `rawSql`.
|
|
69
|
+
*/
|
|
70
|
+
export interface SqlQueryModel {
|
|
71
|
+
refId?: string;
|
|
72
|
+
hide?: boolean;
|
|
73
|
+
key?: string;
|
|
74
|
+
queryType?: string;
|
|
75
|
+
datasource?: {
|
|
76
|
+
type?: string;
|
|
77
|
+
uid?: string;
|
|
78
|
+
};
|
|
79
|
+
/** The SQL, with Grafana's `$__timeFilter()` and other macros. */
|
|
80
|
+
rawSql?: string;
|
|
81
|
+
format?: SqlQueryFormat;
|
|
82
|
+
alias?: string;
|
|
83
|
+
dataset?: string;
|
|
84
|
+
table?: string;
|
|
85
|
+
sql?: SqlBuilderQuery;
|
|
86
|
+
/** `EditorMode` from @grafana/plugin-ui: the raw SQL editor or the visual builder. */
|
|
87
|
+
editorMode?: "code" | "builder";
|
|
88
|
+
rawQuery?: boolean;
|
|
89
|
+
/** `SQLQueryMeta`, packages/grafana-sql/src/types.ts:44: which columns a variable query takes its values and texts from. */
|
|
90
|
+
meta?: {
|
|
91
|
+
valueField?: string;
|
|
92
|
+
textField?: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=query-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-models.d.ts","sourceRoot":"","sources":["../src/query-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,UAAU,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,mBAAmB,CAAC;AAEtH,iIAAiI;AACjI,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+FAA+F;AAC/F,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,+IAA+I;AAC/I,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,8BAA8B,EAAE,CAAC;CAC/C;AAED,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,WAAW,CAAC;CACvB;AAED,sFA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