diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3cb63cf9969..77b60baf905 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -48,7 +48,7 @@ /docs/sources/whatsnew/ @jtvdez -/docs/sources/developer-resources/plugins/ @grafana/plugins-platform-frontend @grafana/plugins-platform-backend +/docs/sources/developers/plugins/ @grafana/plugins-platform-frontend @grafana/plugins-platform-backend /docs/sources/visualizations/dashboards/ @imatwawana /docs/sources/visualizations/panels-visualizations/ @imatwawana @@ -89,6 +89,7 @@ /apps/folder/ @grafana/grafana-app-platform-squad /apps/playlist/ @grafana/grafana-app-platform-squad /apps/plugins/ @grafana/plugins-platform-backend +/apps/collections/ @grafana/grafana-app-platform-squad @grafana/grafana-frontend-platform /apps/preferences/ @grafana/grafana-app-platform-squad @grafana/grafana-frontend-platform /apps/shorturl/ @grafana/sharing-squad /apps/secret/ @grafana/grafana-operator-experience-squad @@ -743,6 +744,14 @@ i18next.config.ts @grafana/grafana-frontend-platform # @grafana/api-clients /packages/grafana-api-clients/ @grafana/grafana-frontend-platform @grafana/grafana-search-navigate-organise +/packages/grafana-api-clients/src/clients/rtkq/advisor/ @grafana/plugins-platform-frontend +/packages/grafana-api-clients/src/clients/rtkq/correlations/ @grafana/datapro +/packages/grafana-api-clients/src/clients/rtkq/dashboard/ @grafana/dashboards-squad +/packages/grafana-api-clients/src/clients/rtkq/folder/ @grafana/grafana-search-navigate-organise +/packages/grafana-api-clients/src/clients/rtkq/iam/ @grafana/access-squad @grafana/identity-squad +/packages/grafana-api-clients/src/clients/rtkq/preferences/ @grafana/plugins-platform-frontend +/packages/grafana-api-clients/src/clients/rtkq/provisioning/ @grafana/grafana-git-ui-sync-team +/packages/grafana-api-clients/src/clients/rtkq/shorturl/ @grafana/sharing-squad # root files, mostly frontend /.browserslistrc @grafana/frontend-ops @@ -1101,6 +1110,7 @@ eslint-suppressions.json @grafanabot # Grafana Sharing Squad /public/app/features/dashboard-scene/sharing/ @grafana/sharing-squad /public/app/features/dashboard/components/ShareModal/ @grafana/sharing-squad +/public/app/features/dashboard/dashgrid/DashboardLibrary/ @grafana/sharing-squad /public/app/features/manage-dashboards/components/SnapshotListTable.tsx @grafana/sharing-squad /pkg/services/dashboardsnapshots/ @grafana/sharing-squad /public/app/features/explore/QueryLibrary/ @grafana/sharing-squad diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b06c637112d..925268df84a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -8,7 +8,9 @@ name: "CodeQL checks" on: workflow_dispatch: push: - branches: ['**'] # run on all branches + branches: + - main + - release-*.*.* paths-ignore: - '**/*.cue' - '**/*.json' @@ -74,6 +76,7 @@ jobs: name: Set go version uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 with: + cache: false go-version-file: go.mod # Initializes the CodeQL tools for scanning. diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 315c46f82c9..e1935fb46ad 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -212,6 +212,7 @@ jobs: run-id: ${{ github.run_id }} bucket-path: ${{ needs.setup.outputs.version }}_${{ github.run_id }} environment: prod + runs-on: ubuntu-x64-small publish-dockerhub: if: github.ref_name == 'main' diff --git a/.golangci.yml b/.golangci.yml index 33b2b9e8a19..3b7871662e2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -181,7 +181,9 @@ linters: - pkg: io/ioutil desc: 'Deprecated: As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.' - pkg: gopkg.in/yaml.v2 - desc: Grafana packages are not allowed to depend on gopkg.in/yaml.v2 as gopkg.in/yaml.v3 is now available + desc: use go.yaml.in/yaml/v3 instead + - pkg: gopkg.in/yaml.v3 + desc: use go.yaml.in/yaml/v3 instead - pkg: github.com/pkg/errors desc: 'Deprecated: Go 1.13 supports the functionality provided by pkg/errors in the standard library.' - pkg: github.com/xorcare/pointer diff --git a/CHANGELOG.md b/CHANGELOG.md index b1e53f42f32..a4dfcb3171a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,251 @@ + + +# 12.3.0 (2025-11-19) + +### Features and enhancements + +- **API Clients:** Add lazy hooks to clients [#113226](https://github.com/grafana/grafana/pull/113226), [@tomratcliffe](https://github.com/tomratcliffe) +- **API clients:** Automatically set PATCH headers [#111879](https://github.com/grafana/grafana/pull/111879), [@Clarity-89](https://github.com/Clarity-89) +- **API clients:** Extract into a package [#111810](https://github.com/grafana/grafana/pull/111810), [@Clarity-89](https://github.com/Clarity-89) +- **API clients:** Extract into a package (Enterprise) +- **API clients:** Update API clients to include all endpoints & add hooks [#113061](https://github.com/grafana/grafana/pull/113061), [@tomratcliffe](https://github.com/tomratcliffe) +- **AccessControl:** Include hidden roles in service account role display [#112924](https://github.com/grafana/grafana/pull/112924), [@Jguer](https://github.com/Jguer) +- **AccessControl:** Increase limit of LBAC for Datasources rules [#111560](https://github.com/grafana/grafana/pull/111560), [@Jguer](https://github.com/Jguer) +- **Accessibility:** Wrap data source info onto 2 lines at small viewports [#113033](https://github.com/grafana/grafana/pull/113033), [@ashharrison90](https://github.com/ashharrison90) +- **Alert Enrichment:** Add mutator to insert rule UID labels to allow for efficient use of labelSelector (Enterprise) +- **Alerting:** Add enrichment components to rule view page (Enterprise) +- **Alerting:** Add enrichment section to rule view page (Enterprise) +- **Alerting:** Add jitter support for periodic alert state storage to reduce database load spikes [#111357](https://github.com/grafana/grafana/pull/111357), [@softho0n](https://github.com/softho0n) +- **Alerting:** Add position-based matching for identical alert rules [#112407](https://github.com/grafana/grafana/pull/112407), [@konrad147](https://github.com/konrad147) +- **Alerting:** Create alertingAlertRuleFormSchema in restrictedGrafanaApis [#112794](https://github.com/grafana/grafana/pull/112794), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Display error message in central state history view [#111445](https://github.com/grafana/grafana/pull/111445), [@laurenashleigh](https://github.com/laurenashleigh) +- **Alerting:** Enrichment per rule wip-2 (Enterprise) +- **Alerting:** Hide metadata if grouping by folder [#113216](https://github.com/grafana/grafana/pull/113216), [@laurenashleigh](https://github.com/laurenashleigh) +- **Alerting:** Improve template ai helper prompt and add some examples (Enterprise) +- **Alerting:** Move enrichment tab between details and versions [#110886](https://github.com/grafana/grafana/pull/110886), [@laurenashleigh](https://github.com/laurenashleigh) +- **Alerting:** Remove ai feedback button from alert form [#112713](https://github.com/grafana/grafana/pull/112713), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Remove unused components [#111320](https://github.com/grafana/grafana/pull/111320), [@laurenashleigh](https://github.com/laurenashleigh) +- **Alerting:** Remove useRulesSourcesWithRuler for SmartAlertTypeDetector [#111623](https://github.com/grafana/grafana/pull/111623), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Surface remote AM silence creation errors properly [#112757](https://github.com/grafana/grafana/pull/112757), [@moustafab](https://github.com/moustafab) +- **Alerting:** Triage [#110339](https://github.com/grafana/grafana/pull/110339), [@gillesdemey](https://github.com/gillesdemey) +- **Alerting:** Triage rule details drawer [#112055](https://github.com/grafana/grafana/pull/112055), [@konrad147](https://github.com/konrad147) +- **Alerting:** Update prompt examples for template AI Helper (Enterprise) +- **Alerting:** Update width to instance details drawer in Triage page [#113209](https://github.com/grafana/grafana/pull/113209), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Use new enrichment endpoints in FE (Enterprise) +- **Alerting:** Use ruleUid as a prop instead of extracting it from the rule context (Enterprise) +- **Analytics:** Aggregate daily summary in datasources analytics (Enterprise) +- **Analytics:** Apply proper batching to Loki exports and add configurable settings (Enterprise) +- **Annotations:** Exclude internal dashboard id when saved via UID [#111535](https://github.com/grafana/grafana/pull/111535), [@ryantxu](https://github.com/ryantxu) +- **Azure:** Use SSO settings in plugin context [#112058](https://github.com/grafana/grafana/pull/112058), [@aangelisc](https://github.com/aangelisc) +- **Buttons:** Active style for buttons [#111235](https://github.com/grafana/grafana/pull/111235), [@gtk-grafana](https://github.com/gtk-grafana) +- **Caching:** Disable cache if datasource has oauthPassThru=true (Enterprise) +- **Canvas:** Allow non-icon bg image fields [#112308](https://github.com/grafana/grafana/pull/112308), [@fastfrwrd](https://github.com/fastfrwrd) +- **Chore:** Add logsdrilldown replace to apps/iam/go.mod [#112581](https://github.com/grafana/grafana/pull/112581), [@njvrzm](https://github.com/njvrzm) +- **CloudWatch Logs:** Don't add console link to every field in the logs response [#112230](https://github.com/grafana/grafana/pull/112230), [@idastambuk](https://github.com/idastambuk) +- **CloudWatch Logs:** Support Log Anomalies query type [#113067](https://github.com/grafana/grafana/pull/113067), [@idastambuk](https://github.com/idastambuk) +- **CloudWatch:** Add syntax highlighting and autocomplete for logs diff command [#111207](https://github.com/grafana/grafana/pull/111207), [@kevinwcyu](https://github.com/kevinwcyu) +- **CloudWatch:** Add tracking for logs anomalies [#113181](https://github.com/grafana/grafana/pull/113181), [@idastambuk](https://github.com/idastambuk) +- **Dashboard Controls:** Add annotations to the dashboard controls menu [#112816](https://github.com/grafana/grafana/pull/112816), [@leventebalogh](https://github.com/leventebalogh) +- **Dashboard Picker:** Update to use correct search + dashboards APIs [#112341](https://github.com/grafana/grafana/pull/112341), [@tomratcliffe](https://github.com/tomratcliffe) +- **Dashboard:** Backend always set `metricEditorMode: 0` regardless `metricQueryType` and `expression` [#111613](https://github.com/grafana/grafana/pull/111613), [@ivanortegaalba](https://github.com/ivanortegaalba) +- **Dashboards:** Add a new variable type called "Switch" [#111366](https://github.com/grafana/grafana/pull/111366), [@leventebalogh](https://github.com/leventebalogh) +- **Dashboards:** Hide error notifications in kiosk mode on dashboards [#112390](https://github.com/grafana/grafana/pull/112390), [@ivanortegaalba](https://github.com/ivanortegaalba) +- **Dynamic Dashboards:** Expand dashboards_init_dashboard_completed tracking info [#111102](https://github.com/grafana/grafana/pull/111102), [@idastambuk](https://github.com/idastambuk) +- **ErrorBoundary:** Report specific boundary type to Faro [#112071](https://github.com/grafana/grafana/pull/112071), [@tskarhed](https://github.com/tskarhed) +- **Explore:** Use compact mode only when targeting Tempo [#113037](https://github.com/grafana/grafana/pull/113037), [@ifrost](https://github.com/ifrost) +- **FeatureToggles:** Remove deprecated experimental apiserver [#111617](https://github.com/grafana/grafana/pull/111617), [@ryantxu](https://github.com/ryantxu) +- **Fields Selector:** Add component and integrate with Logs and Logs table visualization [#112534](https://github.com/grafana/grafana/pull/112534), [@matyax](https://github.com/matyax) +- **Flame Graph:** Anchor exact match when clicking a table symbol in search [#111101](https://github.com/grafana/grafana/pull/111101), [@samarthbagga-meesho](https://github.com/samarthbagga-meesho) +- **FlameGraph:** Improve prompt for open assistant to analyze flamegraph [#113071](https://github.com/grafana/grafana/pull/113071), [@simonswine](https://github.com/simonswine) +- **FolderPicker:** Don't show expand button for empty folders and move search icon [#111872](https://github.com/grafana/grafana/pull/111872), [@aocenas](https://github.com/aocenas) +- **FolderPicker:** Show parent folder when searching [#111026](https://github.com/grafana/grafana/pull/111026), [@aocenas](https://github.com/aocenas) +- **Geomap:** Add a MapLibre style base layer [#109841](https://github.com/grafana/grafana/pull/109841), [@remogeissbuehler](https://github.com/remogeissbuehler) +- **Geomap:** Move beta layers to GA [#113186](https://github.com/grafana/grafana/pull/113186), [@drew08t](https://github.com/drew08t) +- **Go:** Update to 1.25.2 + golangci-lint v2.5.0 + golang.org/x/net v0.45.0 [#112149](https://github.com/grafana/grafana/pull/112149), [@macabu](https://github.com/macabu) +- **Go:** Update to 1.25.3 [#112359](https://github.com/grafana/grafana/pull/112359), [@macabu](https://github.com/macabu) +- **Grafana Advisor:** Prometheus Type Migration check [#110853](https://github.com/grafana/grafana/pull/110853), [@bossinc](https://github.com/bossinc) +- **Grafana Data Source:** Add random walk configuration options [#113009](https://github.com/grafana/grafana/pull/113009), [@nmarrs](https://github.com/nmarrs) +- **IAM:** Add uid column in team_member DB table [#112439](https://github.com/grafana/grafana/pull/112439), [@dmihai](https://github.com/dmihai) +- **Jaeger:** Migrate API calls to gRPC endpoint [#113297](https://github.com/grafana/grafana/pull/113297), [@jcolladokuri](https://github.com/jcolladokuri) +- **LBAC for data sources:** Provide user feedback of potential performance loss from LBAC rules (Enterprise) +- **Library Panels:** Remove direct use of legacy search [#112231](https://github.com/grafana/grafana/pull/112231), [@tomratcliffe](https://github.com/tomratcliffe) +- **Logs panel:** Respect selected fields for downloading logs [#111753](https://github.com/grafana/grafana/pull/111753), [@matyax](https://github.com/matyax) +- **Nav:** Render menu items as `p` tags so truncation logic can work [#113248](https://github.com/grafana/grafana/pull/113248), [@tomratcliffe](https://github.com/tomratcliffe) +- **Navigation:** Move Cost management and billing plugin to root [#111739](https://github.com/grafana/grafana/pull/111739), [@gubjanos](https://github.com/gubjanos) +- **PanelTimeCompare:** Support saving time compare window [#113150](https://github.com/grafana/grafana/pull/113150), [@torkelo](https://github.com/torkelo) +- **PanelTimeSettings:** Support panel time range settings changes from dashboard in view mode [#113027](https://github.com/grafana/grafana/pull/113027), [@torkelo](https://github.com/torkelo) +- **Plugins:** Install Grafana Pathfinder behind a feature flag [#109909](https://github.com/grafana/grafana/pull/109909), [@Jayclifford345](https://github.com/Jayclifford345) +- **PostgreSQL:** Support PGPASSFILE by making password optional [#108856](https://github.com/grafana/grafana/pull/108856), [@taraspos](https://github.com/taraspos) +- **Provisioning:** Watch file system for changes [#112184](https://github.com/grafana/grafana/pull/112184), [@ryantxu](https://github.com/ryantxu) +- **Reporting:** Add support for schema v2 dashboards (Enterprise) +- **Reporting:** Wait for streaming to end before exporting CSVs (Enterprise) +- **SQL Expressions:** Add Functions to Allow list [#113291](https://github.com/grafana/grafana/pull/113291), [@kylebrandt](https://github.com/kylebrandt) +- **Snapshots:** Use appSubUrl for View all snapshots [#111652](https://github.com/grafana/grafana/pull/111652), [@Clarity-89](https://github.com/Clarity-89) +- **Span Details:** Bring back span id to span details [#112411](https://github.com/grafana/grafana/pull/112411), [@ifrost](https://github.com/ifrost) +- **Span Details:** Wrap label values [#112413](https://github.com/grafana/grafana/pull/112413), [@ifrost](https://github.com/ifrost) +- **Stars:** Refactor StarsToolbarButton and unify nav update logic [#112582](https://github.com/grafana/grafana/pull/112582), [@tomratcliffe](https://github.com/tomratcliffe) +- **Stat/BarGauge:** Border radius tweak [#112562](https://github.com/grafana/grafana/pull/112562), [@torkelo](https://github.com/torkelo) +- **Table:** Add some error-case handling to ImageCell [#110461](https://github.com/grafana/grafana/pull/110461), [@fastfrwrd](https://github.com/fastfrwrd) +- **Table:** Allow FieldType.other containing arrays to use Pills [#111205](https://github.com/grafana/grafana/pull/111205), [@fastfrwrd](https://github.com/fastfrwrd) +- **Table:** Disable virtualization, hover overflow, and scrollbar width resizing on Safari 26 [#111834](https://github.com/grafana/grafana/pull/111834), [@fastfrwrd](https://github.com/fastfrwrd) +- **Table:** Pill and JSON Cells should allow formatting [#111951](https://github.com/grafana/grafana/pull/111951), [@fastfrwrd](https://github.com/fastfrwrd) +- **Table:** Support DataLinks and Actions in SparklineCell [#112244](https://github.com/grafana/grafana/pull/112244), [@fastfrwrd](https://github.com/fastfrwrd) +- **Table:** Update ad-hoc filter to use name instead of displayName [#112815](https://github.com/grafana/grafana/pull/112815), [@fastfrwrd](https://github.com/fastfrwrd) +- **Tempo:** Migrates tags and tag values to datasource backend CallResource requests (Enterprise) +- **Theme:** Changes light theme canvas color a more white shade [#111318](https://github.com/grafana/grafana/pull/111318), [@torkelo](https://github.com/torkelo) +- **Themes:** Update themes border radius [#111478](https://github.com/grafana/grafana/pull/111478), [@torkelo](https://github.com/torkelo) +- **TimeComparison:** Automatically show/hide menu on hover [#112750](https://github.com/grafana/grafana/pull/112750), [@jesdavpet](https://github.com/jesdavpet) +- **TimeSeries:** Allow custom time units on x-axis [#112913](https://github.com/grafana/grafana/pull/112913), [@leeoniya](https://github.com/leeoniya) +- **Timeseries:** Numeric duration values could render as NaN (#73795) [#112076](https://github.com/grafana/grafana/pull/112076), [@fastfrwrd](https://github.com/fastfrwrd) +- **Transformations:** Hide "Match all/any" conditions for less than two filters [#109754](https://github.com/grafana/grafana/pull/109754), [@sudoice](https://github.com/sudoice) +- **UI Extensions:** Remove path validation from link extensions [#112259](https://github.com/grafana/grafana/pull/112259), [@leventebalogh](https://github.com/leventebalogh) + +### Bug fixes + +- **Access Control:** Fix the permission checks for saving/updating/deleting annotations [#112953](https://github.com/grafana/grafana/pull/112953), [@IevaVasiljeva](https://github.com/IevaVasiljeva) +- **Accessibility:** Improve no-unreduced-motion rule and fix violations [#110304](https://github.com/grafana/grafana/pull/110304), [@tomratcliffe](https://github.com/tomratcliffe) +- **Alerting Provisioning:** Don't error on recording rules without conditions [#109410](https://github.com/grafana/grafana/pull/109410), [@djpnicholls](https://github.com/djpnicholls) +- **Alerting:** Clear outdated settings when switching contact point type [#111869](https://github.com/grafana/grafana/pull/111869), [@konrad147](https://github.com/konrad147) +- **Alerting:** Fix enrichment tab to be rendered only for grafana alerting rules [#113030](https://github.com/grafana/grafana/pull/113030), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Fix instances matching in notification policies [#112326](https://github.com/grafana/grafana/pull/112326), [@konrad147](https://github.com/konrad147) +- **Alerting:** Fix threshold params [#111645](https://github.com/grafana/grafana/pull/111645), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **Alerting:** Fix unmarshalling of GettableStatus to include time intervals [#112602](https://github.com/grafana/grafana/pull/112602), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **Alerting:** Migrate `spec.title` and `spec.name` fieldSelectors [#111993](https://github.com/grafana/grafana/pull/111993), [@gillesdemey](https://github.com/gillesdemey) +- **Alerting:** Normalize health when filtering rules [#113087](https://github.com/grafana/grafana/pull/113087), [@gillesdemey](https://github.com/gillesdemey) +- **Alerting:** Prohibit receivers with empty name [#113064](https://github.com/grafana/grafana/pull/113064), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **Alerting:** Provisioning to fix contact point type on save [#112246](https://github.com/grafana/grafana/pull/112246), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **Alerting:** Remove \_\_grafana_origin when duplicating rule [#112396](https://github.com/grafana/grafana/pull/112396), [@soniaAguilarPeiron](https://github.com/soniaAguilarPeiron) +- **AnnoList:** Fix annotations not loading when in a repeated row [#111540](https://github.com/grafana/grafana/pull/111540), [@joshhunt](https://github.com/joshhunt) +- **Annotations:** Fix issue with transformation logic in scenes [#112288](https://github.com/grafana/grafana/pull/112288), [@fastfrwrd](https://github.com/fastfrwrd) +- **Auth:** Fix render user OAuth passthrough [#111636](https://github.com/grafana/grafana/pull/111636), [@charandas](https://github.com/charandas) +- **ComboBox:** Add loading state to dropdown and prefixIcon [#112967](https://github.com/grafana/grafana/pull/112967), [@tomratcliffe](https://github.com/tomratcliffe) +- **Connections:** Fix connections home page on enterprise [#111751](https://github.com/grafana/grafana/pull/111751), [@oshirohugo](https://github.com/oshirohugo) +- **Dashboard:** Fix editor specific permissions in /api [#113292](https://github.com/grafana/grafana/pull/113292), [@stephaniehingtgen](https://github.com/stephaniehingtgen) +- **Dashboards:** Fix bug with anon users with editor permissions creating dashboards [#113260](https://github.com/grafana/grafana/pull/113260), [@stephaniehingtgen](https://github.com/stephaniehingtgen) +- **Dashboards:** Fix missing Ctrl+O keyboard shortcut for crosshair toggle [#111310](https://github.com/grafana/grafana/pull/111310), [@ivanortegaalba](https://github.com/ivanortegaalba) +- **Dashboards:** Fix moving to root folder [#111515](https://github.com/grafana/grafana/pull/111515), [@stephaniehingtgen](https://github.com/stephaniehingtgen) +- **Dashboards:** Fix preload field not being persisted via /v1beta1 [#112475](https://github.com/grafana/grafana/pull/112475), [@ivanortegaalba](https://github.com/ivanortegaalba) +- **Flame Graph:** Use suffix for values formatted with a short formatter [#110999](https://github.com/grafana/grafana/pull/110999), [@ifrost](https://github.com/ifrost) +- **FlameGraph:** Ensure total is only counted once for recursive function calls [#111548](https://github.com/grafana/grafana/pull/111548), [@simonswine](https://github.com/simonswine) +- **FolderPermissions:** Return 404 error when folder does not exist instead of 500 [#112919](https://github.com/grafana/grafana/pull/112919), [@Jguer](https://github.com/Jguer) +- **FolderPicker:** Fix expand toggle also selecting folder [#111755](https://github.com/grafana/grafana/pull/111755), [@aocenas](https://github.com/aocenas) +- **Graphite:** Fix legacy response unmarshalling [#112968](https://github.com/grafana/grafana/pull/112968), [@aangelisc](https://github.com/aangelisc) +- **Histogram:** Properly handle sparse heatmap-cells frames [#112907](https://github.com/grafana/grafana/pull/112907), [@leeoniya](https://github.com/leeoniya) +- **LDAP Authentication:** Fix URL to propagate username context as parameter [#111723](https://github.com/grafana/grafana/pull/111723), [@bradleypettit](https://github.com/bradleypettit) +- **Node graph:** Fix context menu position after scrolling [#112374](https://github.com/grafana/grafana/pull/112374), [@adrapereira](https://github.com/adrapereira) +- **Playlist:** Fix navigation issues with emoji-titled dashboards during dual-write migration [#111659](https://github.com/grafana/grafana/pull/111659), [@axelavargas](https://github.com/axelavargas) +- **Plugin Details Page:** Fix tabs not loading on hard refresh [#112915](https://github.com/grafana/grafana/pull/112915), [@sunker](https://github.com/sunker) +- **Plugin navigation:** Fix active nav item selection when there are more than 10 items in a group [#112886](https://github.com/grafana/grafana/pull/112886), [@aocenas](https://github.com/aocenas) +- **Plugins:** Dependencies do not inherit parent URL for preinstall [#111762](https://github.com/grafana/grafana/pull/111762), [@wbrowne](https://github.com/wbrowne) +- **Plugins:** Set isProvisioned for local plugins without remote counterpart [#111268](https://github.com/grafana/grafana/pull/111268), [@oshirohugo](https://github.com/oshirohugo) +- **Prometheus:** Fix incremental querying logic for public dashboards [#111642](https://github.com/grafana/grafana/pull/111642), [@jcolladokuri](https://github.com/jcolladokuri) +- **Prometheus:** Fix parsing logic of prometheus expressions to honor the order of binary operations [#112220](https://github.com/grafana/grafana/pull/112220), [@jcolladokuri](https://github.com/jcolladokuri) +- **Security:** fix for CVE-2025-41115 in SCIM (System for Cross-domain Identity Management) (Enterprise) +- **SoloPanel:** Fixes issue with solo route and scopes variable [#112769](https://github.com/grafana/grafana/pull/112769), [@torkelo](https://github.com/torkelo) +- **Stars:** Fix starred state not being updated [#111936](https://github.com/grafana/grafana/pull/111936), [@Clarity-89](https://github.com/Clarity-89) +- **Stat:** Fix math for percent change value heights when sparkline is not rendered [#112599](https://github.com/grafana/grafana/pull/112599), [@fastfrwrd](https://github.com/fastfrwrd) +- **StateTimeline:** Fix color display in tooltip [#112878](https://github.com/grafana/grafana/pull/112878), [@fastfrwrd](https://github.com/fastfrwrd) +- **Table:** Fix cell inspect for Sparkline and inferred JSON cells [#113059](https://github.com/grafana/grafana/pull/113059), [@fastfrwrd](https://github.com/fastfrwrd) +- **TextPanel:** Fix `CodeEditor` not appearing properly [#111937](https://github.com/grafana/grafana/pull/111937), [@ashharrison90](https://github.com/ashharrison90) +- **UnitPicker/Cascader:** Fixes type to search for unit feature [#112614](https://github.com/grafana/grafana/pull/112614), [@torkelo](https://github.com/torkelo) +- **VizTooltip:** Better overflow handling on long series names [#112240](https://github.com/grafana/grafana/pull/112240), [@fastfrwrd](https://github.com/fastfrwrd) + +### Breaking changes + +- **Faro:** Update configuration with best practices [#112108](https://github.com/grafana/grafana/pull/112108), [@joshhunt](https://github.com/joshhunt) +- **LibraryPanels:** Remove unique name constraints [#113077](https://github.com/grafana/grafana/pull/113077), [@ryantxu](https://github.com/ryantxu) +- **RBAC:** Only write action sets [#112429](https://github.com/grafana/grafana/pull/112429), [@IevaVasiljeva](https://github.com/IevaVasiljeva) + +### Plugin development fixes & changes + +- **Checkbox:** Improve accessibility of the `indeterminate` state [#112388](https://github.com/grafana/grafana/pull/112388), [@ashharrison90](https://github.com/ashharrison90) +- **Collapse:** Improve layout and deprecate `collapsible` prop [#113164](https://github.com/grafana/grafana/pull/113164), [@ashharrison90](https://github.com/ashharrison90) +- **Docs:** Add storybook links to components [#113102](https://github.com/grafana/grafana/pull/113102), [@samsch](https://github.com/samsch) +- **Modal:** Fix button focus being clipped [#112867](https://github.com/grafana/grafana/pull/112867), [@ashharrison90](https://github.com/ashharrison90) +- **Slider:** Expose prop to control visibility of input [#113084](https://github.com/grafana/grafana/pull/113084), [@ashharrison90](https://github.com/ashharrison90) +- **Slider:** Make `inputId` a required param and fix minor a11y violations [#112006](https://github.com/grafana/grafana/pull/112006), [@ashharrison90](https://github.com/ashharrison90) + + + + +# 12.1.4 (2025-11-19) + +### Bug fixes + +- **Alerting:** Fix unmarshalling of GettableStatus to include time intervals [#112733](https://github.com/grafana/grafana/pull/112733), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **AnalyticsSummaries:** Fix dashboard rollup not resetting "last X days" metrics to zero (Enterprise) +- **AnalyticsSummaries:** Fix dashboard rollup totals resetting incorrectly (Enterprise) +- **Security:** fix for CVE-2025-41115 in SCIM (System for Cross-domain Identity Management) (Enterprise) + + + + +# 12.0.7 (2025-11-19) + +### Bug fixes + +- **Alerting:** Fix unmarshalling of GettableStatus to include time intervals [#112732](https://github.com/grafana/grafana/pull/112732), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **AnalyticsSummaries:** Fix dashboard rollup not resetting "last X days" metrics to zero (Enterprise) +- **AnalyticsSummaries:** Fix dashboard rollup totals resetting incorrectly (Enterprise) +- **Security:** fix for CVE-2025-41115 in SCIM (System for Cross-domain Identity Management) (Enterprise) + + + + +# 12.2.2 (2025-11-19) + +### Features and enhancements + +- **Access control:** Reduce memory usage when fetching user's permissions [#113414](https://github.com/grafana/grafana/pull/113414), [@hairyhenderson](https://github.com/hairyhenderson) +- **Table:** Pill and JSON Cells should allow formatting [#113130](https://github.com/grafana/grafana/pull/113130), [@fastfrwrd](https://github.com/fastfrwrd) + +### Bug fixes + +- **AnalyticsSummaries:** Fix dashboard rollup not resetting "last X days" metrics to zero (Enterprise) +- **AnalyticsSummaries:** Fix dashboard rollup totals resetting incorrectly (Enterprise) +- **Security:** fix for CVE-2025-41115 in SCIM (System for Cross-domain Identity Management) (Enterprise) + + + + +# 11.6.8 (2025-11-19) + +### Bug fixes + +- **Alerting:** Fix unmarshalling of GettableStatus to include time intervals [#112731](https://github.com/grafana/grafana/pull/112731), [@yuri-tceretian](https://github.com/yuri-tceretian) +- **AnalyticsSummaries:** Fix dashboard rollup not resetting "last X days" metrics to zero (Enterprise) +- **AnalyticsSummaries:** Fix dashboard rollup totals resetting incorrectly (Enterprise) +- **Seeder:** Add check in `filterRemovedPermissions` for already existing new permissions before seeding (Enterprise) + + + + +# 12.2.1+security-01 (2025-11-19) + +### Bug fixes + +- **Security:** fix for CVE-2025-41115 in SCIM (System for Cross-domain Identity Management) (Enterprise) + + + + +# 12.1.3+security-01 (2025-11-19) + +### Bug fixes + +- **Security:** fix for CVE-2025-41115 in SCIM (System for Cross-domain Identity Management) (Enterprise) + + + + + +# 12.0.6+security-01 (2025-11-19) + +### Bug fixes + +- **Security:** fix for CVE-2025-41115 in SCIM (System for Cross-domain Identity Management) (Enterprise) + + # 12.2.1 (2025-10-21) diff --git a/Dockerfile b/Dockerfile index 7cb65f4a05f..c07eb0360e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -98,6 +98,7 @@ COPY apps/shorturl apps/shorturl COPY apps/annotation apps/annotation COPY apps/correlations apps/correlations COPY apps/preferences apps/preferences +COPY apps/collections apps/collections COPY apps/provisioning apps/provisioning COPY apps/secret apps/secret COPY apps/scope apps/scope @@ -106,7 +107,6 @@ COPY apps/logsdrilldown apps/logsdrilldown COPY apps/advisor apps/advisor COPY apps/dashboard apps/dashboard COPY apps/folder apps/folder -COPY apps/preferences apps/preferences COPY apps/iam apps/iam COPY apps apps COPY kindsv2 kindsv2 diff --git a/apps/advisor/go.mod b/apps/advisor/go.mod index 57d4647c7cf..9a3fabfd18c 100644 --- a/apps/advisor/go.mod +++ b/apps/advisor/go.mod @@ -6,11 +6,11 @@ require ( github.com/Masterminds/semver/v3 v3.4.0 github.com/google/go-cmp v0.7.0 github.com/google/go-github/v70 v70.0.0 - github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 + github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 github.com/grafana/grafana v0.0.0-00010101000000-000000000000 github.com/grafana/grafana-app-sdk v0.48.2 github.com/grafana/grafana-app-sdk/logging v0.48.1 - github.com/grafana/grafana-plugin-sdk-go v0.281.0 + github.com/grafana/grafana-plugin-sdk-go v0.283.0 github.com/grafana/grafana/pkg/apimachinery v0.0.0 github.com/stretchr/testify v1.11.1 k8s.io/apimachinery v0.34.2 @@ -62,7 +62,7 @@ require ( github.com/apache/arrow-go/v18 v18.4.1 // indirect github.com/armon/go-metrics v0.4.1 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/at-wat/mqtt-go v0.19.4 // indirect + github.com/at-wat/mqtt-go v0.19.6 // indirect github.com/aws/aws-sdk-go v1.55.7 // indirect github.com/aws/aws-sdk-go-v2 v1.39.1 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.18.14 // indirect @@ -147,7 +147,7 @@ require ( github.com/google/go-querystring v1.1.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/google/wire v0.7.0 // indirect - github.com/grafana/alerting v0.0.0-20251009192429-9427c24835ae // indirect + github.com/grafana/alerting v0.0.0-20251119204204-77fa75125181 // indirect github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f // indirect github.com/grafana/dataplane/sdata v0.0.9 // indirect github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 // indirect @@ -160,7 +160,7 @@ require ( github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect github.com/grafana/sqlds/v4 v4.2.7 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect @@ -232,7 +232,7 @@ require ( github.com/prometheus/alertmanager v0.28.0 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect github.com/prometheus/exporter-toolkit v0.14.0 // indirect github.com/prometheus/procfs v0.16.1 // indirect @@ -279,7 +279,7 @@ require ( golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9 // indirect golang.org/x/mod v0.30.0 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54 // indirect diff --git a/apps/advisor/go.sum b/apps/advisor/go.sum index a7c25c01ab7..ef7adf779d1 100644 --- a/apps/advisor/go.sum +++ b/apps/advisor/go.sum @@ -166,8 +166,8 @@ github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/at-wat/mqtt-go v0.19.4 h1:R2cbCU7O5PHQ38unbe1Y51ncG3KsFEJV6QeipDoqdLQ= -github.com/at-wat/mqtt-go v0.19.4/go.mod h1:AsiWc9kqVOhqq7LzUeWT/AkKUBfx3Sw5cEe8lc06fqA= +github.com/at-wat/mqtt-go v0.19.6 h1:+jo59yGHB3oqBU8nSFYbq6KDgN4ngMpqts5Qtyq61pc= +github.com/at-wat/mqtt-go v0.19.6/go.mod h1:Y/YrYwUlLE4N53//699Zir3WJnxSdJojvLEAbZxJjgQ= github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE= @@ -647,12 +647,12 @@ github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2z github.com/gorilla/mux v1.7.1/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/grafana/alerting v0.0.0-20251009192429-9427c24835ae h1:NLPwY3tIP0lg0g9wTRiMcypm6VRXW6W+MOLBsq8JSVA= -github.com/grafana/alerting v0.0.0-20251009192429-9427c24835ae/go.mod h1:VGjS5gDwWEADPP6pF/drqLxEImgeuHlEW5u8E5EfIrM= +github.com/grafana/alerting v0.0.0-20251119204204-77fa75125181 h1:nbxKRtrbuhvOYmI2RhOYauHRJCtpR+vTNIgg1lFUCws= +github.com/grafana/alerting v0.0.0-20251119204204-77fa75125181/go.mod h1:VtPNIFlEOJPPEc13Ax6ZTbNV3M/sAzLID72YjgzOPVA= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f h1:Cbm6OKkOcJ+7CSZsGsEJzktC/SIa5bxVeYKQLuYK86o= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f/go.mod h1:axY0cdOg3q0TZHwpHnIz5x16xZ8ZBxJHShsSHHXcHQg= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 h1:qEwZ+7MbPjzRvTi31iT9w7NBhKIpKwZrFbYmOZLqkwA= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 h1:Muoy+FMGrHj3GdFbvsMzUT7eusgii9PKf9L1ZaXDDbY= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= github.com/grafana/dataplane/examples v0.0.1 h1:K9M5glueWyLoL4//H+EtTQq16lXuHLmOhb6DjSCahzA= github.com/grafana/dataplane/examples v0.0.1/go.mod h1:h5YwY8s407/17XF5/dS8XrUtsTVV2RnuW8+m1Mp46mg= github.com/grafana/dataplane/sdata v0.0.9 h1:AGL1LZnCUG4MnQtnWpBPbQ8ZpptaZs14w6kE/MWfg7s= @@ -667,8 +667,8 @@ github.com/grafana/grafana-aws-sdk v1.3.0 h1:/bfJzP93rCel1GbWoRSq0oUo424MZXt8jAp github.com/grafana/grafana-aws-sdk v1.3.0/go.mod h1:VGycF0JkCGKND2O5je1ucOqPJ0ZNhZYzV3c2bNBAaGk= github.com/grafana/grafana-azure-sdk-go/v2 v2.3.1 h1:FFcEA01tW+SmuJIuDbHOdgUBL+d7DPrZ2N4zwzPhfGk= github.com/grafana/grafana-azure-sdk-go/v2 v2.3.1/go.mod h1:Oi4anANlCuTCc66jCyqIzfVbgLXFll8Wja+Y4vfANlc= -github.com/grafana/grafana-plugin-sdk-go v0.281.0 h1:V8dGyatzcOLQeivFhBV2JWMwTSZH/clDnpfKG9p3dTA= -github.com/grafana/grafana-plugin-sdk-go v0.281.0/go.mod h1:3I0g+v6jAwVmrt6BEjDUP4V6pkhGP5QKY5NkXY4Ayr4= +github.com/grafana/grafana-plugin-sdk-go v0.283.0 h1:G7IHshAr30rLWV9FtX3iLlFTTlBhuOkfe7xVAoIP5rE= +github.com/grafana/grafana-plugin-sdk-go v0.283.0/go.mod h1:20qhoYxIgbZRmwCEO1KMP8q2yq/Kge5+xE/99/hLEk0= github.com/grafana/grafana/pkg/promlib v0.0.8 h1:VUWsqttdf0wMI4j9OX9oNrykguQpZcruudDAFpJJVw0= github.com/grafana/grafana/pkg/promlib v0.0.8/go.mod h1:U1ezG/MGaEPoThqsr3lymMPN5yIPdVTJnDZ+wcXT+ao= github.com/grafana/grafana/pkg/semconv v0.0.0-20250804150913-990f1c69ecc2 h1:A65jWgLk4Re28gIuZcpC0aTh71JZ0ey89hKGE9h543s= @@ -687,8 +687,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDa github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 h1:uGoIog/wiQHI9GAxXO5TJbT0wWKH3O9HhOJW1F9c3fY= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340/go.mod h1:3bDW6wMZJB7tiONtC/1Xpicra6Wp5GgbTbQWCbI5fkc= @@ -1046,8 +1046,8 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/exporter-toolkit v0.14.0 h1:NMlswfibpcZZ+H0sZBiTjrA3/aBFHkNZqE+iCj5EmRg= @@ -1420,8 +1420,8 @@ golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/alerting/notifications/go.mod b/apps/alerting/notifications/go.mod index 70f4fbec82d..c29ea0b00a8 100644 --- a/apps/alerting/notifications/go.mod +++ b/apps/alerting/notifications/go.mod @@ -32,12 +32,12 @@ require ( github.com/go-openapi/swag/jsonname v0.25.1 // indirect github.com/go-test/deep v1.1.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v5 v5.3.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -59,7 +59,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -85,7 +85,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/alerting/notifications/go.sum b/apps/alerting/notifications/go.sum index 2ec24921942..b67c48676b8 100644 --- a/apps/alerting/notifications/go.sum +++ b/apps/alerting/notifications/go.sum @@ -77,8 +77,8 @@ github.com/grafana/grafana-app-sdk/logging v0.48.1 h1:veM0X5LAPyN3KsDLglWjIofndb github.com/grafana/grafana-app-sdk/logging v0.48.1/go.mod h1:Gh/nBWnspK3oDNWtiM5qUF/fardHzOIEez+SPI3JeHA= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 h1:uGoIog/wiQHI9GAxXO5TJbT0wWKH3O9HhOJW1F9c3fY= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340/go.mod h1:3bDW6wMZJB7tiONtC/1Xpicra6Wp5GgbTbQWCbI5fkc= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= @@ -140,8 +140,8 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1: github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= @@ -239,8 +239,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/alerting/rules/go.mod b/apps/alerting/rules/go.mod index f40848c1688..17aa567f077 100644 --- a/apps/alerting/rules/go.mod +++ b/apps/alerting/rules/go.mod @@ -5,7 +5,7 @@ go 1.25.3 require ( github.com/grafana/grafana-app-sdk v0.48.2 github.com/grafana/grafana-app-sdk/logging v0.48.1 - github.com/prometheus/common v0.67.1 + github.com/prometheus/common v0.67.3 k8s.io/apimachinery v0.34.2 k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 ) @@ -68,7 +68,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/alerting/rules/go.sum b/apps/alerting/rules/go.sum index b15ac884e9a..7eadc30e628 100644 --- a/apps/alerting/rules/go.sum +++ b/apps/alerting/rules/go.sum @@ -104,8 +104,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -165,8 +165,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/annotation/go.mod b/apps/annotation/go.mod index 90ed8b74a24..988575c7ce1 100644 --- a/apps/annotation/go.mod +++ b/apps/annotation/go.mod @@ -49,7 +49,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -68,7 +68,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/annotation/go.sum b/apps/annotation/go.sum index b15ac884e9a..7eadc30e628 100644 --- a/apps/annotation/go.sum +++ b/apps/annotation/go.sum @@ -104,8 +104,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -165,8 +165,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/collections/Makefile b/apps/collections/Makefile new file mode 100644 index 00000000000..bc8d6d30cb5 --- /dev/null +++ b/apps/collections/Makefile @@ -0,0 +1,10 @@ +include ../sdk.mk + +.PHONY: generate # Run Grafana App SDK code generation +generate: install-app-sdk update-app-sdk + @$(APP_SDK_BIN) generate \ + --source=./kinds/ \ + --gogenpath=./pkg/apis \ + --grouping=group \ + --genoperatorstate=false \ + --defencoding=none \ No newline at end of file diff --git a/apps/collections/go.mod b/apps/collections/go.mod new file mode 100644 index 00000000000..281a6579c67 --- /dev/null +++ b/apps/collections/go.mod @@ -0,0 +1,69 @@ +module github.com/grafana/grafana/apps/collections + +go 1.25.3 + +require ( + github.com/grafana/grafana-app-sdk v0.48.2 + github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250804150913-990f1c69ecc2 + github.com/stretchr/testify v1.11.1 + k8s.io/apimachinery v0.34.2 + k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 +) + +require ( + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/emicklei/go-restful/v3 v3.13.0 // indirect + github.com/fxamacker/cbor/v2 v2.9.0 // indirect + github.com/getkin/kin-openapi v0.133.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-openapi/jsonpointer v0.22.1 // indirect + github.com/go-openapi/jsonreference v0.21.2 // indirect + github.com/go-openapi/swag v0.23.0 // indirect + github.com/go-openapi/swag/jsonname v0.25.1 // indirect + github.com/go-test/deep v1.1.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gnostic-models v0.7.0 // indirect + github.com/grafana/grafana-app-sdk/logging v0.48.1 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mailru/easyjson v0.9.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect + github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect + github.com/perimeterx/marshmallow v1.1.5 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.23.2 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/procfs v0.16.1 // indirect + github.com/stretchr/objx v0.5.2 // indirect + github.com/woodsbury/decimal128 v1.3.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.yaml.in/yaml/v2 v2.4.3 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/term v0.37.0 // indirect + golang.org/x/text v0.31.0 // indirect + golang.org/x/time v0.14.0 // indirect + google.golang.org/protobuf v1.36.10 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/client-go v0.34.2 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect + sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect +) diff --git a/apps/collections/go.sum b/apps/collections/go.sum new file mode 100644 index 00000000000..8d576bfaa8b --- /dev/null +++ b/apps/collections/go.sum @@ -0,0 +1,187 @@ +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes= +github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/getkin/kin-openapi v0.133.0 h1:pJdmNohVIJ97r4AUFtEXRXwESr8b0bD721u/Tz6k8PQ= +github.com/getkin/kin-openapi v0.133.0/go.mod h1:boAciF6cXk5FhPqe/NQeBTeenbjqU4LhWBf09ILVvWE= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-openapi/jsonpointer v0.22.1 h1:sHYI1He3b9NqJ4wXLoJDKmUmHkWy/L7rtEo92JUxBNk= +github.com/go-openapi/jsonpointer v0.22.1/go.mod h1:pQT9OsLkfz1yWoMgYFy4x3U5GY5nUlsOn1qSBH5MkCM= +github.com/go-openapi/jsonreference v0.21.2 h1:Wxjda4M/BBQllegefXrY/9aq1fxBA8sI5M/lFU6tSWU= +github.com/go-openapi/jsonreference v0.21.2/go.mod h1:pp3PEjIsJ9CZDGCNOyXIQxsNuroxm8FAJ/+quA0yKzQ= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/swag/jsonname v0.25.1 h1:Sgx+qbwa4ej6AomWC6pEfXrA6uP2RkaNjA9BR8a1RJU= +github.com/go-openapi/swag/jsonname v0.25.1/go.mod h1:71Tekow6UOLBD3wS7XhdT98g5J5GR13NOTQ9/6Q11Zo= +github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= +github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= +github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grafana/grafana-app-sdk v0.48.2 h1:CQQDhwo1fWaXQVKvxxOcK6azbuY3E2TgJHNAZlYYn7U= +github.com/grafana/grafana-app-sdk v0.48.2/go.mod h1:LDOvQ7OOyHLcXdSa0InATCa5OMoYAd6E1+rGLrMgHuk= +github.com/grafana/grafana-app-sdk/logging v0.48.1 h1:veM0X5LAPyN3KsDLglWjIofndbGuf7MqnrDuDN+F/Ng= +github.com/grafana/grafana-app-sdk/logging v0.48.1/go.mod h1:Gh/nBWnspK3oDNWtiM5qUF/fardHzOIEez+SPI3JeHA= +github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250804150913-990f1c69ecc2 h1:X0cnaFdR+iz+sDSuoZmkryFSjOirchHe2MdKSRwBWgM= +github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250804150913-990f1c69ecc2/go.mod h1:RRvSjHH12/PnQaXraMO65jUhVu8n59mzvhfIMBETnV4= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4= +github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= +github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 h1:G7ERwszslrBzRxj//JalHPu/3yz+De2J+4aLtSRlHiY= +github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037/go.mod h1:2bpvgLBZEtENV5scfDFEtB/5+1M4hkQhDQrccEJ/qGw= +github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 h1:bQx3WeLcUWy+RletIKwUIt4x3t8n2SxavmoclizMb8c= +github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= +github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= +github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0= +github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= +go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU= +golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.34.2 h1:fsSUNZhV+bnL6Aqrp6O7lMTy6o5x2C4XLjnh//8SLYY= +k8s.io/api v0.34.2/go.mod h1:MMBPaWlED2a8w4RSeanD76f7opUoypY8TFYkSM+3XHw= +k8s.io/apimachinery v0.34.2 h1:zQ12Uk3eMHPxrsbUJgNF8bTauTVR2WgqJsTmwTE/NW4= +k8s.io/apimachinery v0.34.2/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +k8s.io/client-go v0.34.2 h1:Co6XiknN+uUZqiddlfAjT68184/37PS4QAzYvQvDR8M= +k8s.io/client-go v0.34.2/go.mod h1:2VYDl1XXJsdcAxw7BenFslRQX28Dxz91U9MWKjX97fE= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= +k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/apps/collections/kinds/cue.mod/module.cue b/apps/collections/kinds/cue.mod/module.cue new file mode 100644 index 00000000000..6280fd8f227 --- /dev/null +++ b/apps/collections/kinds/cue.mod/module.cue @@ -0,0 +1,4 @@ +module: "github.com/grafana/grafana/apps/preferences/kinds" +language: { + version: "v0.9.0" +} diff --git a/apps/collections/kinds/manifest.cue b/apps/collections/kinds/manifest.cue new file mode 100644 index 00000000000..8052da29431 --- /dev/null +++ b/apps/collections/kinds/manifest.cue @@ -0,0 +1,17 @@ +package preferences + +manifest: { + appName: "collections" + groupOverride: "collections.grafana.app" + versions: { + "v1alpha1": { + codegen: { + ts: {enabled: false} + go: {enabled: true} + } + kinds: [ + starsV1alpha1, + ] + } + } +} \ No newline at end of file diff --git a/apps/preferences/kinds/stars.cue b/apps/collections/kinds/stars.cue similarity index 100% rename from apps/preferences/kinds/stars.cue rename to apps/collections/kinds/stars.cue diff --git a/apps/collections/pkg/apis/collections/v1alpha1/constants.go b/apps/collections/pkg/apis/collections/v1alpha1/constants.go new file mode 100644 index 00000000000..4eb592236df --- /dev/null +++ b/apps/collections/pkg/apis/collections/v1alpha1/constants.go @@ -0,0 +1,18 @@ +package v1alpha1 + +import "k8s.io/apimachinery/pkg/runtime/schema" + +const ( + // APIGroup is the API group used by all kinds in this package + APIGroup = "collections.grafana.app" + // APIVersion is the API version used by all kinds in this package + APIVersion = "v1alpha1" +) + +var ( + // GroupVersion is a schema.GroupVersion consisting of the Group and Version constants for this package + GroupVersion = schema.GroupVersion{ + Group: APIGroup, + Version: APIVersion, + } +) diff --git a/apps/collections/pkg/apis/collections/v1alpha1/register.go b/apps/collections/pkg/apis/collections/v1alpha1/register.go new file mode 100644 index 00000000000..6b72ab94146 --- /dev/null +++ b/apps/collections/pkg/apis/collections/v1alpha1/register.go @@ -0,0 +1,58 @@ +package v1alpha1 + +import ( + "fmt" + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + + "github.com/grafana/grafana/pkg/apimachinery/utils" +) + +var StarsResourceInfo = utils.NewResourceInfo(APIGroup, APIVersion, + "stars", "stars", "Stars", + func() runtime.Object { return &Stars{} }, + func() runtime.Object { return &StarsList{} }, + utils.TableColumns{ + Definition: []metav1.TableColumnDefinition{ + {Name: "Name", Type: "string", Format: "name"}, + {Name: "Created At", Type: "date"}, + }, + Reader: func(obj any) ([]any, error) { + p, ok := obj.(*Stars) + if ok && p != nil { + return []any{ + p.Name, + p.CreationTimestamp.UTC().Format(time.RFC3339), + }, nil + } + return nil, fmt.Errorf("expected stars") + }, + }, +) + +var ( + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + AddToScheme = localSchemeBuilder.AddToScheme + schemeGroupVersion = GroupVersion +) + +func init() { + localSchemeBuilder.Register(addKnownTypes, addDefaultingFuncs) +} + +// Adds the list of known types to the given scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(schemeGroupVersion, + &Stars{}, + &StarsList{}, + ) + metav1.AddToGroupVersion(scheme, schemeGroupVersion) + return nil +} + +func addDefaultingFuncs(scheme *runtime.Scheme) error { + return nil // return RegisterDefaults(scheme) +} diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars.go b/apps/collections/pkg/apis/collections/v1alpha1/stars.go similarity index 100% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars.go diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_client_gen.go b/apps/collections/pkg/apis/collections/v1alpha1/stars_client_gen.go similarity index 100% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars_client_gen.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars_client_gen.go diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_codec_gen.go b/apps/collections/pkg/apis/collections/v1alpha1/stars_codec_gen.go similarity index 100% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars_codec_gen.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars_codec_gen.go diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_metadata_gen.go b/apps/collections/pkg/apis/collections/v1alpha1/stars_metadata_gen.go similarity index 100% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars_metadata_gen.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars_metadata_gen.go diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_object_gen.go b/apps/collections/pkg/apis/collections/v1alpha1/stars_object_gen.go similarity index 100% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars_object_gen.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars_object_gen.go diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_schema_gen.go b/apps/collections/pkg/apis/collections/v1alpha1/stars_schema_gen.go similarity index 92% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars_schema_gen.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars_schema_gen.go index 00e153b5ef2..2be9d56a29f 100644 --- a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_schema_gen.go +++ b/apps/collections/pkg/apis/collections/v1alpha1/stars_schema_gen.go @@ -10,7 +10,7 @@ import ( // schema is unexported to prevent accidental overwrites var ( - schemaStars = resource.NewSimpleSchema("preferences.grafana.app", "v1alpha1", &Stars{}, &StarsList{}, resource.WithKind("Stars"), + schemaStars = resource.NewSimpleSchema("collections.grafana.app", "v1alpha1", &Stars{}, &StarsList{}, resource.WithKind("Stars"), resource.WithPlural("stars"), resource.WithScope(resource.NamespacedScope)) kindStars = resource.Kind{ Schema: schemaStars, diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_spec_gen.go b/apps/collections/pkg/apis/collections/v1alpha1/stars_spec_gen.go similarity index 100% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars_spec_gen.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars_spec_gen.go diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/stars_test.go b/apps/collections/pkg/apis/collections/v1alpha1/stars_test.go similarity index 100% rename from apps/preferences/pkg/apis/preferences/v1alpha1/stars_test.go rename to apps/collections/pkg/apis/collections/v1alpha1/stars_test.go diff --git a/apps/collections/pkg/apis/collections/v1alpha1/zz_generated.openapi.go b/apps/collections/pkg/apis/collections/v1alpha1/zz_generated.openapi.go new file mode 100644 index 00000000000..5b486b690c0 --- /dev/null +++ b/apps/collections/pkg/apis/collections/v1alpha1/zz_generated.openapi.go @@ -0,0 +1,187 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// SPDX-License-Identifier: AGPL-3.0-only + +// Code generated by openapi-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + common "k8s.io/kube-openapi/pkg/common" + spec "k8s.io/kube-openapi/pkg/validation/spec" +) + +func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { + return map[string]common.OpenAPIDefinition{ + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.Stars": schema_pkg_apis_collections_v1alpha1_Stars(ref), + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.StarsList": schema_pkg_apis_collections_v1alpha1_StarsList(ref), + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.StarsResource": schema_pkg_apis_collections_v1alpha1_StarsResource(ref), + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.StarsSpec": schema_pkg_apis_collections_v1alpha1_StarsSpec(ref), + } +} + +func schema_pkg_apis_collections_v1alpha1_Stars(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec is the spec of the Stars", + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.StarsSpec"), + }, + }, + }, + Required: []string{"metadata", "spec"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.StarsSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_collections_v1alpha1_StarsList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.Stars"), + }, + }, + }, + }, + }, + }, + Required: []string{"metadata", "items"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.Stars", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_collections_v1alpha1_StarsResource(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "group": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "names": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "The set of resources", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"group", "kind", "names"}, + }, + }, + } +} + +func schema_pkg_apis_collections_v1alpha1_StarsSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "resource": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.StarsResource"), + }, + }, + }, + }, + }, + }, + Required: []string{"resource"}, + }, + }, + Dependencies: []string{ + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1.StarsResource"}, + } +} diff --git a/apps/collections/pkg/apis/collections/v1alpha1/zz_generated.openapi_violation_exceptions.list b/apps/collections/pkg/apis/collections/v1alpha1/zz_generated.openapi_violation_exceptions.list new file mode 100644 index 00000000000..efaa822c24f --- /dev/null +++ b/apps/collections/pkg/apis/collections/v1alpha1/zz_generated.openapi_violation_exceptions.list @@ -0,0 +1,2 @@ +API rule violation: list_type_missing,github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1,StarsSpec,Resource +API rule violation: streaming_list_type_json_tags,github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1,StarsList,ListMeta diff --git a/apps/collections/pkg/apis/collections_manifest.go b/apps/collections/pkg/apis/collections_manifest.go new file mode 100644 index 00000000000..6c3f3cfe930 --- /dev/null +++ b/apps/collections/pkg/apis/collections_manifest.go @@ -0,0 +1,132 @@ +// +// This file is generated by grafana-app-sdk +// DO NOT EDIT +// + +package apis + +import ( + "encoding/json" + "fmt" + "strings" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/kube-openapi/pkg/spec3" + "k8s.io/kube-openapi/pkg/validation/spec" + + "github.com/grafana/grafana-app-sdk/app" + "github.com/grafana/grafana-app-sdk/resource" + "github.com/grafana/grafana/apps/collections/pkg/apis/collections/v1alpha1" +) + +var ( + rawSchemaStarsv1alpha1 = []byte(`{"Resource":{"additionalProperties":false,"properties":{"group":{"type":"string"},"kind":{"type":"string"},"names":{"description":"The set of resources\n+listType=set","items":{"type":"string"},"type":"array"}},"required":["group","kind","names"],"type":"object"},"Stars":{"properties":{"spec":{"$ref":"#/components/schemas/spec"}},"required":["spec"]},"spec":{"additionalProperties":false,"properties":{"resource":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array"}},"required":["resource"],"type":"object"}}`) + versionSchemaStarsv1alpha1 app.VersionSchema + _ = json.Unmarshal(rawSchemaStarsv1alpha1, &versionSchemaStarsv1alpha1) +) + +var appManifestData = app.ManifestData{ + AppName: "collections", + Group: "collections.grafana.app", + PreferredVersion: "v1alpha1", + Versions: []app.ManifestVersion{ + { + Name: "v1alpha1", + Served: true, + Kinds: []app.ManifestVersionKind{ + { + Kind: "Stars", + Plural: "Stars", + Scope: "Namespaced", + Conversion: false, + Admission: &app.AdmissionCapabilities{ + Validation: &app.ValidationCapability{ + Operations: []app.AdmissionOperation{ + app.AdmissionOperationCreate, + app.AdmissionOperationUpdate, + }, + }, + }, + Schema: &versionSchemaStarsv1alpha1, + }, + }, + Routes: app.ManifestVersionRoutes{ + Namespaced: map[string]spec3.PathProps{}, + Cluster: map[string]spec3.PathProps{}, + Schemas: map[string]spec.Schema{}, + }, + }, + }, +} + +func LocalManifest() app.Manifest { + return app.NewEmbeddedManifest(appManifestData) +} + +func RemoteManifest() app.Manifest { + return app.NewAPIServerManifest("collections") +} + +var kindVersionToGoType = map[string]resource.Kind{ + "Stars/v1alpha1": v1alpha1.StarsKind(), +} + +// ManifestGoTypeAssociator returns the associated resource.Kind instance for a given Kind and Version, if one exists. +// If there is no association for the provided Kind and Version, exists will return false. +func ManifestGoTypeAssociator(kind, version string) (goType resource.Kind, exists bool) { + goType, exists = kindVersionToGoType[fmt.Sprintf("%s/%s", kind, version)] + return goType, exists +} + +var customRouteToGoResponseType = map[string]any{} + +// ManifestCustomRouteResponsesAssociator returns the associated response go type for a given kind, version, custom route path, and method, if one exists. +// kind may be empty for custom routes which are not kind subroutes. Leading slashes are removed from subroute paths. +// If there is no association for the provided kind, version, custom route path, and method, exists will return false. +// Resource routes (those without a kind) should prefix their route with "/" if the route is namespaced (otherwise the route is assumed to be cluster-scope) +func ManifestCustomRouteResponsesAssociator(kind, version, path, verb string) (goType any, exists bool) { + if len(path) > 0 && path[0] == '/' { + path = path[1:] + } + goType, exists = customRouteToGoResponseType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))] + return goType, exists +} + +var customRouteToGoParamsType = map[string]runtime.Object{} + +func ManifestCustomRouteQueryAssociator(kind, version, path, verb string) (goType runtime.Object, exists bool) { + if len(path) > 0 && path[0] == '/' { + path = path[1:] + } + goType, exists = customRouteToGoParamsType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))] + return goType, exists +} + +var customRouteToGoRequestBodyType = map[string]any{} + +func ManifestCustomRouteRequestBodyAssociator(kind, version, path, verb string) (goType any, exists bool) { + if len(path) > 0 && path[0] == '/' { + path = path[1:] + } + goType, exists = customRouteToGoRequestBodyType[fmt.Sprintf("%s|%s|%s|%s", version, kind, path, strings.ToUpper(verb))] + return goType, exists +} + +type GoTypeAssociator struct{} + +func NewGoTypeAssociator() *GoTypeAssociator { + return &GoTypeAssociator{} +} + +func (g *GoTypeAssociator) KindToGoType(kind, version string) (goType resource.Kind, exists bool) { + return ManifestGoTypeAssociator(kind, version) +} +func (g *GoTypeAssociator) CustomRouteReturnGoType(kind, version, path, verb string) (goType any, exists bool) { + return ManifestCustomRouteResponsesAssociator(kind, version, path, verb) +} +func (g *GoTypeAssociator) CustomRouteQueryGoType(kind, version, path, verb string) (goType runtime.Object, exists bool) { + return ManifestCustomRouteQueryAssociator(kind, version, path, verb) +} +func (g *GoTypeAssociator) CustomRouteRequestBodyGoType(kind, version, path, verb string) (goType any, exists bool) { + return ManifestCustomRouteRequestBodyAssociator(kind, version, path, verb) +} diff --git a/apps/correlations/go.mod b/apps/correlations/go.mod index 3875fe92ed7..988f18b89d6 100644 --- a/apps/correlations/go.mod +++ b/apps/correlations/go.mod @@ -49,7 +49,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -68,7 +68,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/correlations/go.sum b/apps/correlations/go.sum index b15ac884e9a..7eadc30e628 100644 --- a/apps/correlations/go.sum +++ b/apps/correlations/go.sum @@ -104,8 +104,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -165,8 +165,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/dashboard/go.mod b/apps/dashboard/go.mod index 15ed02b9266..9e98fe233ec 100644 --- a/apps/dashboard/go.mod +++ b/apps/dashboard/go.mod @@ -4,10 +4,10 @@ go 1.25.3 require ( cuelang.org/go v0.11.1 - github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 + github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 github.com/grafana/grafana-app-sdk v0.48.2 github.com/grafana/grafana-app-sdk/logging v0.48.1 - github.com/grafana/grafana-plugin-sdk-go v0.281.0 + github.com/grafana/grafana-plugin-sdk-go v0.283.0 github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e github.com/prometheus/client_golang v1.23.2 github.com/stretchr/testify v1.11.1 @@ -51,7 +51,7 @@ require ( github.com/grafana/otel-profiling-go v0.5.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.9 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-hclog v1.6.3 // indirect @@ -84,7 +84,7 @@ require ( github.com/pierrec/lz4/v4 v4.1.22 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/spf13/pflag v1.0.10 // indirect @@ -110,7 +110,7 @@ require ( golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9 // indirect golang.org/x/mod v0.30.0 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54 // indirect diff --git a/apps/dashboard/go.sum b/apps/dashboard/go.sum index 0927fd84bc0..b4158332679 100644 --- a/apps/dashboard/go.sum +++ b/apps/dashboard/go.sum @@ -81,16 +81,16 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f h1:Cbm6OKkOcJ+7CSZsGsEJzktC/SIa5bxVeYKQLuYK86o= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f/go.mod h1:axY0cdOg3q0TZHwpHnIz5x16xZ8ZBxJHShsSHHXcHQg= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 h1:qEwZ+7MbPjzRvTi31iT9w7NBhKIpKwZrFbYmOZLqkwA= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 h1:Muoy+FMGrHj3GdFbvsMzUT7eusgii9PKf9L1ZaXDDbY= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 h1:jSojuc7njleS3UOz223WDlXOinmuLAIPI0z2vtq8EgI= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4/go.mod h1:VahT+GtfQIM+o8ht2StR6J9g+Ef+C2Vokh5uuSmOD/4= github.com/grafana/grafana-app-sdk v0.48.2 h1:CQQDhwo1fWaXQVKvxxOcK6azbuY3E2TgJHNAZlYYn7U= github.com/grafana/grafana-app-sdk v0.48.2/go.mod h1:LDOvQ7OOyHLcXdSa0InATCa5OMoYAd6E1+rGLrMgHuk= github.com/grafana/grafana-app-sdk/logging v0.48.1 h1:veM0X5LAPyN3KsDLglWjIofndbGuf7MqnrDuDN+F/Ng= github.com/grafana/grafana-app-sdk/logging v0.48.1/go.mod h1:Gh/nBWnspK3oDNWtiM5qUF/fardHzOIEez+SPI3JeHA= -github.com/grafana/grafana-plugin-sdk-go v0.281.0 h1:V8dGyatzcOLQeivFhBV2JWMwTSZH/clDnpfKG9p3dTA= -github.com/grafana/grafana-plugin-sdk-go v0.281.0/go.mod h1:3I0g+v6jAwVmrt6BEjDUP4V6pkhGP5QKY5NkXY4Ayr4= +github.com/grafana/grafana-plugin-sdk-go v0.283.0 h1:G7IHshAr30rLWV9FtX3iLlFTTlBhuOkfe7xVAoIP5rE= +github.com/grafana/grafana-plugin-sdk-go v0.283.0/go.mod h1:20qhoYxIgbZRmwCEO1KMP8q2yq/Kge5+xE/99/hLEk0= github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e h1:BTKk7LHuG1kmAkucwTA7DuMbKpKvJTKrGdBmUNO4dfQ= github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250514132646-acbc7b54ed9e/go.mod h1:IA4SOwun8QyST9c5UNs/fN37XL6boXXDvRYFcFwbipg= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= @@ -99,8 +99,8 @@ github.com/grafana/pyroscope-go/godeltaprof v0.1.9 h1:c1Us8i6eSmkW+Ez05d3co8kasn github.com/grafana/pyroscope-go/godeltaprof v0.1.9/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -202,8 +202,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/protocolbuffers/txtpbfmt v0.0.0-20241112170944-20d2c9ebc01d h1:HWfigq7lB31IeJL8iy7jkUmU/PG1Sr8jVGhS749dbUA= @@ -294,8 +294,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/dashboard/pkg/migration/conversion/conversion.go b/apps/dashboard/pkg/migration/conversion/conversion.go index 75b6389ae4f..8d20dcd3837 100644 --- a/apps/dashboard/pkg/migration/conversion/conversion.go +++ b/apps/dashboard/pkg/migration/conversion/conversion.go @@ -11,7 +11,7 @@ import ( "github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion" ) -func RegisterConversions(s *runtime.Scheme, dsIndexProvider schemaversion.DataSourceIndexProvider) error { +func RegisterConversions(s *runtime.Scheme, dsIndexProvider schemaversion.DataSourceIndexProvider, _ schemaversion.LibraryElementIndexProvider) error { // Wrap the provider once with 10s caching for all conversions. // This prevents repeated DB queries across multiple conversion calls while allowing // the cache to refresh periodically, making it suitable for long-lived singleton usage. diff --git a/apps/dashboard/pkg/migration/conversion/conversion_data_loss_detection_test.go b/apps/dashboard/pkg/migration/conversion/conversion_data_loss_detection_test.go index 11bc3931990..f49305996f9 100644 --- a/apps/dashboard/pkg/migration/conversion/conversion_data_loss_detection_test.go +++ b/apps/dashboard/pkg/migration/conversion/conversion_data_loss_detection_test.go @@ -828,11 +828,12 @@ func TestWithConversionValidation_DataLoss(t *testing.T) { func TestDataLossDetectionOnAllInputFiles(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := testutil.NewDataSourceProvider(testutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := testutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) // Set up conversion scheme scheme := runtime.NewScheme() - err := RegisterConversions(scheme, dsProvider) + err := RegisterConversions(scheme, dsProvider, leProvider) require.NoError(t, err) // Read all files from input directory diff --git a/apps/dashboard/pkg/migration/conversion/conversion_test.go b/apps/dashboard/pkg/migration/conversion/conversion_test.go index 9da0318dc81..e7cbe2f70ef 100644 --- a/apps/dashboard/pkg/migration/conversion/conversion_test.go +++ b/apps/dashboard/pkg/migration/conversion/conversion_test.go @@ -33,7 +33,8 @@ import ( func TestConversionMatrixExist(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) versions := []metav1.Object{ &dashv0.Dashboard{Spec: common.Unstructured{Object: map[string]any{"title": "dashboardV0"}}}, @@ -43,7 +44,7 @@ func TestConversionMatrixExist(t *testing.T) { } scheme := runtime.NewScheme() - err := RegisterConversions(scheme, dsProvider) + err := RegisterConversions(scheme, dsProvider, leProvider) require.NoError(t, err) for idx, in := range versions { @@ -85,11 +86,12 @@ func TestDeepCopyValid(t *testing.T) { func TestDashboardConversionToAllVersions(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) // Set up conversion scheme scheme := runtime.NewScheme() - err := RegisterConversions(scheme, dsProvider) + err := RegisterConversions(scheme, dsProvider, leProvider) require.NoError(t, err) // Read all files from input directory @@ -244,11 +246,12 @@ func TestDashboardConversionToAllVersions(t *testing.T) { func TestMigratedDashboardsConversion(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) // Set up conversion scheme scheme := runtime.NewScheme() - err := RegisterConversions(scheme, dsProvider) + err := RegisterConversions(scheme, dsProvider, leProvider) require.NoError(t, err) // Read all files from migration package's latest_version directory @@ -378,7 +381,8 @@ func testConversion(t *testing.T, convertedDash metav1.Object, filename, outputD func TestConversionMetrics(t *testing.T) { // Initialize migration with test providers dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) // Create a test registry for metrics registry := prometheus.NewRegistry() @@ -386,7 +390,7 @@ func TestConversionMetrics(t *testing.T) { // Set up conversion scheme scheme := runtime.NewScheme() - err := RegisterConversions(scheme, dsProvider) + err := RegisterConversions(scheme, dsProvider, leProvider) require.NoError(t, err) tests := []struct { @@ -505,7 +509,8 @@ func TestConversionMetrics(t *testing.T) { // TestConversionMetricsWrapper tests the withConversionMetrics wrapper function func TestConversionMetricsWrapper(t *testing.T) { dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) // Create a test registry for metrics registry := prometheus.NewRegistry() @@ -673,7 +678,8 @@ func TestSchemaVersionExtraction(t *testing.T) { t.Run(tt.name, func(t *testing.T) { // Test the schema version extraction logic by creating a wrapper and checking the metrics labels dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) // Create a test registry for metrics registry := prometheus.NewRegistry() @@ -717,7 +723,8 @@ func TestSchemaVersionExtraction(t *testing.T) { // TestConversionLogging tests that conversion-level logging works correctly func TestConversionLogging(t *testing.T) { dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) // Create a test registry for metrics registry := prometheus.NewRegistry() @@ -725,7 +732,7 @@ func TestConversionLogging(t *testing.T) { // Set up conversion scheme scheme := runtime.NewScheme() - err := RegisterConversions(scheme, dsProvider) + err := RegisterConversions(scheme, dsProvider, leProvider) require.NoError(t, err) tests := []struct { @@ -808,7 +815,8 @@ func TestConversionLogging(t *testing.T) { // TestConversionLogLevels tests that appropriate log levels are used func TestConversionLogLevels(t *testing.T) { dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) t.Run("log levels and structured fields verification", func(t *testing.T) { // Create test wrapper to verify logging behavior @@ -879,7 +887,8 @@ func TestConversionLogLevels(t *testing.T) { // TestConversionLoggingFields tests that all expected fields are included in log messages func TestConversionLoggingFields(t *testing.T) { dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) t.Run("verify all log fields are present", func(t *testing.T) { // Test that the conversion wrapper includes all expected structured fields diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.complete.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.complete.json index 277a8b2ebc2..5091df59fcf 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.complete.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.complete.json @@ -1,6 +1,6 @@ { - "apiVersion": "dashboard.grafana.app/v2alpha1", "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", "metadata": { "name": "test-v2alpha1-complete", "labels": { @@ -11,26 +11,14 @@ } }, "spec": { - "title": "Test: Complete V2alpha1 Dashboard Example", - "description": "This dashboard demonstrates all features that need to be converted from v2alpha1 to v2beta1", - "editable": true, - "liveNow": true, - "preload": true, - "cursorSync": "Tooltip", - "tags": ["test", "example", "migration"], "annotations": [ { "kind": "AnnotationQuery", "spec": { - "builtIn": true, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, - "enable": true, - "hide": false, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", "query": { "kind": "grafana", "spec": { @@ -39,257 +27,39 @@ "tags": [], "type": "dashboard" } - } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true } }, { "kind": "AnnotationQuery", "spec": { - "builtIn": false, "datasource": { "type": "prometheus", "uid": "gdev-prometheus" }, - "enable": true, - "hide": false, - "iconColor": "yellow", - "name": "Prometheus Annotations", "query": { "kind": "prometheus", "spec": { "expr": "changes(process_start_time_seconds[1m])", "refId": "Anno" } - } - } - } - ], - "variables": [ - { - "kind": "QueryVariable", - "spec": { - "name": "prometheus_query", - "datasource": { - "type": "prometheus", - "uid": "gdev-prometheus" }, - "query": { - "kind": "prometheus", - "spec": { - "expr": "up" - } - }, - "refresh": "time", - "regex": "", - "sort": "alphabetical", - "multi": true, - "includeAll": true, - "current": { - "text": "All", - "value": ["$__all"] - }, - "hide": "dontHide", - "label": "Prometheus Query", - "description": "Shows all up metrics", - "skipUrlSync": false, - "definition": "up" - } - }, - { - "kind": "TextVariable", - "spec": { - "name": "text_var", - "label": "Text Variable", - "description": "A simple text variable", - "query": "server1,server2,server3", - "current": { - "selected": true, - "text": "server1", - "value": "server1" - }, - "hide": "dontHide", - "skipUrlSync": false - } - }, - { - "kind": "ConstantVariable", - "spec": { - "name": "constant_var", - "label": "Constant", - "description": "A constant value", - "query": "production", - "current": { - "selected": true, - "text": "production", - "value": "production" - }, - "hide": "dontHide", - "skipUrlSync": true - } - }, - { - "kind": "DatasourceVariable", - "spec": { - "name": "ds_var", - "label": "Datasource", - "description": "Select a datasource", - "pluginId": "prometheus", - "refresh": "load", - "regex": "/^gdev-/", - "current": { - "text": "gdev-prometheus", - "value": "gdev-prometheus" - }, - "options": [ - { - "text": "gdev-prometheus", - "value": "gdev-prometheus" - } - ], - "multi": false, - "includeAll": false, - "hide": "dontHide", - "skipUrlSync": false - } - }, - { - "kind": "IntervalVariable", - "spec": { - "name": "interval", - "label": "Interval", - "description": "Time interval selection", - "query": "1m,5m,10m,30m,1h,6h,12h,1d", - "current": { - "selected": true, - "text": "5m", - "value": "5m" - }, - "options": [ - { - "text": "1m", - "value": "1m" - }, - { - "text": "5m", - "value": "5m" - }, - { - "text": "10m", - "value": "10m" - }, - { - "text": "30m", - "value": "30m" - }, - { - "text": "1h", - "value": "1h" - }, - { - "text": "6h", - "value": "6h" - }, - { - "text": "12h", - "value": "12h" - }, - { - "text": "1d", - "value": "1d" - } - ], - "auto": true, - "auto_min": "10s", - "auto_count": 30, - "refresh": "load", - "hide": "dontHide", - "skipUrlSync": false - } - }, - { - "kind": "CustomVariable", - "spec": { - "name": "custom_var", - "label": "Custom Options", - "description": "Custom multi-value variable", - "query": "prod : Production, staging : Staging, dev : Development", - "current": { - "text": ["Production"], - "value": ["prod"] - }, - "options": [ - { - "text": "Production", - "value": "prod" - }, - { - "text": "Staging", - "value": "staging" - }, - { - "text": "Development", - "value": "dev" - } - ], - "multi": true, - "includeAll": true, - "allValue": "*", - "hide": "dontHide", - "skipUrlSync": false, - "allowCustomValue": true - } - }, - { - "kind": "GroupByVariable", - "spec": { - "name": "group_by", - "datasource": { - "type": "prometheus", - "uid": "gdev-prometheus" - }, - "current": { - "text": "instance", - "value": "instance" - }, - "description": "Group metrics by label", - "hide": "dontHide", - "label": "Group By" - } - }, - { - "kind": "AdhocVariable", - "spec": { - "name": "filters", - "datasource": { - "type": "prometheus", - "uid": "gdev-prometheus" - }, - "baseFilters": [ - { - "key": "job", - "operator": "=", - "value": "grafana", - "condition": "AND" - } - ], - "filters": [], - "hide": "dontHide", - "label": "Filters", - "defaultKeys": [ - { - "text": "job", - "value": "job", - "expandable": true - }, - { - "text": "instance", - "value": "instance", - "expandable": true - } - ] + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "Prometheus Annotations", + "builtIn": false } } ], + "cursorSync": "Tooltip", + "description": "This dashboard demonstrates all features that need to be converted from v2alpha1 to v2beta1", + "editable": true, "elements": { "panel-1": { "kind": "Panel", @@ -297,6 +67,7 @@ "id": 1, "title": "Panel with Conditional Rendering", "description": "This panel demonstrates conditional rendering features", + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -304,16 +75,18 @@ { "kind": "PanelQuery", "spec": { - "refId": "A", - "datasource": { - "uid": "gdev-prometheus" - }, "query": { "kind": "prometheus", "spec": { "expr": "up{job=\"grafana\"}" } - } + }, + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "refId": "A", + "hidden": false } } ], @@ -323,13 +96,16 @@ "spec": { "id": "reduce", "options": { - "mode": "reduceFields", "includeTimeField": false, - "reducers": ["mean"] + "mode": "reduceFields", + "reducers": [ + "mean" + ] } } } - ] + ], + "queryOptions": {} } }, "vizConfig": { @@ -344,22 +120,6 @@ }, "fieldConfig": { "defaults": { - "color": { - "mode": "thresholds" - }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "red", - "value": 0 - }, - { - "color": "green", - "value": 1 - } - ] - }, "mappings": [ { "type": "value", @@ -374,7 +134,23 @@ } } } - ] + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "red" + }, + { + "value": 1, + "color": "green" + } + ] + }, + "color": { + "mode": "thresholds" + } }, "overrides": [] } @@ -448,15 +224,281 @@ ] } }, + "links": [], + "liveNow": true, + "preload": true, + "tags": [ + "test", + "example", + "migration" + ], "timeSettings": { "timezone": "browser", - "weekStart": "monday", - "fiscalYearStartMonth": 0, - "autoRefresh": "10s", - "autoRefreshIntervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], "from": "now-6h", "to": "now", - "hideTimepicker": false + "autoRefresh": "10s", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "weekStart": "monday", + "fiscalYearStartMonth": 0 + }, + "title": "Test: Complete V2alpha1 Dashboard Example", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "prometheus_query", + "current": { + "text": "All", + "value": [ + "$__all" + ] + }, + "label": "Prometheus Query", + "hide": "dontHide", + "refresh": "time", + "skipUrlSync": false, + "description": "Shows all up metrics", + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "query": { + "kind": "prometheus", + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "alphabetical", + "definition": "up", + "options": null, + "multi": true, + "includeAll": true, + "allowCustomValue": false + } + }, + { + "kind": "TextVariable", + "spec": { + "name": "text_var", + "current": { + "selected": true, + "text": "server1", + "value": "server1" + }, + "query": "server1,server2,server3", + "label": "Text Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A simple text variable" + } + }, + { + "kind": "ConstantVariable", + "spec": { + "name": "constant_var", + "query": "production", + "current": { + "selected": true, + "text": "production", + "value": "production" + }, + "label": "Constant", + "hide": "dontHide", + "skipUrlSync": true, + "description": "A constant value" + } + }, + { + "kind": "DatasourceVariable", + "spec": { + "name": "ds_var", + "pluginId": "prometheus", + "refresh": "load", + "regex": "/^gdev-/", + "current": { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + }, + "options": [ + { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + } + ], + "multi": false, + "includeAll": false, + "label": "Datasource", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Select a datasource", + "allowCustomValue": false + } + }, + { + "kind": "IntervalVariable", + "spec": { + "name": "interval", + "query": "1m,5m,10m,30m,1h,6h,12h,1d", + "current": { + "selected": true, + "text": "5m", + "value": "5m" + }, + "options": [ + { + "text": "1m", + "value": "1m" + }, + { + "text": "5m", + "value": "5m" + }, + { + "text": "10m", + "value": "10m" + }, + { + "text": "30m", + "value": "30m" + }, + { + "text": "1h", + "value": "1h" + }, + { + "text": "6h", + "value": "6h" + }, + { + "text": "12h", + "value": "12h" + }, + { + "text": "1d", + "value": "1d" + } + ], + "auto": true, + "auto_min": "10s", + "auto_count": 30, + "refresh": "load", + "label": "Interval", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Time interval selection" + } + }, + { + "kind": "CustomVariable", + "spec": { + "name": "custom_var", + "query": "prod : Production, staging : Staging, dev : Development", + "current": { + "text": [ + "Production" + ], + "value": [ + "prod" + ] + }, + "options": [ + { + "text": "Production", + "value": "prod" + }, + { + "text": "Staging", + "value": "staging" + }, + { + "text": "Development", + "value": "dev" + } + ], + "multi": true, + "includeAll": true, + "allValue": "*", + "label": "Custom Options", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Custom multi-value variable", + "allowCustomValue": true + } + }, + { + "kind": "GroupByVariable", + "spec": { + "name": "group_by", + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "current": { + "text": "instance", + "value": "instance" + }, + "options": null, + "multi": false, + "label": "Group By", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Group metrics by label" + } + }, + { + "kind": "AdhocVariable", + "spec": { + "name": "filters", + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "baseFilters": [ + { + "key": "job", + "operator": "=", + "value": "grafana", + "condition": "AND" + } + ], + "filters": [], + "defaultKeys": [ + { + "text": "job", + "value": "job", + "expandable": true + }, + { + "text": "instance", + "value": "instance", + "expandable": true + } + ], + "label": "Filters", + "hide": "dontHide", + "skipUrlSync": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.ds-data-query.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.ds-data-query.json index 408a3cc9873..a27c33c3239 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.ds-data-query.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.ds-data-query.json @@ -1,25 +1,18 @@ { - "apiVersion": "dashboard.grafana.app/v2alpha1", "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", "metadata": { - "name": "test-v2alpha1-annotations", - "labels": {}, - "annotations": {} + "name": "test-v2alpha1-annotations" }, "spec": { "annotations": [ { "kind": "AnnotationQuery", "spec": { - "builtIn": true, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, - "enable": true, - "hide": false, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", "query": { "kind": "grafana", "spec": { @@ -28,21 +21,21 @@ "tags": [], "type": "dashboard" } - } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true } }, { "kind": "AnnotationQuery", "spec": { - "builtIn": false, "datasource": { "type": "grafana-testdata-datasource", "uid": "PD8C576611E62080A" }, - "enable": true, - "hide": false, - "iconColor": "blue", - "name": "testdata-annos", "query": { "kind": "grafana-testdata-datasource", "spec": { @@ -50,17 +43,17 @@ "refId": "Anno", "scenarioId": "annotations" } - } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "testdata-annos", + "builtIn": false } }, { "kind": "AnnotationQuery", "spec": { - "builtIn": false, - "enable": true, - "hide": false, - "iconColor": "blue", - "name": "no-ds-testdata-annos", "query": { "kind": "prometheus", "spec": { @@ -68,21 +61,41 @@ "refId": "Anno", "scenarioId": "annotations" } - } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "no-ds-testdata-annos", + "builtIn": false } }, { "kind": "AnnotationQuery", "spec": { - "builtIn": false, "datasource": { "type": "prometheus", "uid": "gdev-prometheus" }, + "query": { + "kind": "prometheus", + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, "enable": true, "hide": false, "iconColor": "yellow", "name": "prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { "query": { "kind": "prometheus", "spec": { @@ -92,41 +105,21 @@ "refId": "Anno", "scenarioId": "annotations" } - } - } - }, - { - "kind": "AnnotationQuery", - "spec": { - "builtIn": false, + }, "enable": true, "hide": false, "iconColor": "yellow", "name": "no-ds-prom-annos", - "query": { - "kind": "prometheus", - "spec": { - "expr": "{action=\"add_client\"}", - "interval": "", - "lines": 10, - "refId": "Anno", - "scenarioId": "annotations" - } - } + "builtIn": false } }, { "kind": "AnnotationQuery", "spec": { - "builtIn": false, "datasource": { "type": "grafana-postgresql-datasource", "uid": "PBBCEC2D313BC06C3" }, - "enable": true, - "hide": false, - "iconColor": "red", - "name": "postgress-annos", "query": { "kind": "grafana-postgresql-datasource", "spec": { @@ -154,27 +147,21 @@ "limit": 50 } } - } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "postgress-annos", + "builtIn": false } }, { "kind": "AnnotationQuery", "spec": { - "builtIn": false, "datasource": { "type": "elasticsearch", "uid": "gdev-elasticsearch" }, - "enable": true, - "hide": false, - "iconColor": "red", - "legacyOptions": { - "tagsField": "asd", - "textField": "asd", - "timeEndField": "asdas", - "timeField": "asd" - }, - "name": "elastic - annos", "query": { "kind": "elasticsearch", "spec": { @@ -183,6 +170,17 @@ "refId": "Anno", "scenarioId": "annotations" } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "elastic - annos", + "builtIn": false, + "legacyOptions": { + "tagsField": "asd", + "textField": "asd", + "timeEndField": "asdas", + "timeField": "asd" } } } @@ -193,6 +191,10 @@ "panel-1": { "kind": "Panel", "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -200,35 +202,58 @@ { "kind": "PanelQuery", "spec": { - "hidden": false, - "datasource": { - "uid": "gdev-testdata" - }, "query": { "kind": "grafana-testdata-datasource", "spec": { "scenarioId": "random_walk", "seriesCount": 3 - }, - "version": "v0" + } }, - "refId": "A" + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "gdev-testdata" + }, + "refId": "A", + "hidden": false } } ], - "queryOptions": {}, - "transformations": [] + "transformations": [], + "queryOptions": {} } }, - "description": "", - "id": 1, - "links": [], - "title": "Simple timeseries (WITH DS REF)", "vizConfig": { "kind": "timeseries", "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, "fieldConfig": { "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, "color": { "mode": "palette-classic" }, @@ -264,37 +289,10 @@ "thresholdsStyle": { "mode": "off" } - }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] } }, "overrides": [] - }, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0-pre" + } } } } @@ -302,6 +300,10 @@ "panel-2": { "kind": "Panel", "spec": { + "id": 2, + "title": "Simple stat (NO DS REF)", + "description": "", + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -309,51 +311,26 @@ { "kind": "PanelQuery", "spec": { - "hidden": false, "query": { "kind": "grafana-testdata-datasource", "spec": { "scenarioId": "random_walk", "seriesCount": 4 - }, - "version": "v0" + } }, - "refId": "A" + "refId": "A", + "hidden": false } } ], - "queryOptions": {}, - "transformations": [] + "transformations": [], + "queryOptions": {} } }, - "description": "", - "id": 2, - "links": [], - "title": "Simple stat (NO DS REF)", "vizConfig": { "kind": "stat", "spec": { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, + "pluginVersion": "12.1.0-pre", "options": { "colorMode": "value", "graphMode": "area", @@ -361,7 +338,9 @@ "orientation": "auto", "percentChangeColorMode": "standard", "reduceOptions": { - "calcs": ["lastNotNull"], + "calcs": [ + "lastNotNull" + ], "fields": "", "values": false }, @@ -369,7 +348,27 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "12.1.0-pre" + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } } } } @@ -377,6 +376,10 @@ "panel-3": { "kind": "Panel", "spec": { + "id": 3, + "title": "Panel with NO REF to gdev-prometheus", + "description": "", + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -384,7 +387,6 @@ { "kind": "PanelQuery", "spec": { - "hidden": false, "query": { "kind": "prometheus", "spec": { @@ -397,26 +399,49 @@ "legendFormat": "__auto", "range": true, "useBackend": false - }, - "version": "v0" + } }, - "refId": "A" + "refId": "A", + "hidden": false } } ], - "queryOptions": {}, - "transformations": [] + "transformations": [], + "queryOptions": {} } }, - "description": "", - "id": 3, - "links": [], - "title": "Panel with NO REF to gdev-prometheus", "vizConfig": { "kind": "timeseries", "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, "fieldConfig": { "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, "color": { "mode": "palette-classic" }, @@ -452,37 +477,10 @@ "thresholdsStyle": { "mode": "off" } - }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] } }, "overrides": [] - }, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0-pre" + } } } } @@ -490,6 +488,10 @@ "panel-4": { "kind": "Panel", "spec": { + "id": 4, + "title": "Panel with ref to gdev-prometheus", + "description": "", + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -497,10 +499,6 @@ { "kind": "PanelQuery", "spec": { - "hidden": false, - "datasource": { - "uid": "gdev-prometheus" - }, "query": { "kind": "prometheus", "spec": { @@ -513,26 +511,53 @@ "legendFormat": "__auto", "range": true, "useBackend": false - }, - "version": "v0" + } }, - "refId": "A" + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "refId": "A", + "hidden": false } } ], - "queryOptions": {}, - "transformations": [] + "transformations": [], + "queryOptions": {} } }, - "description": "", - "id": 4, - "links": [], - "title": "Panel with ref to gdev-prometheus", "vizConfig": { "kind": "timeseries", "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, "fieldConfig": { "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, "color": { "mode": "palette-classic" }, @@ -568,37 +593,10 @@ "thresholdsStyle": { "mode": "off" } - }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] } }, "overrides": [] - }, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0-pre" + } } } } @@ -606,6 +604,10 @@ "panel-5": { "kind": "Panel", "spec": { + "id": 5, + "title": "Mixed DS WITH REFS", + "description": "", + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -613,10 +615,6 @@ { "kind": "PanelQuery", "spec": { - "hidden": false, - "datasource": { - "uid": "gdev-prometheus" - }, "query": { "kind": "prometheus", "spec": { @@ -628,41 +626,68 @@ "legendFormat": "__auto", "range": true, "useBackend": false - }, - "version": "v0" + } }, - "refId": "A" + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "refId": "A", + "hidden": false } }, { "kind": "PanelQuery", "spec": { - "hidden": false, - "datasource": { - "uid": "gdev-testdata" - }, "query": { "kind": "grafana-testdata-datasource", - "spec": {}, - "version": "v0" + "spec": {} }, - "refId": "B" + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "gdev-testdata" + }, + "refId": "B", + "hidden": false } } ], - "queryOptions": {}, - "transformations": [] + "transformations": [], + "queryOptions": {} } }, - "description": "", - "id": 5, - "links": [], - "title": "Mixed DS WITH REFS", "vizConfig": { "kind": "timeseries", "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, "fieldConfig": { "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, "color": { "mode": "palette-classic" }, @@ -698,37 +723,10 @@ "thresholdsStyle": { "mode": "off" } - }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] } }, "overrides": [] - }, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0-pre" + } } } } @@ -736,6 +734,10 @@ "panel-6": { "kind": "Panel", "spec": { + "id": 6, + "title": "Mixed DS WITHOUT REFS", + "description": "", + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -743,7 +745,6 @@ { "kind": "PanelQuery", "spec": { - "hidden": false, "query": { "kind": "prometheus", "spec": { @@ -755,38 +756,60 @@ "legendFormat": "__auto", "range": true, "useBackend": false - }, - "version": "v0" + } }, - "refId": "A" + "refId": "A", + "hidden": false } }, { "kind": "PanelQuery", "spec": { - "hidden": false, "query": { "kind": "grafana-testdata-datasource", - "spec": {}, - "version": "v0" + "spec": {} }, - "refId": "B" + "refId": "B", + "hidden": false } } ], - "queryOptions": {}, - "transformations": [] + "transformations": [], + "queryOptions": {} } }, - "description": "", - "id": 6, - "links": [], - "title": "Mixed DS WITHOUT REFS", "vizConfig": { "kind": "timeseries", "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, "fieldConfig": { "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, "color": { "mode": "palette-classic" }, @@ -822,37 +845,10 @@ "thresholdsStyle": { "mode": "off" } - }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] } }, "overrides": [] - }, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "12.1.0-pre" + } } } } @@ -861,7 +857,9 @@ "layout": { "kind": "AutoGridLayout", "spec": { + "maxColumnCount": 3, "columnWidthMode": "standard", + "rowHeightMode": "standard", "items": [ { "kind": "AutoGridLayoutItem", @@ -917,9 +915,7 @@ } } } - ], - "maxColumnCount": 3, - "rowHeightMode": "standard" + ] } }, "links": [], @@ -927,75 +923,136 @@ "preload": false, "tags": [], "timeSettings": { - "autoRefresh": "", - "autoRefreshIntervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], - "fiscalYearStartMonth": 0, - "from": "now-6h", - "hideTimepicker": false, "timezone": "browser", - "to": "now" + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 }, "title": "Test: V2alpha1 dashboard with annotations", "variables": [ { "kind": "QueryVariable", "spec": { + "name": "variable-ds-prometheus", + "current": { + "text": null, + "value": null + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, - "enable": true, - "hide": "dontHide", - "name": "variable-ds-prometheus", "query": { "kind": "prometheus", "spec": { "expr": "up" } - } - } - }, - { - "kind": "QueryVariable", - "spec": { - "enable": true, - "hide": "dontHide", - "name": "variable-no-ds", - "query": { - "kind": "grafana-testdata-datasource", - "spec": { - "scenarioId": "csv_metric_values", - "csv": "1,2,3,4" - } - } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false } }, { "kind": "QueryVariable", "spec": { - "enable": true, + "name": "variable-no-ds", + "current": { + "text": null, + "value": null + }, "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "grafana-testdata-datasource", + "spec": { + "csv": "1,2,3,4", + "scenarioId": "csv_metric_values" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { "name": "variable-no-ds-empty-query", + "current": { + "text": null, + "value": null + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, "query": { "kind": "grafana-testdata-datasource", "spec": {} - } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false } }, { "kind": "QueryVariable", "spec": { - "enable": true, - "hide": "dontHide", "name": "variable-no-default-ds", + "current": { + "text": null, + "value": null + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, "query": { "kind": "prometheus", "spec": { "expr": "up" } - } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false } } ] }, - "status": {} -} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.groupby-adhoc-vars.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.groupby-adhoc-vars.json index 65c2b91ae72..5cb430e9655 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.groupby-adhoc-vars.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.groupby-adhoc-vars.json @@ -1,73 +1,98 @@ { - "apiVersion": "dashboard.grafana.app/v2alpha1", "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", "metadata": { "name": "test-v2alpha1-groupby-adhoc-vars" }, "spec": { + "annotations": [], + "cursorSync": "", + "elements": {}, + "layout": null, + "links": [], + "preload": false, + "tags": null, + "timeSettings": { + "from": "", + "to": "", + "autoRefresh": "", + "autoRefreshIntervals": null, + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, "title": "Test: V2alpha1 dashboard with group by and adhoc variables", "variables": [ { "kind": "GroupByVariable", "spec": { - "current": { - "text": "text7", - "value": "value7" - }, + "name": "", "datasource": { "type": "prometheus", "uid": "gdev-prometheus" }, - "description": "A group by variable", + "current": { + "text": "text7", + "value": "value7" + }, + "options": null, + "multi": false, + "label": "Group By Variable", "hide": "dontHide", - "label": "Group By Variable" + "skipUrlSync": false, + "description": "A group by variable" } }, { "kind": "AdhocVariable", "spec": { - "baseFilters": [ - { - "condition": "AND", - "key": "key1", - "operator": "=", - "value": "value1" - }, - { - "condition": "OR", - "key": "key2", - "operator": "=", - "value": "value2" - } - ], + "name": "adhocVar", "datasource": { "type": "prometheus", "uid": "datasource-3" }, - "defaultKeys": [ + "baseFilters": [ { - "expandable": true, - "group": "defaultGroup1", - "text": "defaultKey1", - "value": "defaultKey1" + "key": "key1", + "operator": "=", + "value": "value1", + "condition": "AND" + }, + { + "key": "key2", + "operator": "=", + "value": "value2", + "condition": "OR" } ], - "description": "An adhoc variable", "filters": [ { - "condition": "AND", "key": "key3", "operator": "=", - "value": "value3" + "value": "value3", + "condition": "AND" + } + ], + "defaultKeys": [ + { + "text": "defaultKey1", + "value": "defaultKey1", + "group": "defaultGroup1", + "expandable": true } ], - "hide": "dontHide", "label": "Adhoc Variable", - "name": "adhocVar", + "hide": "dontHide", "skipUrlSync": false, + "description": "An adhoc variable", "allowCustomValue": true } } ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } } } \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.viz-config.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.viz-config.json index 5d591e64ca0..48c2aab46af 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.viz-config.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2alpha1.viz-config.json @@ -1,202 +1,218 @@ { - "apiVersion": "dashboard.grafana.app/v2alpha1", - "kind": "Dashboard", - "metadata": { - "name": "test-v2alpha1-viz-config", - "labels": {}, - "annotations": {} - }, - "spec": { - "elements": { - "panel-1": { - "kind": "Panel", - "spec": { - "data": { - "kind": "QueryGroup", - "spec": { - "queries": [ - { - "kind": "PanelQuery", - "spec": { - "hidden": false, - "datasource": { - "uid": "gdev-testdata" - }, - "query": { - "kind": "grafana-testdata-datasource", - "spec": { - "scenarioId": "random_walk", - "seriesCount": 3 - }, - "version": "v0" - }, - "refId": "A" - } - } - ], - "queryOptions": {}, - "transformations": [] - } - }, - "description": "", - "id": 1, - "links": [], - "title": "Simple timeseries (WITH DS REF)", - "vizConfig": { - "kind": "timeseries", - "spec": { - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "barWidthFactor": 0.6, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", + "metadata": { + "name": "test-v2alpha1-viz-config" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "grafana-testdata-datasource", + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 } }, - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": 0 - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "gdev-testdata" + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "timeseries", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] }, - "tooltip": { - "hideZeros": false, - "mode": "single", - "sort": "none" + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } } }, - "pluginVersion": "12.1.0-pre" + "overrides": [] } } } } - }, - "layout": { - "kind": "AutoGridLayout", - "spec": { - "columnWidthMode": "standard", - "items": [ - { - "kind": "AutoGridLayoutItem", - "spec": { - "element": { - "kind": "ElementReference", - "name": "panel-3" - } - } - }, - { - "kind": "AutoGridLayoutItem", - "spec": { - "element": { - "kind": "ElementReference", - "name": "panel-4" - } - } - }, - { - "kind": "AutoGridLayoutItem", - "spec": { - "element": { - "kind": "ElementReference", - "name": "panel-2" - } - } - }, - { - "kind": "AutoGridLayoutItem", - "spec": { - "element": { - "kind": "ElementReference", - "name": "panel-1" - } - } - }, - { - "kind": "AutoGridLayoutItem", - "spec": { - "element": { - "kind": "ElementReference", - "name": "panel-5" - } - } - }, - { - "kind": "AutoGridLayoutItem", - "spec": { - "element": { - "kind": "ElementReference", - "name": "panel-6" - } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" } } - ], - "maxColumnCount": 3, - "rowHeightMode": "standard" - } - }, - "links": [], - "liveNow": false, - "preload": false, - "tags": [], - "timeSettings": { - "autoRefresh": "", - "autoRefreshIntervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], - "fiscalYearStartMonth": 0, - "from": "now-6h", - "hideTimepicker": false, - "timezone": "browser", - "to": "now" - }, - "title": "Test: V2alpha1 dashboard with viz config" + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } }, - "status": {} + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with viz config", + "variables": [] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } } - \ No newline at end of file +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.complete.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.complete.json new file mode 100644 index 00000000000..fda30922928 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.complete.json @@ -0,0 +1,509 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-complete", + "labels": { + "category": "test" + }, + "annotations": { + "description": "Complete example of v2alpha1 dashboard features" + } + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana", + "version": "v0", + "datasource": { + "name": "-- Grafana --" + }, + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "changes(process_start_time_seconds[1m])", + "refId": "Anno" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "Prometheus Annotations", + "builtIn": false + } + } + ], + "cursorSync": "Tooltip", + "description": "This dashboard demonstrates all features that need to be converted from v2alpha1 to v2beta1", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Panel with Conditional Rendering", + "description": "This panel demonstrates conditional rendering features", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up{job=\"grafana\"}" + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [ + { + "kind": "reduce", + "spec": { + "id": "reduce", + "options": { + "includeTimeField": false, + "mode": "reduceFields", + "reducers": [ + "mean" + ] + } + } + } + ], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "12.1.0-pre", + "spec": { + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "textMode": "auto" + }, + "fieldConfig": { + "defaults": { + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "Down", + "color": "red" + }, + "1": { + "text": "Up", + "color": "green" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "red" + }, + { + "value": 1, + "color": "green" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "RowsLayout", + "spec": { + "rows": [ + { + "kind": "Row", + "spec": { + "title": "Conditional Row", + "collapse": false, + "hideHeader": false, + "fillScreen": false, + "conditionalRendering": { + "kind": "ConditionalRenderingGroup", + "spec": { + "visibility": "show", + "condition": "and", + "items": [ + { + "kind": "ConditionalRenderingVariable", + "spec": { + "variable": "group_by", + "operator": "includes", + "value": "instance" + } + }, + { + "kind": "ConditionalRenderingData", + "spec": { + "value": true + } + }, + { + "kind": "ConditionalRenderingTimeRangeSize", + "spec": { + "value": "1h" + } + } + ] + } + }, + "layout": { + "kind": "GridLayout", + "spec": { + "items": [ + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 0, + "width": 24, + "height": 8, + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + } + ] + } + } + } + } + ] + } + }, + "links": [], + "liveNow": true, + "preload": true, + "tags": [ + "test", + "example", + "migration" + ], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "10s", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "weekStart": "monday", + "fiscalYearStartMonth": 0 + }, + "title": "Test: Complete V2alpha1 Dashboard Example", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "prometheus_query", + "current": { + "text": "All", + "value": [ + "$__all" + ] + }, + "label": "Prometheus Query", + "hide": "dontHide", + "refresh": "time", + "skipUrlSync": false, + "description": "Shows all up metrics", + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "alphabetical", + "definition": "up", + "options": null, + "multi": true, + "includeAll": true, + "allowCustomValue": false + } + }, + { + "kind": "TextVariable", + "spec": { + "name": "text_var", + "current": { + "selected": true, + "text": "server1", + "value": "server1" + }, + "query": "server1,server2,server3", + "label": "Text Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A simple text variable" + } + }, + { + "kind": "ConstantVariable", + "spec": { + "name": "constant_var", + "query": "production", + "current": { + "selected": true, + "text": "production", + "value": "production" + }, + "label": "Constant", + "hide": "dontHide", + "skipUrlSync": true, + "description": "A constant value" + } + }, + { + "kind": "DatasourceVariable", + "spec": { + "name": "ds_var", + "pluginId": "prometheus", + "refresh": "load", + "regex": "/^gdev-/", + "current": { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + }, + "options": [ + { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + } + ], + "multi": false, + "includeAll": false, + "label": "Datasource", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Select a datasource", + "allowCustomValue": false + } + }, + { + "kind": "IntervalVariable", + "spec": { + "name": "interval", + "query": "1m,5m,10m,30m,1h,6h,12h,1d", + "current": { + "selected": true, + "text": "5m", + "value": "5m" + }, + "options": [ + { + "text": "1m", + "value": "1m" + }, + { + "text": "5m", + "value": "5m" + }, + { + "text": "10m", + "value": "10m" + }, + { + "text": "30m", + "value": "30m" + }, + { + "text": "1h", + "value": "1h" + }, + { + "text": "6h", + "value": "6h" + }, + { + "text": "12h", + "value": "12h" + }, + { + "text": "1d", + "value": "1d" + } + ], + "auto": true, + "auto_min": "10s", + "auto_count": 30, + "refresh": "onTimeRangeChanged", + "label": "Interval", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Time interval selection" + } + }, + { + "kind": "CustomVariable", + "spec": { + "name": "custom_var", + "query": "prod : Production, staging : Staging, dev : Development", + "current": { + "text": [ + "Production" + ], + "value": [ + "prod" + ] + }, + "options": [ + { + "text": "Production", + "value": "prod" + }, + { + "text": "Staging", + "value": "staging" + }, + { + "text": "Development", + "value": "dev" + } + ], + "multi": true, + "includeAll": true, + "allValue": "*", + "label": "Custom Options", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Custom multi-value variable", + "allowCustomValue": true + } + }, + { + "kind": "GroupByVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "group_by", + "current": { + "text": "instance", + "value": "instance" + }, + "options": null, + "multi": false, + "label": "Group By", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Group metrics by label" + } + }, + { + "kind": "AdhocVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "filters", + "baseFilters": [ + { + "key": "job", + "operator": "=", + "value": "grafana", + "condition": "AND" + } + ], + "filters": [], + "defaultKeys": [ + { + "text": "job", + "value": "job", + "expandable": true + }, + { + "text": "instance", + "value": "instance", + "expandable": true + } + ], + "label": "Filters", + "hide": "dontHide", + "skipUrlSync": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.ds-data-query.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.ds-data-query.json new file mode 100644 index 00000000000..09e35c64258 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.ds-data-query.json @@ -0,0 +1,1092 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-annotations" + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana", + "version": "v0", + "datasource": { + "name": "-- Grafana --" + }, + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "PD8C576611E62080A" + }, + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "no-ds-testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "no-ds-prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "PBBCEC2D313BC06C3" + }, + "spec": { + "editorMode": "builder", + "format": "table", + "lines": 10, + "rawSql": "", + "refId": "Anno", + "scenarioId": "annotations", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "postgress-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "elasticsearch", + "version": "v0", + "datasource": { + "name": "gdev-elasticsearch" + }, + "spec": { + "lines": 10, + "query": "test query", + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "elastic - annos", + "builtIn": false, + "legacyOptions": { + "tagsField": "asd", + "textField": "asd", + "timeEndField": "asdas", + "timeField": "asd" + } + } + } + ], + "cursorSync": "Off", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-2": { + "kind": "Panel", + "spec": { + "id": 2, + "title": "Simple stat (NO DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": { + "scenarioId": "random_walk", + "seriesCount": 4 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "12.1.0-pre", + "spec": { + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + }, + "panel-3": { + "kind": "Panel", + "spec": { + "id": 3, + "title": "Panel with NO REF to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-4": { + "kind": "Panel", + "spec": { + "id": 4, + "title": "Panel with ref to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-5": { + "kind": "Panel", + "spec": { + "id": 5, + "title": "Mixed DS WITH REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": {} + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-6": { + "kind": "Panel", + "spec": { + "id": 6, + "title": "Mixed DS WITHOUT REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": {} + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with annotations", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "variable-ds-prometheus", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": { + "csv": "1,2,3,4", + "scenarioId": "csv_metric_values" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds-empty-query", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": {} + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-default-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.groupby-adhoc-vars.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.groupby-adhoc-vars.json new file mode 100644 index 00000000000..6f377850074 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.groupby-adhoc-vars.json @@ -0,0 +1,98 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-groupby-adhoc-vars" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": {}, + "layout": null, + "links": [], + "preload": false, + "tags": null, + "timeSettings": { + "from": "", + "to": "", + "autoRefresh": "", + "autoRefreshIntervals": null, + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with group by and adhoc variables", + "variables": [ + { + "kind": "GroupByVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "", + "current": { + "text": "text7", + "value": "value7" + }, + "options": null, + "multi": false, + "label": "Group By Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A group by variable" + } + }, + { + "kind": "AdhocVariable", + "group": "prometheus", + "datasource": { + "name": "datasource-3" + }, + "spec": { + "name": "adhocVar", + "baseFilters": [ + { + "key": "key1", + "operator": "=", + "value": "value1", + "condition": "AND" + }, + { + "key": "key2", + "operator": "=", + "value": "value2", + "condition": "OR" + } + ], + "filters": [ + { + "key": "key3", + "operator": "=", + "value": "value3", + "condition": "AND" + } + ], + "defaultKeys": [ + { + "text": "defaultKey1", + "value": "defaultKey1", + "group": "defaultGroup1", + "expandable": true + } + ], + "label": "Adhoc Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "An adhoc variable", + "allowCustomValue": true + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.viz-config.json b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.viz-config.json new file mode 100644 index 00000000000..a7f48d67563 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/input/v2beta1.viz-config.json @@ -0,0 +1,220 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-viz-config" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with viz config", + "variables": [] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v10.table_thresholds.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v10.table_thresholds.v42.v2alpha1.json index 2640aa14f7b..7a4a4d2c4b7 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v10.table_thresholds.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v10.table_thresholds.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2alpha1.json index 31afdc108a2..f427b5dbcb7 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -191,7 +191,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(server)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2beta1.json index 053f7e18d9e..8e59bbd21ca 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v11.no-op-migration.v42.v2beta1.json @@ -197,7 +197,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(server)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2alpha1.json index 252a81e9796..f55769f82b2 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -75,7 +75,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -98,7 +98,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -121,7 +121,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -144,7 +144,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -167,7 +167,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -190,7 +190,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2beta1.json index 82c17382c32..febee713d97 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v12.template-variables.v42.v2beta1.json @@ -77,7 +77,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -102,7 +102,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -127,7 +127,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -152,7 +152,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -177,7 +177,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -202,7 +202,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.graph_thresholds.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.graph_thresholds.v42.v2alpha1.json index 49108c4b128..a1ef92d3d50 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.graph_thresholds.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.graph_thresholds.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -178,7 +178,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -222,7 +222,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.minimal_graph_config.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.minimal_graph_config.v42.v2alpha1.json index c0ab55dcacf..3edc16edae6 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.minimal_graph_config.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v13.minimal_graph_config.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "editorMode": "builder", "expr": "{\"a.utf8.metric 🤘\", job=\"prometheus-utf8\"}", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2alpha1.json index 50d3e9aff2f..e4a62f00bc7 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "cpu_usage" } @@ -92,7 +92,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "memory_usage" } @@ -195,7 +195,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(server)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2beta1.json index 8ee98acf062..975fc24c969 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v14.shared_crosshair_to_graph_tooltip.v42.v2beta1.json @@ -201,7 +201,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(server)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2alpha1.json index 5add17319b1..decdff12902 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -31,7 +31,7 @@ "kind": "AnnotationQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": {} }, "enable": true, @@ -66,7 +66,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "sum by (job, version) (up{job=~\".*\"})", "format": "table", @@ -209,7 +209,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "sum by (deployment) (up{job=\"kube-state-metrics\"})", "format": "table", @@ -331,7 +331,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "sum by (statefulset) (up{job=\"kube-state-metrics\"})", "format": "table", @@ -453,7 +453,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "max by (pod) (up{job=\"mimir-aggregator\"})", "format": "time_series", @@ -541,7 +541,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "sum by (deployment) (up{job=\"kube-state-metrics\"})", "format": "table", @@ -663,7 +663,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "sum by (statefulset) (up{job=\"kube-state-metrics\"})", "format": "table", @@ -962,7 +962,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up, job)" } @@ -989,7 +989,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up{job=~\"$cluster\"}, instance)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2beta1.json index 709c7f5f422..9db5193d5af 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.mimir_rollout_debugging.v42.v2beta1.json @@ -978,7 +978,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(up, job)" @@ -1007,7 +1007,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(up{job=~\"$cluster\"}, instance)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v0alpha1.json index 2b5625047da..a6de319cc04 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v0alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v0alpha1.json @@ -95,7 +95,9 @@ "templating": { "list": [ { - "datasource": "prometheus", + "datasource": { + "type": "prometheus" + }, "name": "server", "options": [], "query": "label_values(server)", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2alpha1.json index 34d2ad77891..347556eb45d 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -35,7 +35,7 @@ "uid": "grafana" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -63,7 +63,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -107,7 +107,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -208,7 +208,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(server)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2beta1.json index a2a031d5fa0..756f4a76074 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v15.no-op-migration.v42.v2beta1.json @@ -215,7 +215,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(server)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.empty-rows-and-panels-array.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.empty-rows-and-panels-array.v42.v2alpha1.json index f94cd8566b2..1bf45848829 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.empty-rows-and-panels-array.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.empty-rows-and-panels-array.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -47,7 +47,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "increase(demo_latency_iota{env=~\"$env\", region=~\"$region\", node=~\"$node\", service=~\"$service\", type=\"primary\"}[$__rate_interval])", "format": "time_series", @@ -152,7 +152,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "increase(demo_latency_iota{env=~\"$env\", region=~\"$region\", node=~\"$node\", service=~\"$service\", type=\"secondary\"}[$__rate_interval])", "format": "time_series", @@ -257,7 +257,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "increase(example_events_kappa{env=~\"$env\", region=~\"$region\", node=~\"$node\", service=~\"$service\"}[$__rate_interval])", "format": "time_series", @@ -366,7 +366,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "random_metric_alpha{env=~\"$env\", region=~\"$region\", node=~\"$node\"}", "format": "time_series", @@ -475,7 +475,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "rate(sample_counter_beta{env=~\"$env\", region=~\"$region\", node=~\"$node\"}[$__rate_interval])", "format": "time_series", @@ -584,7 +584,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "increase(test_errors_gamma{env=~\"$env\", region=~\"$region\", node=~\"$node\"}[$__rate_interval])", "format": "time_series", @@ -693,7 +693,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "rate(demo_events_delta{env=~\"$env\", region=~\"$region\", node=~\"$node\"}[$__rate_interval])", "format": "time_series", @@ -802,7 +802,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "example_usage_epsilon{env=~\"$env\", region=~\"$region\", node=~\"$node\"}", "format": "time_series", @@ -910,7 +910,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "random_total_zeta{env=~\"$env\", region=~\"$region\", node=~\"$node\"}", "format": "time_series", @@ -930,7 +930,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "sample_target_eta{env=~\"$env\", region=~\"$region\", node=~\"$node\"}", "format": "time_series", @@ -1038,7 +1038,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "100 * random_total_zeta{env=~\"$env\", region=~\"$region\", node=~\"$node\"} / clamp_min(test_available_theta{env=~\"$env\", region=~\"$region\", node=~\"$node\"},1)", "format": "time_series", @@ -1346,7 +1346,7 @@ "uid": "${example_datasource}" }, "query": { - "kind": "DataQuery", + "kind": "", "spec": { "__legacyStringValue": "label_values(system_info_lambda{}, env)" } @@ -1377,7 +1377,7 @@ "uid": "${example_datasource}" }, "query": { - "kind": "DataQuery", + "kind": "", "spec": { "__legacyStringValue": "label_values(system_info_lambda{env=~\"$env\"}, region)" } @@ -1408,7 +1408,7 @@ "uid": "${example_datasource}" }, "query": { - "kind": "DataQuery", + "kind": "", "spec": { "__legacyStringValue": "label_values(system_info_lambda{env=~\"$env\", region=~\"$region\"}, node)" } @@ -1439,7 +1439,7 @@ "uid": "${example_datasource}" }, "query": { - "kind": "DataQuery", + "kind": "", "spec": { "__legacyStringValue": "label_values(example_events_kappa{env=~\"$env\", region=~\"$region\", node=~\"$node\"}, service)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.grid_layout_upgrade.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.grid_layout_upgrade.v42.v2alpha1.json index c17e76fbc77..6cf8402f377 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.grid_layout_upgrade.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.grid_layout_upgrade.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -178,7 +178,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -306,7 +306,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -350,7 +350,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -394,7 +394,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -438,7 +438,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.span_zero_demo.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.span_zero_demo.v42.v2alpha1.json index c8699b49e46..221b01ffec5 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.span_zero_demo.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v16.span_zero_demo.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -93,7 +93,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "expr": "{namespace=\"default\", cluster=\"$cluster\", job=\"app-service\"} | logfmt" } @@ -144,7 +144,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -191,7 +191,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "max(app_worker_threads_active{cluster=\"$cluster\", namespace=\"default\"})", "instant": true @@ -238,7 +238,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "tempo", "spec": { "filters": [ { @@ -305,7 +305,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.99, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (le, resources_changed_bucket, action)) and on(resources_changed_bucket, action) sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (resources_changed_bucket, action) \u003e 0", "legendFormat": "{{action}} q0.99 - size {{resources_changed_bucket}}" @@ -323,7 +323,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.9, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (le, resources_changed_bucket, action)) and on(resources_changed_bucket, action) sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (resources_changed_bucket, action) \u003e 0", "legendFormat": "{{action}} q0.95 - size {{resources_changed_bucket}}" @@ -341,7 +341,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.5, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (le, resources_changed_bucket, action)) and on(resources_changed_bucket, action) sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (resources_changed_bucket, action) \u003e 0", "legendFormat": "{{action}} q0.5 - size {{resources_changed_bucket}}" @@ -359,7 +359,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.1, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (le, resources_changed_bucket, action)) and on(resources_changed_bucket, action) sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (resources_changed_bucket, action) \u003e 0", "legendFormat": "{{action}} q0.1 - size {{resources_changed_bucket}}" @@ -461,7 +461,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.99, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[5m])) by (le, resources_changed_bucket, action))", "legendFormat": "{{action}} q0.99 - size {{resources_changed_bucket}}" @@ -479,7 +479,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.95, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[5m])) by (le, resources_changed_bucket, action))", "legendFormat": "{{action}} q0.95 - size {{resources_changed_bucket}}" @@ -497,7 +497,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.5, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[5m])) by (le, resources_changed_bucket, action))", "legendFormat": "{{action}} q0.5 - size {{resources_changed_bucket}}" @@ -515,7 +515,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.1, sum(rate(app_operation_duration_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[5m])) by (le, resources_changed_bucket, action))", "legendFormat": "{{action}} q0.1 - size {{resources_changed_bucket}}" @@ -562,7 +562,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "clamp_min(sum(app_operation_queue_size{cluster=\"$cluster\", namespace=\"default\"}), 0)", "legendFormat": "Queue size" @@ -609,7 +609,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "avg(histogram_quantile(0.5, sum(rate(app_operation_queue_wait_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[7d])) by (le)))", "legendFormat": "Queue size" @@ -660,7 +660,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.99, sum(rate(app_operation_queue_wait_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[$__rate_interval])) by (le))", "legendFormat": "q0.99" @@ -678,7 +678,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.95, sum(rate(app_operation_queue_wait_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[$__rate_interval])) by (le))", "legendFormat": "q0.95" @@ -696,7 +696,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.5, sum(rate(app_operation_queue_wait_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[$__rate_interval])) by (le))", "legendFormat": "q0.5" @@ -714,7 +714,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "histogram_quantile(0.1, sum(rate(app_operation_queue_wait_seconds_bucket{cluster=\"$cluster\", namespace=\"default\"}[$__rate_interval])) by (le))", "legendFormat": "q0.1" @@ -761,7 +761,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -808,7 +808,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "count by (cluster, channel)(label_replace(label_replace(kube_pod_container_info{namespace=\"default\", container=\"app-worker\", pod=~\"app-worker.*\", cluster=~\"$cluster\"}, \"version\", \"$1\", \"image\", \".+:(.+)\"), \"channel\", \"$1\", \"container\", \".+-(.+)\"))", "legendFormat": "{{cluster}}" @@ -855,7 +855,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "max(kube_pod_container_resource_requests{namespace=\"default\", resource=\"memory\", cluster=~\"$cluster\", container=\"app-worker\", pod=~\"app-worker.*\"})", "legendFormat": "Memory Request" @@ -873,7 +873,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "max(kube_pod_container_resource_limits{namespace=\"default\", resource=\"memory\", cluster=~\"$cluster\", container=\"app-worker\", pod=~\"app-worker.*\"})", "legendFormat": "Memory Limit" @@ -891,7 +891,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "max(container_memory_usage_bytes{namespace=\"default\",cluster=~\"$cluster\", container=\"app-worker\", pod=~\"app-worker.*\"}) by (pod)", "legendFormat": "Container usage {{pod}}" @@ -938,7 +938,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "sum(irate(container_cpu_usage_seconds_total{namespace=\"default\", cluster=~\"$cluster\", container=\"app-worker\", pod=~\"app-worker-.*\"}[$__rate_interval])) by (pod, container, cpu)", "legendFormat": "Usage {{pod}}" @@ -956,7 +956,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "sum(irate(container_cpu_cfs_throttled_seconds_total{namespace=\"default\", cluster=~\"$cluster\", container=\"app-worker\", pod=~\"app-worker-.*\"}[$__rate_interval])) by (pod, container)", "legendFormat": "Throttling {{pod}}" @@ -974,7 +974,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "max(kube_pod_container_resource_limits{namespace=\"default\", cluster=~\"$cluster\", container=\"app-worker\", pod=~\"app-worker-.*\", resource=\"cpu\"})", "legendFormat": "CPU limit" @@ -992,7 +992,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "max(kube_pod_container_resource_requests{namespace=\"default\", cluster=~\"$cluster\", container=\"app-worker\", pod=~\"app-worker-.*\", resource=\"cpu\"})", "legendFormat": "CPU request" @@ -1039,7 +1039,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -1086,7 +1086,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -1133,7 +1133,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "sum by (action) (app_jobs_processed_total{outcome=\"success\", cluster=\"$cluster\", namespace=\"default\"})\n/\nsum by (action) (app_jobs_processed_total{cluster=\"$cluster\", namespace=\"default\"})\n", "legendFormat": "{{action}}" @@ -1199,7 +1199,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "expr": "{namespace=\"default\", cluster=\"$cluster\", job=\"app-service\"} | logfmt | level=\"error\"" } @@ -1640,7 +1640,7 @@ "uid": "${prom}" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(app_worker_threads_active,cluster)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v17.minspan_to_maxperrow.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v17.minspan_to_maxperrow.v42.v2alpha1.json index 9534b61db24..aa9017f0720 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v17.minspan_to_maxperrow.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v17.minspan_to_maxperrow.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -178,7 +178,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -222,7 +222,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -266,7 +266,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -310,7 +310,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -354,7 +354,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -398,7 +398,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -442,7 +442,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v18.gauge_options.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v18.gauge_options.v42.v2alpha1.json index 7c22f7d6a45..f154e2e2679 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v18.gauge_options.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v18.gauge_options.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -112,7 +112,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -161,7 +161,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -211,7 +211,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -267,7 +267,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v19.panel_links.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v19.panel_links.v42.v2alpha1.json index 42f9b90a138..e51fc93636a 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v19.panel_links.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v19.panel_links.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -51,7 +51,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -100,7 +100,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -149,7 +149,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -199,7 +199,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -248,7 +248,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -292,7 +292,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2alpha1.json index 2be443726d3..129ba30c694 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "target": "cpu.usage" } @@ -92,7 +92,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "target": "memory.usage" } @@ -138,7 +138,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -182,7 +182,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "target": "disk.io" } @@ -311,7 +311,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(server)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2beta1.json index 6a82b1603f8..0c80ae34850 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v2.panels-and-services.v42.v2beta1.json @@ -321,7 +321,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(server)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v20.variable_syntax_links.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v20.variable_syntax_links.v42.v2alpha1.json index 81ccea2ab37..95d3f1d8834 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v20.variable_syntax_links.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v20.variable_syntax_links.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -103,7 +103,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -165,7 +165,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -229,7 +229,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -293,7 +293,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v21.data_links_series_to_field.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v21.data_links_series_to_field.v42.v2alpha1.json index 32132d368c5..0b2251f0dca 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v21.data_links_series_to_field.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v21.data_links_series_to_field.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -101,7 +101,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -160,7 +160,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -221,7 +221,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -272,7 +272,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v22.table_panel_align.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v22.table_panel_align.v42.v2alpha1.json index fbb8429153b..dd03601b0ac 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v22.table_panel_align.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v22.table_panel_align.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2alpha1.json index 7b4fe20e68e..a40797444f4 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "up" } @@ -140,7 +140,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -169,7 +169,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -192,7 +192,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -215,7 +215,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -238,7 +238,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -261,7 +261,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -284,7 +284,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2beta1.json index 8004109e441..a97d9a51e2f 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v23.multi_variable_alignment.v42.v2beta1.json @@ -144,7 +144,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -175,7 +175,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -200,7 +200,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -225,7 +225,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -250,7 +250,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -275,7 +275,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -300,7 +300,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v24.table-angular.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v24.table-angular.v42.v2alpha1.json index 6226b6c15e8..c9dd5bffa51 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v24.table-angular.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v24.table-angular.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -61,7 +61,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -105,7 +105,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -149,7 +149,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -193,7 +193,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -237,7 +237,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -281,7 +281,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -325,7 +325,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -369,7 +369,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -413,7 +413,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -457,7 +457,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -501,7 +501,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -545,7 +545,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -589,7 +589,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -633,7 +633,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -677,7 +677,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -736,7 +736,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -780,7 +780,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2alpha1.json index e83721eca1c..3375a6bffe4 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -31,7 +31,7 @@ "kind": "AnnotationQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": {} }, "enable": true, @@ -59,7 +59,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -103,7 +103,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -204,7 +204,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2beta1.json index 7266cb6084c..b873fdea3a3 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v25.no-op-migration.v42.v2beta1.json @@ -212,7 +212,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v26.text2_to_text.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v26.text2_to_text.v42.v2alpha1.json index 001fe0cf137..a135614baba 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v26.text2_to_text.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v26.text2_to_text.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v27.repeated_panels_and_constant_variable.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v27.repeated_panels_and_constant_variable.v42.v2alpha1.json index c722d627187..51cdcba85c1 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v27.repeated_panels_and_constant_variable.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v27.repeated_panels_and_constant_variable.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2alpha1.json index dd56c1cd995..54384f8dc06 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -75,7 +75,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up, instance)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2beta1.json index c938e4a730f..6626b919137 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.remove_variable_properties.v42.v2beta1.json @@ -77,7 +77,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(up, instance)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2alpha1.json index c819be43bc1..82fc46be585 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -61,7 +61,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -105,7 +105,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -149,7 +149,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -164,7 +164,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -208,7 +208,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "rate(http_requests_total[5m])" } @@ -337,7 +337,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up, instance)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2beta1.json index 5a0d8b3a96b..4eff500bef6 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_and_variable_properties.v42.v2beta1.json @@ -349,7 +349,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(up, instance)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_migration.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_migration.v42.v2alpha1.json index 985b316822d..0873ad2190c 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_migration.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v28.singlestat_migration.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -61,7 +61,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -105,7 +105,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -120,7 +120,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -164,7 +164,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -208,7 +208,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -223,7 +223,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -267,7 +267,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -313,7 +313,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -400,7 +400,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -452,7 +452,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "rate(http_requests_total[5m])" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2alpha1.json index ce4f5103c7d..2688367b33b 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "up" } @@ -136,7 +136,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -159,7 +159,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -182,7 +182,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -205,7 +205,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -228,7 +228,7 @@ "refresh": "onTimeRangeChanged", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -251,7 +251,7 @@ "refresh": "onTimeRangeChanged", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -274,7 +274,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -297,7 +297,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -320,7 +320,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -343,7 +343,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2beta1.json index 98d2361f0ae..8e57483ceb4 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v29.query_variables_refresh_and_options.v42.v2beta1.json @@ -140,7 +140,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -165,7 +165,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -190,7 +190,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -215,7 +215,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -240,7 +240,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -265,7 +265,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -290,7 +290,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -315,7 +315,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -340,7 +340,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, @@ -365,7 +365,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v3.no-op.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v3.no-op.v42.v2alpha1.json index 4916dcaa820..db33eea5445 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v3.no-op.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v3.no-op.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -178,7 +178,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v30.value_mappings_and_tooltip_options.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v30.value_mappings_and_tooltip_options.v42.v2alpha1.json index 5d81e9bab64..60334f9ffb1 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v30.value_mappings_and_tooltip_options.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v30.value_mappings_and_tooltip_options.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -162,7 +162,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -210,7 +210,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -259,7 +259,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -307,7 +307,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -428,7 +428,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -479,7 +479,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v31.labels_to_fields_merge.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v31.labels_to_fields_merge.v42.v2alpha1.json index 1ad2c6f1b29..ac34174bfcb 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v31.labels_to_fields_merge.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v31.labels_to_fields_merge.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -105,7 +105,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -194,7 +194,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -238,7 +238,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -376,7 +376,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -449,7 +449,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2alpha1.json index 1d68e967a49..3c58166f6c4 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -31,7 +31,7 @@ "kind": "AnnotationQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": {} }, "enable": true, @@ -59,7 +59,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -124,7 +124,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -297,7 +297,7 @@ "refresh": "never", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2beta1.json index b80ef22e794..1611cea2464 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v32.no_op_migration.v42.v2beta1.json @@ -306,7 +306,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": {} }, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v33.panel_ds_name_to_ref.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v33.panel_ds_name_to_ref.v42.v2alpha1.json index c38887d458c..d41d2d7bda3 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v33.panel_ds_name_to_ref.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v33.panel_ds_name_to_ref.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "description": "Target with UID reference should migrate to full object" } @@ -92,7 +92,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "description": "Nested target should also migrate from string to object" } @@ -138,7 +138,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": { "description": "Target with existing object should remain unchanged" } @@ -184,7 +184,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": {} }, "datasource": { @@ -228,7 +228,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -272,7 +272,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "description": "Null target datasource should remain null" } @@ -289,7 +289,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "description": "Valid string should migrate to object" } @@ -306,7 +306,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "description": "Non-existing datasource should be preserved as-is (migration returns nil)" } @@ -323,7 +323,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "description": "Target without datasource field should remain unchanged" } @@ -369,7 +369,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "description": "Existing object target should remain unchanged" } @@ -386,7 +386,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "description": "String target should migrate to object" } @@ -403,7 +403,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "description": "Default datasource string should migrate to object" } @@ -449,7 +449,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "description": "Empty string target should also migrate to empty object {}" } @@ -491,7 +491,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "description": "Unknown target datasource should remain unchanged (migration returns nil)" } @@ -508,7 +508,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "description": "Empty string target should migrate to {}" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v34.multiple_stats_cloudwatch.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v34.multiple_stats_cloudwatch.v42.v2alpha1.json index 963c1e4b649..ad69702a739 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v34.multiple_stats_cloudwatch.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v34.multiple_stats_cloudwatch.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -35,7 +35,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -61,7 +61,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -87,7 +87,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -112,7 +112,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -138,7 +138,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -163,7 +163,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -189,7 +189,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -206,7 +206,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -232,7 +232,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -258,7 +258,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -284,7 +284,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -309,7 +309,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -335,7 +335,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -361,7 +361,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -387,7 +387,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -413,7 +413,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -450,7 +450,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-123456" @@ -476,7 +476,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-123456" @@ -502,7 +502,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-123456" @@ -557,7 +557,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-missing-fields" @@ -611,7 +611,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-with-expression" @@ -637,7 +637,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-with-expression" @@ -692,7 +692,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-insights" @@ -746,7 +746,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-null-stats" @@ -770,7 +770,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-null-stats" @@ -795,7 +795,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-null-stats" @@ -820,7 +820,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-null-stats" @@ -874,7 +874,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-invalid-only" @@ -899,7 +899,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-invalid-only" @@ -924,7 +924,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-invalid-only" @@ -949,7 +949,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "InstanceId": "i-invalid-only" @@ -1003,7 +1003,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "cpu_usage" } @@ -1049,7 +1049,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "LoadBalancer": "my-load-balancer" @@ -1103,7 +1103,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "DBInstanceIdentifier": "my-db" @@ -1157,7 +1157,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "QueueName": "my-queue" @@ -1182,7 +1182,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "up" } @@ -1199,7 +1199,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "TopicName": "my-topic" @@ -1224,7 +1224,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "QueueName": "my-queue" @@ -1278,7 +1278,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "BucketName": "my-bucket" @@ -1331,7 +1331,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "FunctionName": "my-function" @@ -1356,7 +1356,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "FunctionName": "my-function" @@ -1381,7 +1381,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "FunctionName": "my-function" @@ -1405,7 +1405,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "FunctionName": "my-function" @@ -1430,7 +1430,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "FunctionName": "my-function" @@ -1484,7 +1484,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "StreamName": "my-stream" @@ -1509,7 +1509,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "StreamName": "my-stream" @@ -1534,7 +1534,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "StreamName": "my-stream" @@ -1588,7 +1588,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "ClusterName": "my-cluster" @@ -1614,7 +1614,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "dimensions": { "ClusterName": "my-cluster" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v35.ensure_x_axis_visibility.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v35.ensure_x_axis_visibility.v42.v2alpha1.json index 936aeb8c30f..c06dd85bb25 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v35.ensure_x_axis_visibility.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v35.ensure_x_axis_visibility.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -136,7 +136,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -197,7 +197,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -241,7 +241,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -302,7 +302,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -375,7 +375,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -423,7 +423,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v36.ds_name_to_ref.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v36.ds_name_to_ref.v42.v2alpha1.json index 17a351eaa46..474b22d4ffb 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v36.ds_name_to_ref.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v36.ds_name_to_ref.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -35,7 +35,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": false, @@ -52,7 +52,7 @@ "uid": "existing-target-uid" }, "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "enable": false, @@ -69,7 +69,7 @@ "uid": "existing-target-uid" }, "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "enable": false, @@ -86,7 +86,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": false, @@ -103,7 +103,7 @@ "uid": "unknown-datasource-name" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": false, @@ -131,7 +131,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -175,7 +175,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -219,7 +219,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -263,7 +263,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -307,7 +307,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -351,7 +351,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -395,7 +395,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -410,7 +410,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -454,7 +454,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -498,7 +498,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -542,7 +542,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -557,7 +557,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "__expr__", "spec": {} }, "datasource": { @@ -601,7 +601,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -645,7 +645,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "datasource": { @@ -922,7 +922,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", @@ -949,7 +949,7 @@ "uid": "existing-target-uid" }, "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "regex": "", @@ -976,7 +976,7 @@ "uid": "existing-target-uid" }, "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": {} }, "regex": "", @@ -1003,7 +1003,7 @@ "uid": "unknown-datasource" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "regex": "", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v37.legend_normalization.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v37.legend_normalization.v42.v2alpha1.json index 55f6c000481..eb254828d3e 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v37.legend_normalization.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v37.legend_normalization.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.table_displaymode_comprehensive.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.table_displaymode_comprehensive.v42.v2alpha1.json index 66bb53a1033..92f6ec2ef8e 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.table_displaymode_comprehensive.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.table_displaymode_comprehensive.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.timeseries_table_display_mode.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.timeseries_table_display_mode.v42.v2alpha1.json index 52b313e6b4b..a1fb5ca81af 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.timeseries_table_display_mode.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v38.timeseries_table_display_mode.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v39.transform_timeseries_table.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v39.transform_timeseries_table.v42.v2alpha1.json index df196e14beb..37eb51fbdff 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v39.transform_timeseries_table.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v39.transform_timeseries_table.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v4.no-op.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v4.no-op.v42.v2alpha1.json index 1a3bd5c0e72..e6701e601c7 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v4.no-op.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v4.no-op.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_empty_string.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_empty_string.v42.v2alpha1.json index db8e3a3542a..10f6bbf20f4 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_empty_string.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_empty_string.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_false.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_false.v42.v2alpha1.json index bd834847e28..13a901e94af 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_false.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_false.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_not_set.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_not_set.v42.v2alpha1.json index 8279dfd765b..04b94fc3919 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_not_set.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_not_set.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_numeric.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_numeric.v42.v2alpha1.json index 2cc922fc5f5..103fe15fdf3 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_numeric.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_numeric.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_string.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_string.v42.v2alpha1.json index d9347950655..9fe42b778dd 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_string.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_string.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_true.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_true.v42.v2alpha1.json index 9601af1797a..3524796f0aa 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_true.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v40.refresh_true.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.no_time_picker.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.no_time_picker.v42.v2alpha1.json index 6f34667e603..9036e54f22d 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.no_time_picker.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.no_time_picker.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_no_time_options.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_no_time_options.v42.v2alpha1.json index 46a07c16b0e..78e27ac4411 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_no_time_options.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_no_time_options.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_time_options.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_time_options.v42.v2alpha1.json index 15368de002c..8115f687203 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_time_options.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v41.time_picker_time_options.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.harky_must.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.harky_must.v42.v2alpha1.json index d2e8c73301e..ee97abbd7e2 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.harky_must.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.harky_must.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.hidefrom_tooltip.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.hidefrom_tooltip.v42.v2alpha1.json index 9ef09aa0a9b..d231c6561ad 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.hidefrom_tooltip.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v42.hidefrom_tooltip.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v5.no-op.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v5.no-op.v42.v2alpha1.json index 5855379dc98..3c5f977cf19 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v5.no-op.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v5.no-op.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2alpha1.json index de1bac8f2f5..5c98e01c0f0 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -35,7 +35,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "enable": true, @@ -55,7 +55,7 @@ "uid": "loki-uid" }, "query": { - "kind": "DataQuery", + "kind": "loki", "spec": {} }, "enable": false, @@ -86,7 +86,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "cpu_usage{environment=\"$environment\", service=\"$service\"}" } @@ -132,7 +132,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "memory_usage{region=\"$region\"}" } @@ -239,7 +239,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up, instance)" } @@ -264,7 +264,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up, instance)" } @@ -317,7 +317,7 @@ "refresh": "onDashboardLoad", "skipUrlSync": false, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up, instance)" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2beta1.json index 3562d0154e1..19fbf9be88f 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v6.pulldowns_and_templating.v42.v2beta1.json @@ -273,7 +273,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(up, instance)" @@ -328,7 +328,7 @@ "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "__legacyStringValue": "label_values(up, instance)" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v7.timepicker.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v7.timepicker.v42.v2alpha1.json index 48cdb34c46b..425516baea9 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v7.timepicker.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v7.timepicker.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "up" } @@ -63,7 +63,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "cpu_usage" } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v8.influxdb_query.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v8.influxdb_query.v42.v2alpha1.json index 75a2970f8b6..0bf433b534a 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v8.influxdb_query.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v8.influxdb_query.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "groupBy": [ { @@ -143,7 +143,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "groupBy": [ { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v9.no-op.v42.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v9.no-op.v42.v2alpha1.json index 472d28ffa99..0e4ea43800d 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v9.no-op.v42.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/v1beta1-mig-v9.no-op.v42.v2alpha1.json @@ -14,7 +14,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": {} }, "enable": true, @@ -46,7 +46,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -90,7 +90,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { @@ -134,7 +134,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": {} }, "datasource": { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.annotation-conversions.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.annotation-conversions.v2alpha1.json index 9324355a72f..2430b59063b 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.annotation-conversions.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.annotation-conversions.v2alpha1.json @@ -17,7 +17,7 @@ "uid": "-- Grafana --" }, "query": { - "kind": "DataQuery", + "kind": "grafana", "spec": { "limit": 100, "matchAny": false, @@ -43,7 +43,7 @@ "uid": "existing-ref-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "ALERTS{alertstate=\"firing\"}", "interval": "1m", @@ -69,7 +69,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "lines": 10, "refId": "Anno", @@ -94,7 +94,7 @@ "uid": "existing-target-uid" }, "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": { "query": "tags:deployment", "refId": "Anno", @@ -123,7 +123,7 @@ "uid": "non-default-test-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "format": "table", "rawSql": "SELECT time, title, text, tags FROM annotations WHERE $__timeFilter(time)", @@ -148,7 +148,7 @@ "kind": "AnnotationQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "expr": "static_annotation_query", "refId": "Anno" @@ -172,7 +172,7 @@ "uid": "existing-ref-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "disabled_query", "refId": "Anno" @@ -196,7 +196,7 @@ "uid": "influx-uid" }, "query": { - "kind": "DataQuery", + "kind": "influxdb", "spec": { "query": "from(bucket: \"events\") |\u003e range(start: $__timeFrom, stop: $__timeTo) |\u003e filter(fn: (r) =\u003e r._measurement == \"deployments\")", "refId": "Anno" @@ -234,7 +234,7 @@ "uid": "cloudwatch-uid" }, "query": { - "kind": "DataQuery", + "kind": "cloudwatch", "spec": { "dimensions": { "InstanceId": "i-1234567890abcdef" @@ -264,7 +264,7 @@ "uid": "default-ds-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "ALERTS{alertstate=\"firing\"}", "interval": "1m", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.dashboard-properties.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.dashboard-properties.v2alpha1.json index 40810adb95b..156969fa5d3 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.dashboard-properties.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.dashboard-properties.v2alpha1.json @@ -13,7 +13,7 @@ "kind": "AnnotationQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": { "refId": "Anno" } @@ -45,7 +45,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "", "spec": {} }, "refId": "A", diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.panel-conversions.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.panel-conversions.v2alpha1.json index a291ccbc6b2..9e0d5378f9b 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.panel-conversions.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.panel-conversions.v2alpha1.json @@ -34,7 +34,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "up", "interval": "30s" @@ -52,7 +52,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "expr": "cpu_usage", "interval": "1m" @@ -159,7 +159,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "scenarioId": "random_walk" } @@ -205,7 +205,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "loki", "spec": { "format": "table", "rawSql": "SELECT * FROM metrics" @@ -259,7 +259,7 @@ "kind": "PanelQuery", "spec": { "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": { "bucketAggs": [ { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.variable-conversions.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.variable-conversions.v2alpha1.json index 556c3774d34..a4740089365 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.variable-conversions.v2alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v1beta1.variable-conversions.v2alpha1.json @@ -104,7 +104,7 @@ "uid": "existing-ref-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "label_values(up, instance)" } @@ -335,7 +335,7 @@ "uid": "existing-ref-uid" }, "query": { - "kind": "DataQuery", + "kind": "prometheus", "spec": { "__legacyStringValue": "up" } @@ -374,7 +374,7 @@ "uid": "existing-target-uid" }, "query": { - "kind": "DataQuery", + "kind": "elasticsearch", "spec": { "bucketAggs": [ { diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v0alpha1.json index 3306c334c5e..18d0371f1c4 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v0alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v0alpha1.json @@ -85,7 +85,7 @@ "id": 1, "title": "Panel with Conditional Rendering", "description": "This panel demonstrates conditional rendering features", - "links": null, + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -100,6 +100,7 @@ } }, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "refId": "A", @@ -241,7 +242,7 @@ ] } }, - "links": null, + "links": [], "liveNow": true, "preload": true, "tags": [ @@ -512,7 +513,12 @@ } ] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v1beta1.json index c55f325789d..abbcc39b4a6 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v1beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v1beta1.json @@ -85,7 +85,7 @@ "id": 1, "title": "Panel with Conditional Rendering", "description": "This panel demonstrates conditional rendering features", - "links": null, + "links": [], "data": { "kind": "QueryGroup", "spec": { @@ -100,6 +100,7 @@ } }, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "refId": "A", @@ -241,7 +242,7 @@ ] } }, - "links": null, + "links": [], "liveNow": true, "preload": true, "tags": [ @@ -512,7 +513,12 @@ } ] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v2beta1.json index 6d044300534..fda30922928 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.complete.v2beta1.json @@ -79,7 +79,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "datasource": { "name": "gdev-prometheus" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v0alpha1.json index 4497423cc53..50b2b4e9038 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v0alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v0alpha1.json @@ -222,6 +222,7 @@ } }, "datasource": { + "type": "grafana-testdata-datasource", "uid": "gdev-testdata" }, "refId": "A", @@ -525,6 +526,7 @@ } }, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "refId": "A", @@ -639,6 +641,7 @@ } }, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "refId": "A", @@ -653,6 +656,7 @@ "spec": {} }, "datasource": { + "type": "grafana-testdata-datasource", "uid": "gdev-testdata" }, "refId": "B", @@ -957,13 +961,14 @@ "spec": { "name": "variable-ds-prometheus", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", "skipUrlSync": false, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "query": { @@ -985,8 +990,8 @@ "spec": { "name": "variable-no-ds", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", @@ -1011,8 +1016,8 @@ "spec": { "name": "variable-no-ds-empty-query", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", @@ -1034,8 +1039,8 @@ "spec": { "name": "variable-no-default-ds", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", @@ -1056,7 +1061,12 @@ } ] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v1beta1.json index 11151fc1345..7c01f35fc6c 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v1beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v1beta1.json @@ -222,6 +222,7 @@ } }, "datasource": { + "type": "grafana-testdata-datasource", "uid": "gdev-testdata" }, "refId": "A", @@ -525,6 +526,7 @@ } }, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "refId": "A", @@ -639,6 +641,7 @@ } }, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "refId": "A", @@ -653,6 +656,7 @@ "spec": {} }, "datasource": { + "type": "grafana-testdata-datasource", "uid": "gdev-testdata" }, "refId": "B", @@ -957,13 +961,14 @@ "spec": { "name": "variable-ds-prometheus", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", "skipUrlSync": false, "datasource": { + "type": "prometheus", "uid": "gdev-prometheus" }, "query": { @@ -985,8 +990,8 @@ "spec": { "name": "variable-no-ds", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", @@ -1011,8 +1016,8 @@ "spec": { "name": "variable-no-ds-empty-query", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", @@ -1034,8 +1039,8 @@ "spec": { "name": "variable-no-default-ds", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", @@ -1056,7 +1061,12 @@ } ] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v2beta1.json index 7e8f0151ebb..09e35c64258 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.ds-data-query.v2beta1.json @@ -58,7 +58,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "lines": 10, @@ -103,7 +103,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "expr": "{action=\"add_client\"}", @@ -213,7 +213,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "grafana-testdata-datasource", "version": "v0", "datasource": { "name": "gdev-testdata" @@ -324,7 +324,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "grafana-testdata-datasource", "version": "v0", "spec": { "scenarioId": "random_walk", @@ -403,7 +403,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "disableTextWrap": false, @@ -518,7 +518,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "datasource": { "name": "gdev-prometheus" @@ -636,7 +636,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "datasource": { "name": "gdev-prometheus" @@ -661,7 +661,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "grafana-testdata-datasource", "version": "v0", "datasource": { "name": "gdev-testdata" @@ -769,7 +769,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "disableTextWrap": false, @@ -791,7 +791,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "grafana-testdata-datasource", "version": "v0", "spec": {} }, @@ -976,15 +976,15 @@ "spec": { "name": "variable-ds-prometheus", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "datasource": { "name": "gdev-prometheus" @@ -1006,15 +1006,15 @@ "spec": { "name": "variable-no-ds", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "grafana-testdata-datasource", "version": "v0", "spec": { "csv": "1,2,3,4", @@ -1034,15 +1034,15 @@ "spec": { "name": "variable-no-ds-empty-query", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "grafana-testdata-datasource", "version": "v0", "spec": {} }, @@ -1059,15 +1059,15 @@ "spec": { "name": "variable-no-default-ds", "current": { - "text": null, - "value": null + "text": "", + "value": "" }, "hide": "dontHide", "refresh": "", "skipUrlSync": false, "query": { "kind": "DataQuery", - "group": "", + "group": "prometheus", "version": "v0", "spec": { "expr": "up" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v0alpha1.json index ae50ed46c5d..d03d476b881 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v0alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v0alpha1.json @@ -17,11 +17,11 @@ "name": "test-v2alpha1-groupby-adhoc-vars" }, "spec": { - "annotations": null, + "annotations": [], "cursorSync": "", - "elements": null, + "elements": {}, "layout": null, - "links": null, + "links": [], "preload": false, "tags": null, "timeSettings": { @@ -101,7 +101,12 @@ } ] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v1beta1.json index 4f7ce909299..3913d2e898e 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v1beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.groupby-adhoc-vars.v1beta1.json @@ -17,11 +17,11 @@ "name": "test-v2alpha1-groupby-adhoc-vars" }, "spec": { - "annotations": null, + "annotations": [], "cursorSync": "", - "elements": null, + "elements": {}, "layout": null, - "links": null, + "links": [], "preload": false, "tags": null, "timeSettings": { @@ -101,7 +101,12 @@ } ] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v0alpha1.json index acde79a0bcc..a79eaa1528c 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v0alpha1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v0alpha1.json @@ -17,7 +17,7 @@ "name": "test-v2alpha1-viz-config" }, "spec": { - "annotations": null, + "annotations": [], "cursorSync": "", "elements": { "panel-1": { @@ -42,6 +42,7 @@ } }, "datasource": { + "type": "grafana-testdata-datasource", "uid": "gdev-testdata" }, "refId": "A", @@ -218,9 +219,14 @@ "fiscalYearStartMonth": 0 }, "title": "Test: V2alpha1 dashboard with viz config", - "variables": null + "variables": [] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v1beta1.json index e0812fa1a2b..3dbb07b2c65 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v1beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v1beta1.json @@ -17,7 +17,7 @@ "name": "test-v2alpha1-viz-config" }, "spec": { - "annotations": null, + "annotations": [], "cursorSync": "", "elements": { "panel-1": { @@ -42,6 +42,7 @@ } }, "datasource": { + "type": "grafana-testdata-datasource", "uid": "gdev-testdata" }, "refId": "A", @@ -218,9 +219,14 @@ "fiscalYearStartMonth": 0 }, "title": "Test: V2alpha1 dashboard with viz config", - "variables": null + "variables": [] }, - "status": {} + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } } } } diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v2beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v2beta1.json index ae0dc06ab00..a7f48d67563 100644 --- a/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v2beta1.json +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2alpha1.viz-config.v2beta1.json @@ -24,7 +24,7 @@ "spec": { "query": { "kind": "DataQuery", - "group": "", + "group": "grafana-testdata-datasource", "version": "v0", "datasource": { "name": "gdev-testdata" diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v0alpha1.json new file mode 100644 index 00000000000..0ca24342ca3 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v0alpha1.json @@ -0,0 +1,530 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v0alpha1", + "metadata": { + "name": "test-v2alpha1-complete", + "labels": { + "category": "test" + }, + "annotations": { + "description": "Complete example of v2alpha1 dashboard features" + } + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-complete", + "labels": { + "category": "test" + }, + "annotations": { + "description": "Complete example of v2alpha1 dashboard features" + } + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana", + "version": "v0", + "datasource": { + "name": "-- Grafana --" + }, + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "changes(process_start_time_seconds[1m])", + "refId": "Anno" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "Prometheus Annotations", + "builtIn": false + } + } + ], + "cursorSync": "Tooltip", + "description": "This dashboard demonstrates all features that need to be converted from v2alpha1 to v2beta1", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Panel with Conditional Rendering", + "description": "This panel demonstrates conditional rendering features", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up{job=\"grafana\"}" + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [ + { + "kind": "reduce", + "spec": { + "id": "reduce", + "options": { + "includeTimeField": false, + "mode": "reduceFields", + "reducers": [ + "mean" + ] + } + } + } + ], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "12.1.0-pre", + "spec": { + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "textMode": "auto" + }, + "fieldConfig": { + "defaults": { + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "Down", + "color": "red" + }, + "1": { + "text": "Up", + "color": "green" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "red" + }, + { + "value": 1, + "color": "green" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "RowsLayout", + "spec": { + "rows": [ + { + "kind": "Row", + "spec": { + "title": "Conditional Row", + "collapse": false, + "hideHeader": false, + "fillScreen": false, + "conditionalRendering": { + "kind": "ConditionalRenderingGroup", + "spec": { + "visibility": "show", + "condition": "and", + "items": [ + { + "kind": "ConditionalRenderingVariable", + "spec": { + "variable": "group_by", + "operator": "includes", + "value": "instance" + } + }, + { + "kind": "ConditionalRenderingData", + "spec": { + "value": true + } + }, + { + "kind": "ConditionalRenderingTimeRangeSize", + "spec": { + "value": "1h" + } + } + ] + } + }, + "layout": { + "kind": "GridLayout", + "spec": { + "items": [ + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 0, + "width": 24, + "height": 8, + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + } + ] + } + } + } + } + ] + } + }, + "links": [], + "liveNow": true, + "preload": true, + "tags": [ + "test", + "example", + "migration" + ], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "10s", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "weekStart": "monday", + "fiscalYearStartMonth": 0 + }, + "title": "Test: Complete V2alpha1 Dashboard Example", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "prometheus_query", + "current": { + "text": "All", + "value": [ + "$__all" + ] + }, + "label": "Prometheus Query", + "hide": "dontHide", + "refresh": "time", + "skipUrlSync": false, + "description": "Shows all up metrics", + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "alphabetical", + "definition": "up", + "options": null, + "multi": true, + "includeAll": true, + "allowCustomValue": false + } + }, + { + "kind": "TextVariable", + "spec": { + "name": "text_var", + "current": { + "selected": true, + "text": "server1", + "value": "server1" + }, + "query": "server1,server2,server3", + "label": "Text Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A simple text variable" + } + }, + { + "kind": "ConstantVariable", + "spec": { + "name": "constant_var", + "query": "production", + "current": { + "selected": true, + "text": "production", + "value": "production" + }, + "label": "Constant", + "hide": "dontHide", + "skipUrlSync": true, + "description": "A constant value" + } + }, + { + "kind": "DatasourceVariable", + "spec": { + "name": "ds_var", + "pluginId": "prometheus", + "refresh": "load", + "regex": "/^gdev-/", + "current": { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + }, + "options": [ + { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + } + ], + "multi": false, + "includeAll": false, + "label": "Datasource", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Select a datasource", + "allowCustomValue": false + } + }, + { + "kind": "IntervalVariable", + "spec": { + "name": "interval", + "query": "1m,5m,10m,30m,1h,6h,12h,1d", + "current": { + "selected": true, + "text": "5m", + "value": "5m" + }, + "options": [ + { + "text": "1m", + "value": "1m" + }, + { + "text": "5m", + "value": "5m" + }, + { + "text": "10m", + "value": "10m" + }, + { + "text": "30m", + "value": "30m" + }, + { + "text": "1h", + "value": "1h" + }, + { + "text": "6h", + "value": "6h" + }, + { + "text": "12h", + "value": "12h" + }, + { + "text": "1d", + "value": "1d" + } + ], + "auto": true, + "auto_min": "10s", + "auto_count": 30, + "refresh": "onTimeRangeChanged", + "label": "Interval", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Time interval selection" + } + }, + { + "kind": "CustomVariable", + "spec": { + "name": "custom_var", + "query": "prod : Production, staging : Staging, dev : Development", + "current": { + "text": [ + "Production" + ], + "value": [ + "prod" + ] + }, + "options": [ + { + "text": "Production", + "value": "prod" + }, + { + "text": "Staging", + "value": "staging" + }, + { + "text": "Development", + "value": "dev" + } + ], + "multi": true, + "includeAll": true, + "allValue": "*", + "label": "Custom Options", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Custom multi-value variable", + "allowCustomValue": true + } + }, + { + "kind": "GroupByVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "group_by", + "current": { + "text": "instance", + "value": "instance" + }, + "options": null, + "multi": false, + "label": "Group By", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Group metrics by label" + } + }, + { + "kind": "AdhocVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "filters", + "baseFilters": [ + { + "key": "job", + "operator": "=", + "value": "grafana", + "condition": "AND" + } + ], + "filters": [], + "defaultKeys": [ + { + "text": "job", + "value": "job", + "expandable": true + }, + { + "text": "instance", + "value": "instance", + "expandable": true + } + ], + "label": "Filters", + "hide": "dontHide", + "skipUrlSync": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v1beta1.json new file mode 100644 index 00000000000..1bed1975d2a --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v1beta1.json @@ -0,0 +1,530 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v1beta1", + "metadata": { + "name": "test-v2alpha1-complete", + "labels": { + "category": "test" + }, + "annotations": { + "description": "Complete example of v2alpha1 dashboard features" + } + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-complete", + "labels": { + "category": "test" + }, + "annotations": { + "description": "Complete example of v2alpha1 dashboard features" + } + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana", + "version": "v0", + "datasource": { + "name": "-- Grafana --" + }, + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "changes(process_start_time_seconds[1m])", + "refId": "Anno" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "Prometheus Annotations", + "builtIn": false + } + } + ], + "cursorSync": "Tooltip", + "description": "This dashboard demonstrates all features that need to be converted from v2alpha1 to v2beta1", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Panel with Conditional Rendering", + "description": "This panel demonstrates conditional rendering features", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up{job=\"grafana\"}" + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [ + { + "kind": "reduce", + "spec": { + "id": "reduce", + "options": { + "includeTimeField": false, + "mode": "reduceFields", + "reducers": [ + "mean" + ] + } + } + } + ], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "12.1.0-pre", + "spec": { + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "textMode": "auto" + }, + "fieldConfig": { + "defaults": { + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "Down", + "color": "red" + }, + "1": { + "text": "Up", + "color": "green" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "red" + }, + { + "value": 1, + "color": "green" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "RowsLayout", + "spec": { + "rows": [ + { + "kind": "Row", + "spec": { + "title": "Conditional Row", + "collapse": false, + "hideHeader": false, + "fillScreen": false, + "conditionalRendering": { + "kind": "ConditionalRenderingGroup", + "spec": { + "visibility": "show", + "condition": "and", + "items": [ + { + "kind": "ConditionalRenderingVariable", + "spec": { + "variable": "group_by", + "operator": "includes", + "value": "instance" + } + }, + { + "kind": "ConditionalRenderingData", + "spec": { + "value": true + } + }, + { + "kind": "ConditionalRenderingTimeRangeSize", + "spec": { + "value": "1h" + } + } + ] + } + }, + "layout": { + "kind": "GridLayout", + "spec": { + "items": [ + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 0, + "width": 24, + "height": 8, + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + } + ] + } + } + } + } + ] + } + }, + "links": [], + "liveNow": true, + "preload": true, + "tags": [ + "test", + "example", + "migration" + ], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "10s", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "weekStart": "monday", + "fiscalYearStartMonth": 0 + }, + "title": "Test: Complete V2alpha1 Dashboard Example", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "prometheus_query", + "current": { + "text": "All", + "value": [ + "$__all" + ] + }, + "label": "Prometheus Query", + "hide": "dontHide", + "refresh": "time", + "skipUrlSync": false, + "description": "Shows all up metrics", + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "alphabetical", + "definition": "up", + "options": null, + "multi": true, + "includeAll": true, + "allowCustomValue": false + } + }, + { + "kind": "TextVariable", + "spec": { + "name": "text_var", + "current": { + "selected": true, + "text": "server1", + "value": "server1" + }, + "query": "server1,server2,server3", + "label": "Text Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A simple text variable" + } + }, + { + "kind": "ConstantVariable", + "spec": { + "name": "constant_var", + "query": "production", + "current": { + "selected": true, + "text": "production", + "value": "production" + }, + "label": "Constant", + "hide": "dontHide", + "skipUrlSync": true, + "description": "A constant value" + } + }, + { + "kind": "DatasourceVariable", + "spec": { + "name": "ds_var", + "pluginId": "prometheus", + "refresh": "load", + "regex": "/^gdev-/", + "current": { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + }, + "options": [ + { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + } + ], + "multi": false, + "includeAll": false, + "label": "Datasource", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Select a datasource", + "allowCustomValue": false + } + }, + { + "kind": "IntervalVariable", + "spec": { + "name": "interval", + "query": "1m,5m,10m,30m,1h,6h,12h,1d", + "current": { + "selected": true, + "text": "5m", + "value": "5m" + }, + "options": [ + { + "text": "1m", + "value": "1m" + }, + { + "text": "5m", + "value": "5m" + }, + { + "text": "10m", + "value": "10m" + }, + { + "text": "30m", + "value": "30m" + }, + { + "text": "1h", + "value": "1h" + }, + { + "text": "6h", + "value": "6h" + }, + { + "text": "12h", + "value": "12h" + }, + { + "text": "1d", + "value": "1d" + } + ], + "auto": true, + "auto_min": "10s", + "auto_count": 30, + "refresh": "onTimeRangeChanged", + "label": "Interval", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Time interval selection" + } + }, + { + "kind": "CustomVariable", + "spec": { + "name": "custom_var", + "query": "prod : Production, staging : Staging, dev : Development", + "current": { + "text": [ + "Production" + ], + "value": [ + "prod" + ] + }, + "options": [ + { + "text": "Production", + "value": "prod" + }, + { + "text": "Staging", + "value": "staging" + }, + { + "text": "Development", + "value": "dev" + } + ], + "multi": true, + "includeAll": true, + "allValue": "*", + "label": "Custom Options", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Custom multi-value variable", + "allowCustomValue": true + } + }, + { + "kind": "GroupByVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "group_by", + "current": { + "text": "instance", + "value": "instance" + }, + "options": null, + "multi": false, + "label": "Group By", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Group metrics by label" + } + }, + { + "kind": "AdhocVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "filters", + "baseFilters": [ + { + "key": "job", + "operator": "=", + "value": "grafana", + "condition": "AND" + } + ], + "filters": [], + "defaultKeys": [ + { + "text": "job", + "value": "job", + "expandable": true + }, + { + "text": "instance", + "value": "instance", + "expandable": true + } + ], + "label": "Filters", + "hide": "dontHide", + "skipUrlSync": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v2alpha1.json new file mode 100644 index 00000000000..5091df59fcf --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.complete.v2alpha1.json @@ -0,0 +1,504 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", + "metadata": { + "name": "test-v2alpha1-complete", + "labels": { + "category": "test" + }, + "annotations": { + "description": "Complete example of v2alpha1 dashboard features" + } + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "query": { + "kind": "grafana", + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "query": { + "kind": "prometheus", + "spec": { + "expr": "changes(process_start_time_seconds[1m])", + "refId": "Anno" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "Prometheus Annotations", + "builtIn": false + } + } + ], + "cursorSync": "Tooltip", + "description": "This dashboard demonstrates all features that need to be converted from v2alpha1 to v2beta1", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Panel with Conditional Rendering", + "description": "This panel demonstrates conditional rendering features", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "prometheus", + "spec": { + "expr": "up{job=\"grafana\"}" + } + }, + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [ + { + "kind": "reduce", + "spec": { + "id": "reduce", + "options": { + "includeTimeField": false, + "mode": "reduceFields", + "reducers": [ + "mean" + ] + } + } + } + ], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "stat", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "textMode": "auto" + }, + "fieldConfig": { + "defaults": { + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "Down", + "color": "red" + }, + "1": { + "text": "Up", + "color": "green" + } + } + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "red" + }, + { + "value": 1, + "color": "green" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "RowsLayout", + "spec": { + "rows": [ + { + "kind": "Row", + "spec": { + "title": "Conditional Row", + "collapse": false, + "hideHeader": false, + "fillScreen": false, + "conditionalRendering": { + "kind": "ConditionalRenderingGroup", + "spec": { + "visibility": "show", + "condition": "and", + "items": [ + { + "kind": "ConditionalRenderingVariable", + "spec": { + "variable": "group_by", + "operator": "includes", + "value": "instance" + } + }, + { + "kind": "ConditionalRenderingData", + "spec": { + "value": true + } + }, + { + "kind": "ConditionalRenderingTimeRangeSize", + "spec": { + "value": "1h" + } + } + ] + } + }, + "layout": { + "kind": "GridLayout", + "spec": { + "items": [ + { + "kind": "GridLayoutItem", + "spec": { + "x": 0, + "y": 0, + "width": 24, + "height": 8, + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + } + ] + } + } + } + } + ] + } + }, + "links": [], + "liveNow": true, + "preload": true, + "tags": [ + "test", + "example", + "migration" + ], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "10s", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "weekStart": "monday", + "fiscalYearStartMonth": 0 + }, + "title": "Test: Complete V2alpha1 Dashboard Example", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "prometheus_query", + "current": { + "text": "All", + "value": [ + "$__all" + ] + }, + "label": "Prometheus Query", + "hide": "dontHide", + "refresh": "time", + "skipUrlSync": false, + "description": "Shows all up metrics", + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "query": { + "kind": "prometheus", + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "alphabetical", + "definition": "up", + "options": null, + "multi": true, + "includeAll": true, + "allowCustomValue": false + } + }, + { + "kind": "TextVariable", + "spec": { + "name": "text_var", + "current": { + "selected": true, + "text": "server1", + "value": "server1" + }, + "query": "server1,server2,server3", + "label": "Text Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A simple text variable" + } + }, + { + "kind": "ConstantVariable", + "spec": { + "name": "constant_var", + "query": "production", + "current": { + "selected": true, + "text": "production", + "value": "production" + }, + "label": "Constant", + "hide": "dontHide", + "skipUrlSync": true, + "description": "A constant value" + } + }, + { + "kind": "DatasourceVariable", + "spec": { + "name": "ds_var", + "pluginId": "prometheus", + "refresh": "load", + "regex": "/^gdev-/", + "current": { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + }, + "options": [ + { + "text": "gdev-prometheus", + "value": "gdev-prometheus" + } + ], + "multi": false, + "includeAll": false, + "label": "Datasource", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Select a datasource", + "allowCustomValue": false + } + }, + { + "kind": "IntervalVariable", + "spec": { + "name": "interval", + "query": "1m,5m,10m,30m,1h,6h,12h,1d", + "current": { + "selected": true, + "text": "5m", + "value": "5m" + }, + "options": [ + { + "text": "1m", + "value": "1m" + }, + { + "text": "5m", + "value": "5m" + }, + { + "text": "10m", + "value": "10m" + }, + { + "text": "30m", + "value": "30m" + }, + { + "text": "1h", + "value": "1h" + }, + { + "text": "6h", + "value": "6h" + }, + { + "text": "12h", + "value": "12h" + }, + { + "text": "1d", + "value": "1d" + } + ], + "auto": true, + "auto_min": "10s", + "auto_count": 30, + "refresh": "load", + "label": "Interval", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Time interval selection" + } + }, + { + "kind": "CustomVariable", + "spec": { + "name": "custom_var", + "query": "prod : Production, staging : Staging, dev : Development", + "current": { + "text": [ + "Production" + ], + "value": [ + "prod" + ] + }, + "options": [ + { + "text": "Production", + "value": "prod" + }, + { + "text": "Staging", + "value": "staging" + }, + { + "text": "Development", + "value": "dev" + } + ], + "multi": true, + "includeAll": true, + "allValue": "*", + "label": "Custom Options", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Custom multi-value variable", + "allowCustomValue": true + } + }, + { + "kind": "GroupByVariable", + "spec": { + "name": "group_by", + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "current": { + "text": "instance", + "value": "instance" + }, + "options": null, + "multi": false, + "label": "Group By", + "hide": "dontHide", + "skipUrlSync": false, + "description": "Group metrics by label" + } + }, + { + "kind": "AdhocVariable", + "spec": { + "name": "filters", + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "baseFilters": [ + { + "key": "job", + "operator": "=", + "value": "grafana", + "condition": "AND" + } + ], + "filters": [], + "defaultKeys": [ + { + "text": "job", + "value": "job", + "expandable": true + }, + { + "text": "instance", + "value": "instance", + "expandable": true + } + ], + "label": "Filters", + "hide": "dontHide", + "skipUrlSync": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v0alpha1.json new file mode 100644 index 00000000000..843139d96cd --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v0alpha1.json @@ -0,0 +1,1107 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v0alpha1", + "metadata": { + "name": "test-v2alpha1-annotations" + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-annotations" + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana", + "version": "v0", + "datasource": { + "name": "-- Grafana --" + }, + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "PD8C576611E62080A" + }, + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "no-ds-testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "no-ds-prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "PBBCEC2D313BC06C3" + }, + "spec": { + "editorMode": "builder", + "format": "table", + "lines": 10, + "rawSql": "", + "refId": "Anno", + "scenarioId": "annotations", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "postgress-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "elasticsearch", + "version": "v0", + "datasource": { + "name": "gdev-elasticsearch" + }, + "spec": { + "lines": 10, + "query": "test query", + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "elastic - annos", + "builtIn": false, + "legacyOptions": { + "tagsField": "asd", + "textField": "asd", + "timeEndField": "asdas", + "timeField": "asd" + } + } + } + ], + "cursorSync": "Off", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-2": { + "kind": "Panel", + "spec": { + "id": 2, + "title": "Simple stat (NO DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": { + "scenarioId": "random_walk", + "seriesCount": 4 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "12.1.0-pre", + "spec": { + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + }, + "panel-3": { + "kind": "Panel", + "spec": { + "id": 3, + "title": "Panel with NO REF to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-4": { + "kind": "Panel", + "spec": { + "id": 4, + "title": "Panel with ref to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-5": { + "kind": "Panel", + "spec": { + "id": 5, + "title": "Mixed DS WITH REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": {} + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-6": { + "kind": "Panel", + "spec": { + "id": 6, + "title": "Mixed DS WITHOUT REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": {} + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with annotations", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "variable-ds-prometheus", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": { + "csv": "1,2,3,4", + "scenarioId": "csv_metric_values" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds-empty-query", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": {} + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-default-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v1beta1.json new file mode 100644 index 00000000000..7e08757d7a4 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v1beta1.json @@ -0,0 +1,1107 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v1beta1", + "metadata": { + "name": "test-v2alpha1-annotations" + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-annotations" + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana", + "version": "v0", + "datasource": { + "name": "-- Grafana --" + }, + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "PD8C576611E62080A" + }, + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "no-ds-testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "no-ds-prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-postgresql-datasource", + "version": "v0", + "datasource": { + "name": "PBBCEC2D313BC06C3" + }, + "spec": { + "editorMode": "builder", + "format": "table", + "lines": 10, + "rawSql": "", + "refId": "Anno", + "scenarioId": "annotations", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "postgress-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "elasticsearch", + "version": "v0", + "datasource": { + "name": "gdev-elasticsearch" + }, + "spec": { + "lines": 10, + "query": "test query", + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "elastic - annos", + "builtIn": false, + "legacyOptions": { + "tagsField": "asd", + "textField": "asd", + "timeEndField": "asdas", + "timeField": "asd" + } + } + } + ], + "cursorSync": "Off", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-2": { + "kind": "Panel", + "spec": { + "id": 2, + "title": "Simple stat (NO DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": { + "scenarioId": "random_walk", + "seriesCount": 4 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "stat", + "version": "12.1.0-pre", + "spec": { + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + }, + "panel-3": { + "kind": "Panel", + "spec": { + "id": 3, + "title": "Panel with NO REF to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-4": { + "kind": "Panel", + "spec": { + "id": 4, + "title": "Panel with ref to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-5": { + "kind": "Panel", + "spec": { + "id": 5, + "title": "Mixed DS WITH REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": {} + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-6": { + "kind": "Panel", + "spec": { + "id": 6, + "title": "Mixed DS WITHOUT REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": {} + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with annotations", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "variable-ds-prometheus", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": { + "csv": "1,2,3,4", + "scenarioId": "csv_metric_values" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds-empty-query", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "spec": {} + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-default-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "DataQuery", + "group": "prometheus", + "version": "v0", + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v2alpha1.json new file mode 100644 index 00000000000..e4496d650f4 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.ds-data-query.v2alpha1.json @@ -0,0 +1,1058 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", + "metadata": { + "name": "test-v2alpha1-annotations" + }, + "spec": { + "annotations": [ + { + "kind": "AnnotationQuery", + "spec": { + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "query": { + "kind": "grafana", + "spec": { + "limit": 100, + "matchAny": false, + "tags": [], + "type": "dashboard" + } + }, + "enable": true, + "hide": false, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "builtIn": true + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "query": { + "kind": "grafana-testdata-datasource", + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "prometheus", + "spec": { + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "blue", + "name": "no-ds-testdata-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "query": { + "kind": "prometheus", + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "query": { + "kind": "prometheus", + "spec": { + "expr": "{action=\"add_client\"}", + "interval": "", + "lines": 10, + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "yellow", + "name": "no-ds-prom-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "datasource": { + "type": "grafana-postgresql-datasource", + "uid": "PBBCEC2D313BC06C3" + }, + "query": { + "kind": "grafana-postgresql-datasource", + "spec": { + "editorMode": "builder", + "format": "table", + "lines": 10, + "rawSql": "", + "refId": "Anno", + "scenarioId": "annotations", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "postgress-annos", + "builtIn": false + } + }, + { + "kind": "AnnotationQuery", + "spec": { + "datasource": { + "type": "elasticsearch", + "uid": "gdev-elasticsearch" + }, + "query": { + "kind": "elasticsearch", + "spec": { + "lines": 10, + "query": "test query", + "refId": "Anno", + "scenarioId": "annotations" + } + }, + "enable": true, + "hide": false, + "iconColor": "red", + "name": "elastic - annos", + "builtIn": false, + "legacyOptions": { + "tagsField": "asd", + "textField": "asd", + "timeEndField": "asdas", + "timeField": "asd" + } + } + } + ], + "cursorSync": "Off", + "editable": true, + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "grafana-testdata-datasource", + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "gdev-testdata" + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "timeseries", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-2": { + "kind": "Panel", + "spec": { + "id": 2, + "title": "Simple stat (NO DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "grafana-testdata-datasource", + "spec": { + "scenarioId": "random_walk", + "seriesCount": 4 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "stat", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "thresholds" + } + }, + "overrides": [] + } + } + } + } + }, + "panel-3": { + "kind": "Panel", + "spec": { + "id": 3, + "title": "Panel with NO REF to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "prometheus", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "timeseries", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-4": { + "kind": "Panel", + "spec": { + "id": 4, + "title": "Panel with ref to gdev-prometheus", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "prometheus", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "instant": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "timeseries", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-5": { + "kind": "Panel", + "spec": { + "id": 5, + "title": "Mixed DS WITH REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "prometheus", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "grafana-testdata-datasource", + "spec": {} + }, + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "gdev-testdata" + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "timeseries", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + }, + "panel-6": { + "kind": "Panel", + "spec": { + "id": 6, + "title": "Mixed DS WITHOUT REFS", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "prometheus", + "spec": { + "disableTextWrap": false, + "editorMode": "builder", + "expr": "rate(counters_requests{server=\"backend-01\"}[$__rate_interval])", + "fullMetaSearch": false, + "includeNullMetadata": false, + "legendFormat": "__auto", + "range": true, + "useBackend": false + } + }, + "refId": "A", + "hidden": false + } + }, + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "grafana-testdata-datasource", + "spec": {} + }, + "refId": "B", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "timeseries", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with annotations", + "variables": [ + { + "kind": "QueryVariable", + "spec": { + "name": "variable-ds-prometheus", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "query": { + "kind": "prometheus", + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "grafana-testdata-datasource", + "spec": { + "csv": "1,2,3,4", + "scenarioId": "csv_metric_values" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-ds-empty-query", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "grafana-testdata-datasource", + "spec": {} + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + }, + { + "kind": "QueryVariable", + "spec": { + "name": "variable-no-default-ds", + "current": { + "text": "", + "value": "" + }, + "hide": "dontHide", + "refresh": "", + "skipUrlSync": false, + "query": { + "kind": "prometheus", + "spec": { + "expr": "up" + } + }, + "regex": "", + "sort": "", + "options": null, + "multi": false, + "includeAll": false, + "allowCustomValue": false + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v0alpha1.json new file mode 100644 index 00000000000..fc314270471 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v0alpha1.json @@ -0,0 +1,113 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v0alpha1", + "metadata": { + "name": "test-v2alpha1-groupby-adhoc-vars" + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-groupby-adhoc-vars" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": {}, + "layout": null, + "links": [], + "preload": false, + "tags": null, + "timeSettings": { + "from": "", + "to": "", + "autoRefresh": "", + "autoRefreshIntervals": null, + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with group by and adhoc variables", + "variables": [ + { + "kind": "GroupByVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "", + "current": { + "text": "text7", + "value": "value7" + }, + "options": null, + "multi": false, + "label": "Group By Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A group by variable" + } + }, + { + "kind": "AdhocVariable", + "group": "prometheus", + "datasource": { + "name": "datasource-3" + }, + "spec": { + "name": "adhocVar", + "baseFilters": [ + { + "key": "key1", + "operator": "=", + "value": "value1", + "condition": "AND" + }, + { + "key": "key2", + "operator": "=", + "value": "value2", + "condition": "OR" + } + ], + "filters": [ + { + "key": "key3", + "operator": "=", + "value": "value3", + "condition": "AND" + } + ], + "defaultKeys": [ + { + "text": "defaultKey1", + "value": "defaultKey1", + "group": "defaultGroup1", + "expandable": true + } + ], + "label": "Adhoc Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "An adhoc variable", + "allowCustomValue": true + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v1beta1.json new file mode 100644 index 00000000000..7925848b4da --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v1beta1.json @@ -0,0 +1,113 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v1beta1", + "metadata": { + "name": "test-v2alpha1-groupby-adhoc-vars" + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-groupby-adhoc-vars" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": {}, + "layout": null, + "links": [], + "preload": false, + "tags": null, + "timeSettings": { + "from": "", + "to": "", + "autoRefresh": "", + "autoRefreshIntervals": null, + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with group by and adhoc variables", + "variables": [ + { + "kind": "GroupByVariable", + "group": "prometheus", + "datasource": { + "name": "gdev-prometheus" + }, + "spec": { + "name": "", + "current": { + "text": "text7", + "value": "value7" + }, + "options": null, + "multi": false, + "label": "Group By Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A group by variable" + } + }, + { + "kind": "AdhocVariable", + "group": "prometheus", + "datasource": { + "name": "datasource-3" + }, + "spec": { + "name": "adhocVar", + "baseFilters": [ + { + "key": "key1", + "operator": "=", + "value": "value1", + "condition": "AND" + }, + { + "key": "key2", + "operator": "=", + "value": "value2", + "condition": "OR" + } + ], + "filters": [ + { + "key": "key3", + "operator": "=", + "value": "value3", + "condition": "AND" + } + ], + "defaultKeys": [ + { + "text": "defaultKey1", + "value": "defaultKey1", + "group": "defaultGroup1", + "expandable": true + } + ], + "label": "Adhoc Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "An adhoc variable", + "allowCustomValue": true + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v2alpha1.json new file mode 100644 index 00000000000..5cb430e9655 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.groupby-adhoc-vars.v2alpha1.json @@ -0,0 +1,98 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", + "metadata": { + "name": "test-v2alpha1-groupby-adhoc-vars" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": {}, + "layout": null, + "links": [], + "preload": false, + "tags": null, + "timeSettings": { + "from": "", + "to": "", + "autoRefresh": "", + "autoRefreshIntervals": null, + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with group by and adhoc variables", + "variables": [ + { + "kind": "GroupByVariable", + "spec": { + "name": "", + "datasource": { + "type": "prometheus", + "uid": "gdev-prometheus" + }, + "current": { + "text": "text7", + "value": "value7" + }, + "options": null, + "multi": false, + "label": "Group By Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "A group by variable" + } + }, + { + "kind": "AdhocVariable", + "spec": { + "name": "adhocVar", + "datasource": { + "type": "prometheus", + "uid": "datasource-3" + }, + "baseFilters": [ + { + "key": "key1", + "operator": "=", + "value": "value1", + "condition": "AND" + }, + { + "key": "key2", + "operator": "=", + "value": "value2", + "condition": "OR" + } + ], + "filters": [ + { + "key": "key3", + "operator": "=", + "value": "value3", + "condition": "AND" + } + ], + "defaultKeys": [ + { + "text": "defaultKey1", + "value": "defaultKey1", + "group": "defaultGroup1", + "expandable": true + } + ], + "label": "Adhoc Variable", + "hide": "dontHide", + "skipUrlSync": false, + "description": "An adhoc variable", + "allowCustomValue": true + } + } + ] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v0alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v0alpha1.json new file mode 100644 index 00000000000..c792c0537aa --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v0alpha1.json @@ -0,0 +1,235 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v0alpha1", + "metadata": { + "name": "test-v2alpha1-viz-config" + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-viz-config" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with viz config", + "variables": [] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v1beta1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v1beta1.json new file mode 100644 index 00000000000..94df0c2e468 --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v1beta1.json @@ -0,0 +1,235 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v1beta1", + "metadata": { + "name": "test-v2alpha1-viz-config" + }, + "spec": null, + "status": { + "conversion": { + "failed": true, + "error": "backend conversion not yet implemented", + "storedVersion": "v2beta1", + "source": { + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2beta1", + "metadata": { + "name": "test-v2alpha1-viz-config" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "DataQuery", + "group": "grafana-testdata-datasource", + "version": "v0", + "datasource": { + "name": "gdev-testdata" + }, + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "VizConfig", + "group": "timeseries", + "version": "12.1.0-pre", + "spec": { + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with viz config", + "variables": [] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2alpha1" + } + } + } + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v2alpha1.json b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v2alpha1.json new file mode 100644 index 00000000000..48c2aab46af --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/testdata/output/v2beta1.viz-config.v2alpha1.json @@ -0,0 +1,218 @@ +{ + "kind": "Dashboard", + "apiVersion": "dashboard.grafana.app/v2alpha1", + "metadata": { + "name": "test-v2alpha1-viz-config" + }, + "spec": { + "annotations": [], + "cursorSync": "", + "elements": { + "panel-1": { + "kind": "Panel", + "spec": { + "id": 1, + "title": "Simple timeseries (WITH DS REF)", + "description": "", + "links": [], + "data": { + "kind": "QueryGroup", + "spec": { + "queries": [ + { + "kind": "PanelQuery", + "spec": { + "query": { + "kind": "grafana-testdata-datasource", + "spec": { + "scenarioId": "random_walk", + "seriesCount": 3 + } + }, + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "gdev-testdata" + }, + "refId": "A", + "hidden": false + } + } + ], + "transformations": [], + "queryOptions": {} + } + }, + "vizConfig": { + "kind": "timeseries", + "spec": { + "pluginVersion": "12.1.0-pre", + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "fieldConfig": { + "defaults": { + "thresholds": { + "mode": "absolute", + "steps": [ + { + "value": 0, + "color": "green" + }, + { + "value": 80, + "color": "red" + } + ] + }, + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + } + }, + "overrides": [] + } + } + } + } + } + }, + "layout": { + "kind": "AutoGridLayout", + "spec": { + "maxColumnCount": 3, + "columnWidthMode": "standard", + "rowHeightMode": "standard", + "items": [ + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-3" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-4" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-2" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-1" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-5" + } + } + }, + { + "kind": "AutoGridLayoutItem", + "spec": { + "element": { + "kind": "ElementReference", + "name": "panel-6" + } + } + } + ] + } + }, + "links": [], + "liveNow": false, + "preload": false, + "tags": [], + "timeSettings": { + "timezone": "browser", + "from": "now-6h", + "to": "now", + "autoRefresh": "", + "autoRefreshIntervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "hideTimepicker": false, + "fiscalYearStartMonth": 0 + }, + "title": "Test: V2alpha1 dashboard with viz config", + "variables": [] + }, + "status": { + "conversion": { + "failed": false, + "storedVersion": "v2beta1" + } + } +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/conversion/v0_test.go b/apps/dashboard/pkg/migration/conversion/v0_test.go index 40f118dc9f2..08bf1c550c9 100644 --- a/apps/dashboard/pkg/migration/conversion/v0_test.go +++ b/apps/dashboard/pkg/migration/conversion/v0_test.go @@ -19,7 +19,8 @@ import ( func TestV0ConversionErrorHandling(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) tests := []struct { name string @@ -130,7 +131,8 @@ func TestV0ConversionErrorHandling(t *testing.T) { func TestV0ConversionErrorPropagation(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) t.Run("ConvertDashboard_V0_to_V1beta1 returns error on migration failure", func(t *testing.T) { source := &dashv0.Dashboard{ @@ -203,7 +205,8 @@ func TestV0ConversionErrorPropagation(t *testing.T) { func TestV0ConversionSuccessPaths(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) t.Run("Convert_V0_to_V1beta1 success path returns nil", func(t *testing.T) { source := &dashv0.Dashboard{ @@ -271,7 +274,8 @@ func TestV0ConversionSuccessPaths(t *testing.T) { func TestV0ConversionSecondStepErrors(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) t.Run("Convert_V0_to_V2alpha1 sets status on first step error", func(t *testing.T) { // Create a dashboard that will fail v0->v1beta1 conversion diff --git a/apps/dashboard/pkg/migration/conversion/v1_test.go b/apps/dashboard/pkg/migration/conversion/v1_test.go index c62d5e60d34..c0a9d2e2e6b 100644 --- a/apps/dashboard/pkg/migration/conversion/v1_test.go +++ b/apps/dashboard/pkg/migration/conversion/v1_test.go @@ -18,7 +18,8 @@ import ( func TestV1ConversionErrorHandling(t *testing.T) { // Initialize the migrator with a test data source provider dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) - migration.Initialize(dsProvider) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) t.Run("Convert_V1beta1_to_V2alpha1 sets status on conversion error", func(t *testing.T) { // Create a dashboard that will cause conversion to fail diff --git a/apps/dashboard/pkg/migration/conversion/v1beta1_to_v2alpha1.go b/apps/dashboard/pkg/migration/conversion/v1beta1_to_v2alpha1.go index 6b8448867f1..21877cb6361 100644 --- a/apps/dashboard/pkg/migration/conversion/v1beta1_to_v2alpha1.go +++ b/apps/dashboard/pkg/migration/conversion/v1beta1_to_v2alpha1.go @@ -1058,8 +1058,11 @@ func buildDataQueryKind(query interface{}, datasourceType string) dashv2alpha1.D querySpec = make(map[string]interface{}) } + // Use datasourceType as the kind (datasource type, e.g., "prometheus", "elasticsearch") + kind := datasourceType + return dashv2alpha1.DashboardDataQueryKind{ - Kind: "DataQuery", + Kind: kind, Spec: querySpec, } } @@ -1082,8 +1085,11 @@ func buildDataQueryKindForVariable(query interface{}, datasourceType string) das querySpec = make(map[string]interface{}) } + // Use datasourceType as the kind (datasource type, e.g., "prometheus", "elasticsearch") + kind := datasourceType + return dashv2alpha1.DashboardDataQueryKind{ - Kind: "DataQuery", + Kind: kind, Spec: querySpec, } } @@ -1629,9 +1635,11 @@ func buildAnnotationQuery(annotationMap map[string]interface{}) (dashv2alpha1.Da // Build the query from target var query *dashv2alpha1.DashboardDataQueryKind + // Use datasourceType as the kind (datasource type, e.g., "prometheus", "grafana") + kind := datasourceType if target, ok := annotationMap["target"].(map[string]interface{}); ok && target != nil { queryKind := dashv2alpha1.DashboardDataQueryKind{ - Kind: "DataQuery", + Kind: kind, Spec: target, } // Group field is not available in v2alpha1 DashboardDataQueryKind @@ -1639,7 +1647,7 @@ func buildAnnotationQuery(annotationMap map[string]interface{}) (dashv2alpha1.Da } else { // Always provide a query to match frontend behavior queryKind := dashv2alpha1.DashboardDataQueryKind{ - Kind: "DataQuery", + Kind: kind, Spec: map[string]interface{}{}, } // Group field is not available in v2alpha1 DashboardDataQueryKind diff --git a/apps/dashboard/pkg/migration/conversion/v2.go b/apps/dashboard/pkg/migration/conversion/v2.go index db1824e725c..3b27c130d50 100644 --- a/apps/dashboard/pkg/migration/conversion/v2.go +++ b/apps/dashboard/pkg/migration/conversion/v2.go @@ -109,14 +109,23 @@ func Convert_V2beta1_to_V1beta1(in *dashv2beta1.Dashboard, out *dashv1.Dashboard func Convert_V2beta1_to_V2alpha1(in *dashv2beta1.Dashboard, out *dashv2alpha1.Dashboard, scope conversion.Scope) error { out.ObjectMeta = in.ObjectMeta - // TODO: implement v2beta1 to V2alpha1 conversion + if err := ConvertDashboard_V2beta1_to_V2alpha1(in, out, scope); err != nil { + out.Status = dashv2alpha1.DashboardStatus{ + Conversion: &dashv2alpha1.DashboardConversionStatus{ + StoredVersion: ptr.To(dashv2beta1.VERSION), + Failed: true, + Error: ptr.To(err.Error()), + Source: in, + }, + } + + return NewConversionError(err.Error(), "v2beta1", "v2alpha1", "ConvertDashboard_V2beta1_to_V2alpha1") + } out.Status = dashv2alpha1.DashboardStatus{ Conversion: &dashv2alpha1.DashboardConversionStatus{ StoredVersion: ptr.To(dashv2beta1.VERSION), - Failed: true, - Error: ptr.To("backend conversion not yet implemented"), - Source: in, + Failed: false, }, } diff --git a/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v2beta1.go b/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v2beta1.go index 9243d246cf0..e5bd1f834d3 100644 --- a/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v2beta1.go +++ b/apps/dashboard/pkg/migration/conversion/v2alpha1_to_v2beta1.go @@ -132,22 +132,28 @@ func convertDataQuery_V2alpha1_to_V2beta1(in *dashv2alpha1.DashboardDataQueryKin out.Kind = "DataQuery" out.Version = "v0" out.Spec = in.Spec - // Don't set group field by default - only set if datasource is present } - // Convert datasource reference and set group from datasource type + // Convert datasource reference and set group + // Priority: 1) datasource.Type, 2) in.Kind (if no datasource or datasource.Type is empty) if datasource != nil { out.Datasource = &dashv2beta1.DashboardV2beta1DataQueryKindDatasource{} if datasource.Uid != nil { out.Datasource.Name = datasource.Uid } - // Set group to datasource type to match frontend behavior - // Only set group if datasource type is not empty (matches frontend logic) + // Set group to datasource type if available if datasource.Type != nil && *datasource.Type != "" { out.Group = *datasource.Type } } + // Fallback: if group is still empty and we have a query with a kind (datasource type), use the kind as group + // This preserves the datasource type information when datasource reference is missing + // Note: in.Kind is the datasource type (e.g., "prometheus", "elasticsearch"), not "DataQuery" + if out.Group == "" && in != nil && in.Kind != "" { + out.Group = in.Kind + } + return nil } @@ -761,11 +767,20 @@ func convertQueryVariableSpec_V2alpha1_to_V2beta1(in *dashv2alpha1.DashboardQuer func convertVariableOption_V2alpha1_to_V2beta1(in dashv2alpha1.DashboardVariableOption) dashv2beta1.DashboardVariableOption { return dashv2beta1.DashboardVariableOption{ Selected: in.Selected, - Text: dashv2beta1.DashboardStringOrArrayOfString(in.Text), - Value: dashv2beta1.DashboardStringOrArrayOfString(in.Value), + Text: convertStringOrArrayOfString_V2alpha1_to_V2beta1(in.Text), + Value: convertStringOrArrayOfString_V2alpha1_to_V2beta1(in.Value), } } +// convertStringOrArrayOfString_V2alpha1_to_V2beta1 preserves empty strings to match unmarshaler behavior +func convertStringOrArrayOfString_V2alpha1_to_V2beta1(in dashv2alpha1.DashboardStringOrArrayOfString) dashv2beta1.DashboardStringOrArrayOfString { + out := dashv2beta1.DashboardStringOrArrayOfString{ + ArrayOfString: in.ArrayOfString, + } + out.String = in.String + return out +} + func convertVariableOptionPtr_V2alpha1_to_V2beta1(in *dashv2alpha1.DashboardVariableOption) *dashv2beta1.DashboardVariableOption { if in == nil { return nil @@ -916,83 +931,37 @@ func convertConditionalRenderingGroupKind_V2alpha1_to_V2beta1(in *dashv2alpha1.D } func convertRowLayout_V2alpha1_to_V2beta1(in *dashv2alpha1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind, out *dashv2beta1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind, scope conversion.Scope) error { - // Handle the different union type orderings by converting through the main layout function - // Create a temporary variable with the correct type ordering - var tempIn dashv2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind - var tempOut dashv2beta1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind - - // Copy the layout data with the correct ordering if in.GridLayoutKind != nil { - tempIn.GridLayoutKind = in.GridLayoutKind - } - if in.RowsLayoutKind != nil { - tempIn.RowsLayoutKind = in.RowsLayoutKind + out.GridLayoutKind = &dashv2beta1.DashboardGridLayoutKind{ + Kind: in.GridLayoutKind.Kind, + } + return convertGridLayoutSpec_V2alpha1_to_V2beta1(&in.GridLayoutKind.Spec, &out.GridLayoutKind.Spec, scope) } + if in.AutoGridLayoutKind != nil { - tempIn.AutoGridLayoutKind = in.AutoGridLayoutKind + out.AutoGridLayoutKind = &dashv2beta1.DashboardAutoGridLayoutKind{ + Kind: in.AutoGridLayoutKind.Kind, + } + return convertAutoGridLayoutSpec_V2alpha1_to_V2beta1(&in.AutoGridLayoutKind.Spec, &out.AutoGridLayoutKind.Spec, scope) } + if in.TabsLayoutKind != nil { - tempIn.TabsLayoutKind = in.TabsLayoutKind + out.TabsLayoutKind = &dashv2beta1.DashboardTabsLayoutKind{ + Kind: in.TabsLayoutKind.Kind, + } + return convertTabsLayoutSpec_V2alpha1_to_V2beta1(&in.TabsLayoutKind.Spec, &out.TabsLayoutKind.Spec, scope) } - if err := convertLayout_V2alpha1_to_V2beta1(&tempIn, &tempOut, scope); err != nil { - return err - } - - // Copy back to the output with the correct ordering - if tempOut.GridLayoutKind != nil { - out.GridLayoutKind = tempOut.GridLayoutKind - } - if tempOut.RowsLayoutKind != nil { - out.RowsLayoutKind = tempOut.RowsLayoutKind - } - if tempOut.AutoGridLayoutKind != nil { - out.AutoGridLayoutKind = tempOut.AutoGridLayoutKind - } - if tempOut.TabsLayoutKind != nil { - out.TabsLayoutKind = tempOut.TabsLayoutKind + if in.RowsLayoutKind != nil { + out.RowsLayoutKind = &dashv2beta1.DashboardRowsLayoutKind{ + Kind: in.RowsLayoutKind.Kind, + } + return convertRowsLayoutSpec_V2alpha1_to_V2beta1(&in.RowsLayoutKind.Spec, &out.RowsLayoutKind.Spec, scope) } return nil } func convertTabLayout_V2alpha1_to_V2beta1(in *dashv2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind, out *dashv2beta1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind, scope conversion.Scope) error { - // Handle the different union type orderings by converting through the main layout function - // Create a temporary variable with the correct type ordering - var tempIn dashv2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind - var tempOut dashv2beta1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind - - // Copy the layout data with the correct ordering - if in.GridLayoutKind != nil { - tempIn.GridLayoutKind = in.GridLayoutKind - } - if in.RowsLayoutKind != nil { - tempIn.RowsLayoutKind = in.RowsLayoutKind - } - if in.AutoGridLayoutKind != nil { - tempIn.AutoGridLayoutKind = in.AutoGridLayoutKind - } - if in.TabsLayoutKind != nil { - tempIn.TabsLayoutKind = in.TabsLayoutKind - } - - if err := convertLayout_V2alpha1_to_V2beta1(&tempIn, &tempOut, scope); err != nil { - return err - } - - // Copy back to the output with the correct ordering - if tempOut.GridLayoutKind != nil { - out.GridLayoutKind = tempOut.GridLayoutKind - } - if tempOut.RowsLayoutKind != nil { - out.RowsLayoutKind = tempOut.RowsLayoutKind - } - if tempOut.AutoGridLayoutKind != nil { - out.AutoGridLayoutKind = tempOut.AutoGridLayoutKind - } - if tempOut.TabsLayoutKind != nil { - out.TabsLayoutKind = tempOut.TabsLayoutKind - } - - return nil + return convertLayout_V2alpha1_to_V2beta1(in, out, scope) } diff --git a/apps/dashboard/pkg/migration/conversion/v2beta1_to_v2alpha1.go b/apps/dashboard/pkg/migration/conversion/v2beta1_to_v2alpha1.go new file mode 100644 index 00000000000..580fef1b3ea --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/v2beta1_to_v2alpha1.go @@ -0,0 +1,1007 @@ +package conversion + +import ( + "k8s.io/apimachinery/pkg/conversion" + + dashv2alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1" + dashv2beta1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2beta1" +) + +// Schema Migration: v2beta1 → v2alpha1 +// +// This file handles the conversion from Dashboard v2beta1 to v2alpha1 schema. +// This is the reverse of v2alpha1_to_v2beta1.go conversion. +// The main changes to reverse are: +// +// 1. DataQueryKind Structure Changes: +// - v2beta1: kind = "DataQuery" (hardcoded), group = datasource type, version = "v0" +// - v2alpha1: kind = datasource type (from group), datasource at spec level +// +// 2. Datasource Reference Migration: +// - v2beta1: Datasource references inside DataQueryKind.datasource +// - v2alpha1: Datasource references at spec level (PanelQuerySpec.datasource, AnnotationQuerySpec.datasource, etc.) +// - v2beta1: {name?: string} → v2alpha1: {type?: string, uid?: string} +// +// 3. Query Requirements: +// - v2beta1: AnnotationQuerySpec.query is required +// - v2alpha1: AnnotationQuerySpec.query? is optional (can be nil) +// - If query is empty/default, set to nil in v2alpha1 +// +// 4. VizConfig Changes: +// - v2beta1: kind = "VizConfig", group = panel type, version = plugin version +// - v2alpha1: kind = panel type (from group), spec.pluginVersion (from version) +// +// 5. DataSourceRef Usage: +// - v2beta1: Kept only for backward compatibility in GroupBy and Adhoc variables +// - v2alpha1: Used widely across different specs +// +// The conversion preserves all dashboard functionality while restructuring +// the data model to move datasource references from DataQueryKind to spec level. + +func ConvertDashboard_V2beta1_to_V2alpha1(in *dashv2beta1.Dashboard, out *dashv2alpha1.Dashboard, scope conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + out.APIVersion = dashv2alpha1.APIVERSION + out.Kind = in.Kind + + return convertDashboardSpec_V2beta1_to_V2alpha1(&in.Spec, &out.Spec, scope) +} + +func convertDashboardSpec_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardSpec, out *dashv2alpha1.DashboardSpec, scope conversion.Scope) error { + // Convert annotations + out.Annotations = make([]dashv2alpha1.DashboardAnnotationQueryKind, len(in.Annotations)) + for i := range in.Annotations { + if err := convertAnnotationQuery_V2beta1_to_V2alpha1(&in.Annotations[i], &out.Annotations[i], scope); err != nil { + return err + } + } + + // Copy simple fields + out.CursorSync = dashv2alpha1.DashboardDashboardCursorSync(in.CursorSync) + out.Description = in.Description + out.Editable = in.Editable + out.LiveNow = in.LiveNow + out.Preload = in.Preload + out.Revision = in.Revision + out.Tags = in.Tags + out.Title = in.Title + + // Convert elements + out.Elements = make(map[string]dashv2alpha1.DashboardElement, len(in.Elements)) + for key, element := range in.Elements { + var convertedElement dashv2alpha1.DashboardElement + if err := convertElement_V2beta1_to_V2alpha1(&element, &convertedElement, scope); err != nil { + return err + } + out.Elements[key] = convertedElement + } + + // Convert layout + if err := convertLayout_V2beta1_to_V2alpha1(&in.Layout, &out.Layout, scope); err != nil { + return err + } + + // Convert links + out.Links = make([]dashv2alpha1.DashboardDashboardLink, len(in.Links)) + for i, link := range in.Links { + convertDashboardLink_V2beta1_to_V2alpha1(&link, &out.Links[i]) + } + + // Convert time settings + if err := convertTimeSettings_V2beta1_to_V2alpha1(&in.TimeSettings, &out.TimeSettings, scope); err != nil { + return err + } + + // Convert variables + out.Variables = make([]dashv2alpha1.DashboardVariableKind, len(in.Variables)) + for i, variable := range in.Variables { + if err := convertVariable_V2beta1_to_V2alpha1(&variable, &out.Variables[i], scope); err != nil { + return err + } + } + + return nil +} + +func convertAnnotationQuery_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardAnnotationQueryKind, out *dashv2alpha1.DashboardAnnotationQueryKind, scope conversion.Scope) error { + out.Kind = in.Kind + + // Convert spec + out.Spec.Enable = in.Spec.Enable + out.Spec.Hide = in.Spec.Hide + out.Spec.IconColor = in.Spec.IconColor + out.Spec.Name = in.Spec.Name + out.Spec.BuiltIn = in.Spec.BuiltIn + out.Spec.Filter = (*dashv2alpha1.DashboardAnnotationPanelFilter)(in.Spec.Filter) + out.Spec.LegacyOptions = in.Spec.LegacyOptions + + // Convert query - move datasource from query back to annotation spec + query, datasource, err := convertDataQuery_V2beta1_to_V2alpha1(&in.Spec.Query, scope) + if err != nil { + return err + } + out.Spec.Query = query + out.Spec.Datasource = datasource + + return nil +} + +func convertDataQuery_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardDataQueryKind, scope conversion.Scope) (*dashv2alpha1.DashboardDataQueryKind, *dashv2alpha1.DashboardDataSourceRef, error) { + if in == nil { + return nil, nil, nil + } + + // Extract datasource from query + var datasource *dashv2alpha1.DashboardDataSourceRef + + // Use Group as queryKind - this is the primary source of truth for the query kind in v2beta1 + // Group field contains the datasource type in v2beta1 + queryKind := in.Group + + if in.Datasource != nil && in.Datasource.Name != nil { + uid := *in.Datasource.Name + + datasource = &dashv2alpha1.DashboardDataSourceRef{ + Uid: &uid, + Type: &in.Group, + } + } + + // Convert query kind: v2beta1 has kind="DataQuery", v2alpha1 uses group as kind + // If queryKind is still empty, it means we couldn't determine it + + // Check if query spec is empty (default query created for annotations) + // If it's empty and there's no datasource, return nil for query (v2alpha1 allows nil for annotations) + if len(in.Spec) == 0 && datasource == nil { + return nil, nil, nil + } + + query := &dashv2alpha1.DashboardDataQueryKind{ + Kind: queryKind, + Spec: in.Spec, + } + + return query, datasource, nil +} + +func convertElement_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardElement, out *dashv2alpha1.DashboardElement, scope conversion.Scope) error { + if in.PanelKind != nil { + out.PanelKind = &dashv2alpha1.DashboardPanelKind{} + return convertPanelKind_V2beta1_to_V2alpha1(in.PanelKind, out.PanelKind, scope) + } + + if in.LibraryPanelKind != nil { + out.LibraryPanelKind = &dashv2alpha1.DashboardLibraryPanelKind{} + return convertLibraryPanelKind_V2beta1_to_V2alpha1(in.LibraryPanelKind, out.LibraryPanelKind, scope) + } + + return nil +} + +func convertPanelKind_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardPanelKind, out *dashv2alpha1.DashboardPanelKind, scope conversion.Scope) error { + out.Kind = in.Kind + + // Convert spec + out.Spec.Id = in.Spec.Id + out.Spec.Title = in.Spec.Title + out.Spec.Description = in.Spec.Description + out.Spec.Transparent = in.Spec.Transparent + + // Convert links + out.Spec.Links = make([]dashv2alpha1.DashboardDataLink, len(in.Spec.Links)) + for i, link := range in.Spec.Links { + convertDataLink_V2beta1_to_V2alpha1(&link, &out.Spec.Links[i]) + } + + // Convert data (QueryGroup) + if err := convertQueryGroup_V2beta1_to_V2alpha1(&in.Spec.Data, &out.Spec.Data, scope); err != nil { + return err + } + + // Convert vizConfig + if err := convertVizConfig_V2beta1_to_V2alpha1(&in.Spec.VizConfig, &out.Spec.VizConfig); err != nil { + return err + } + + return nil +} + +func convertLibraryPanelKind_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardLibraryPanelKind, out *dashv2alpha1.DashboardLibraryPanelKind, scope conversion.Scope) error { + out.Kind = in.Kind + out.Spec.Id = in.Spec.Id + out.Spec.Title = in.Spec.Title + out.Spec.LibraryPanel = dashv2alpha1.DashboardLibraryPanelRef{ + Name: in.Spec.LibraryPanel.Name, + Uid: in.Spec.LibraryPanel.Uid, + } + return nil +} + +func convertQueryGroup_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardQueryGroupKind, out *dashv2alpha1.DashboardQueryGroupKind, scope conversion.Scope) error { + out.Kind = in.Kind + + // Convert queries + out.Spec.Queries = make([]dashv2alpha1.DashboardPanelQueryKind, len(in.Spec.Queries)) + for i, query := range in.Spec.Queries { + if err := convertPanelQuery_V2beta1_to_V2alpha1(&query, &out.Spec.Queries[i], scope); err != nil { + return err + } + } + + // Convert transformations + out.Spec.Transformations = make([]dashv2alpha1.DashboardTransformationKind, len(in.Spec.Transformations)) + for i, transformation := range in.Spec.Transformations { + convertTransformation_V2beta1_to_V2alpha1(&transformation, &out.Spec.Transformations[i]) + } + + // Convert query options + convertQueryOptions_V2beta1_to_V2alpha1(&in.Spec.QueryOptions, &out.Spec.QueryOptions) + + return nil +} + +func convertPanelQuery_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardPanelQueryKind, out *dashv2alpha1.DashboardPanelQueryKind, scope conversion.Scope) error { + out.Kind = in.Kind // PanelQueryKind keeps "PanelQuery" as its kind + out.Spec.RefId = in.Spec.RefId + out.Spec.Hidden = in.Spec.Hidden + + // Convert query - move datasource from query back to panel query spec + // Panel queries always have a query (unlike annotations which can be nil) + query, datasource, err := convertDataQuery_V2beta1_to_V2alpha1(&in.Spec.Query, scope) + if err != nil { + return err + } + // For panel queries, always create a query (even if empty) + if query == nil { + // Create default query with empty spec + query = &dashv2alpha1.DashboardDataQueryKind{ + Kind: in.Spec.Query.Group, + Spec: make(map[string]interface{}), + } + } + out.Spec.Query = *query + out.Spec.Datasource = datasource + + return nil +} + +func convertTransformation_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardTransformationKind, out *dashv2alpha1.DashboardTransformationKind) { + out.Kind = in.Kind + out.Spec.Id = in.Spec.Id + out.Spec.Disabled = in.Spec.Disabled + out.Spec.Filter = (*dashv2alpha1.DashboardMatcherConfig)(in.Spec.Filter) + out.Spec.Topic = (*dashv2alpha1.DashboardDataTopic)(in.Spec.Topic) + out.Spec.Options = in.Spec.Options +} + +func convertQueryOptions_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardQueryOptionsSpec, out *dashv2alpha1.DashboardQueryOptionsSpec) { + out.TimeFrom = in.TimeFrom + out.MaxDataPoints = in.MaxDataPoints + out.TimeShift = in.TimeShift + out.QueryCachingTTL = in.QueryCachingTTL + out.Interval = in.Interval + out.CacheTimeout = in.CacheTimeout + out.HideTimeOverride = in.HideTimeOverride +} + +func convertVizConfig_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardVizConfigKind, out *dashv2alpha1.DashboardVizConfigKind) error { + // v2beta1: kind="VizConfig", group=panel type, version=plugin version + // v2alpha1: kind=panel type, spec.pluginVersion + out.Kind = in.Group // panel type from group + out.Spec.PluginVersion = in.Version + out.Spec.Options = in.Spec.Options + + // Convert field config + convertFieldConfigSource_V2beta1_to_V2alpha1(&in.Spec.FieldConfig, &out.Spec.FieldConfig) + + return nil +} + +func convertFieldConfigSource_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardFieldConfigSource, out *dashv2alpha1.DashboardFieldConfigSource) { + // Convert defaults + convertFieldConfig_V2beta1_to_V2alpha1(&in.Defaults, &out.Defaults) + + // Convert overrides + out.Overrides = make([]dashv2alpha1.DashboardV2alpha1FieldConfigSourceOverrides, len(in.Overrides)) + for i, override := range in.Overrides { + convertFieldConfigOverride_V2beta1_to_V2alpha1(&override, &out.Overrides[i]) + } +} + +func convertFieldConfig_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardFieldConfig, out *dashv2alpha1.DashboardFieldConfig) { + *out = dashv2alpha1.DashboardFieldConfig{ + DisplayName: in.DisplayName, + DisplayNameFromDS: in.DisplayNameFromDS, + Description: in.Description, + Path: in.Path, + Writeable: in.Writeable, + Filterable: in.Filterable, + Unit: in.Unit, + Decimals: in.Decimals, + Min: in.Min, + Max: in.Max, + Links: in.Links, + NoValue: in.NoValue, + Custom: in.Custom, + } + + // Convert thresholds + if in.Thresholds != nil { + out.Thresholds = &dashv2alpha1.DashboardThresholdsConfig{ + Mode: dashv2alpha1.DashboardThresholdsMode(in.Thresholds.Mode), + Steps: make([]dashv2alpha1.DashboardThreshold, len(in.Thresholds.Steps)), + } + for i, step := range in.Thresholds.Steps { + // Preserve null values from v2beta1 + out.Thresholds.Steps[i] = dashv2alpha1.DashboardThreshold{ + Value: step.Value, + Color: step.Color, + } + } + } + + // Convert color + if in.Color != nil { + out.Color = &dashv2alpha1.DashboardFieldColor{ + Mode: dashv2alpha1.DashboardFieldColorModeId(in.Color.Mode), + FixedColor: in.Color.FixedColor, + SeriesBy: (*dashv2alpha1.DashboardFieldColorSeriesByMode)(in.Color.SeriesBy), + } + } + + // Convert mappings + if in.Mappings != nil { + out.Mappings = make([]dashv2alpha1.DashboardValueMapping, len(in.Mappings)) + for i, mapping := range in.Mappings { + convertValueMapping_V2beta1_to_V2alpha1(&mapping, &out.Mappings[i]) + } + } +} + +func convertFieldConfigOverride_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardV2beta1FieldConfigSourceOverrides, out *dashv2alpha1.DashboardV2alpha1FieldConfigSourceOverrides) { + out.SystemRef = in.SystemRef + + out.Matcher = dashv2alpha1.DashboardMatcherConfig{ + Id: in.Matcher.Id, + Options: in.Matcher.Options, + } + + out.Properties = make([]dashv2alpha1.DashboardDynamicConfigValue, len(in.Properties)) + for i, prop := range in.Properties { + out.Properties[i] = dashv2alpha1.DashboardDynamicConfigValue{ + Id: prop.Id, + Value: prop.Value, + } + } +} + +func convertValueMapping_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardValueMapping, out *dashv2alpha1.DashboardValueMapping) { + if in.ValueMap != nil { + out.ValueMap = &dashv2alpha1.DashboardValueMap{ + Type: dashv2alpha1.DashboardMappingType(in.ValueMap.Type), + Options: make(map[string]dashv2alpha1.DashboardValueMappingResult, len(in.ValueMap.Options)), + } + for k, v := range in.ValueMap.Options { + out.ValueMap.Options[k] = dashv2alpha1.DashboardValueMappingResult{ + Text: v.Text, + Color: v.Color, + Icon: v.Icon, + Index: v.Index, + } + } + } + + if in.RangeMap != nil { + out.RangeMap = &dashv2alpha1.DashboardRangeMap{ + Type: dashv2alpha1.DashboardMappingType(in.RangeMap.Type), + Options: dashv2alpha1.DashboardV2alpha1RangeMapOptions{ + From: in.RangeMap.Options.From, + To: in.RangeMap.Options.To, + Result: dashv2alpha1.DashboardValueMappingResult{ + Text: in.RangeMap.Options.Result.Text, + Color: in.RangeMap.Options.Result.Color, + Icon: in.RangeMap.Options.Result.Icon, + Index: in.RangeMap.Options.Result.Index, + }, + }, + } + } + + if in.RegexMap != nil { + out.RegexMap = &dashv2alpha1.DashboardRegexMap{ + Type: dashv2alpha1.DashboardMappingType(in.RegexMap.Type), + Options: dashv2alpha1.DashboardV2alpha1RegexMapOptions{ + Pattern: in.RegexMap.Options.Pattern, + Result: dashv2alpha1.DashboardValueMappingResult{ + Text: in.RegexMap.Options.Result.Text, + Color: in.RegexMap.Options.Result.Color, + Icon: in.RegexMap.Options.Result.Icon, + Index: in.RegexMap.Options.Result.Index, + }, + }, + } + } + + if in.SpecialValueMap != nil { + out.SpecialValueMap = &dashv2alpha1.DashboardSpecialValueMap{ + Type: dashv2alpha1.DashboardMappingType(in.SpecialValueMap.Type), + Options: dashv2alpha1.DashboardV2alpha1SpecialValueMapOptions{ + Match: dashv2alpha1.DashboardSpecialValueMatch(in.SpecialValueMap.Options.Match), + Result: dashv2alpha1.DashboardValueMappingResult{ + Text: in.SpecialValueMap.Options.Result.Text, + Color: in.SpecialValueMap.Options.Result.Color, + Icon: in.SpecialValueMap.Options.Result.Icon, + Index: in.SpecialValueMap.Options.Result.Index, + }, + }, + } + } +} + +func convertLayout_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind, out *dashv2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind, scope conversion.Scope) error { + if in.GridLayoutKind != nil { + out.GridLayoutKind = &dashv2alpha1.DashboardGridLayoutKind{ + Kind: in.GridLayoutKind.Kind, + } + return convertGridLayoutSpec_V2beta1_to_V2alpha1(&in.GridLayoutKind.Spec, &out.GridLayoutKind.Spec, scope) + } + + if in.RowsLayoutKind != nil { + out.RowsLayoutKind = &dashv2alpha1.DashboardRowsLayoutKind{ + Kind: in.RowsLayoutKind.Kind, + } + return convertRowsLayoutSpec_V2beta1_to_V2alpha1(&in.RowsLayoutKind.Spec, &out.RowsLayoutKind.Spec, scope) + } + + if in.AutoGridLayoutKind != nil { + out.AutoGridLayoutKind = &dashv2alpha1.DashboardAutoGridLayoutKind{ + Kind: in.AutoGridLayoutKind.Kind, + } + return convertAutoGridLayoutSpec_V2beta1_to_V2alpha1(&in.AutoGridLayoutKind.Spec, &out.AutoGridLayoutKind.Spec, scope) + } + + if in.TabsLayoutKind != nil { + out.TabsLayoutKind = &dashv2alpha1.DashboardTabsLayoutKind{ + Kind: in.TabsLayoutKind.Kind, + } + return convertTabsLayoutSpec_V2beta1_to_V2alpha1(&in.TabsLayoutKind.Spec, &out.TabsLayoutKind.Spec, scope) + } + + return nil +} + +func convertGridLayoutSpec_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardGridLayoutSpec, out *dashv2alpha1.DashboardGridLayoutSpec, scope conversion.Scope) error { + out.Items = make([]dashv2alpha1.DashboardGridLayoutItemKind, len(in.Items)) + for i, item := range in.Items { + out.Items[i] = dashv2alpha1.DashboardGridLayoutItemKind{ + Kind: item.Kind, + Spec: dashv2alpha1.DashboardGridLayoutItemSpec{ + X: item.Spec.X, + Y: item.Spec.Y, + Width: item.Spec.Width, + Height: item.Spec.Height, + Element: dashv2alpha1.DashboardElementReference{ + Kind: item.Spec.Element.Kind, + Name: item.Spec.Element.Name, + }, + Repeat: convertRepeatOptions_V2beta1_to_V2alpha1(item.Spec.Repeat), + }, + } + } + return nil +} + +func convertRowsLayoutSpec_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardRowsLayoutSpec, out *dashv2alpha1.DashboardRowsLayoutSpec, scope conversion.Scope) error { + out.Rows = make([]dashv2alpha1.DashboardRowsLayoutRowKind, len(in.Rows)) + for i, row := range in.Rows { + out.Rows[i] = dashv2alpha1.DashboardRowsLayoutRowKind{ + Kind: row.Kind, + Spec: dashv2alpha1.DashboardRowsLayoutRowSpec{ + Title: row.Spec.Title, + Collapse: row.Spec.Collapse, + HideHeader: row.Spec.HideHeader, + FillScreen: row.Spec.FillScreen, + ConditionalRendering: convertConditionalRenderingGroupKind_V2beta1_to_V2alpha1(row.Spec.ConditionalRendering), + Repeat: convertRowRepeatOptions_V2beta1_to_V2alpha1(row.Spec.Repeat), + }, + } + if err := convertRowLayout_V2beta1_to_V2alpha1(&row.Spec.Layout, &out.Rows[i].Spec.Layout, scope); err != nil { + return err + } + } + return nil +} + +func convertAutoGridLayoutSpec_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardAutoGridLayoutSpec, out *dashv2alpha1.DashboardAutoGridLayoutSpec, scope conversion.Scope) error { + out.MaxColumnCount = in.MaxColumnCount + out.ColumnWidthMode = dashv2alpha1.DashboardAutoGridLayoutSpecColumnWidthMode(in.ColumnWidthMode) + out.ColumnWidth = in.ColumnWidth + out.RowHeightMode = dashv2alpha1.DashboardAutoGridLayoutSpecRowHeightMode(in.RowHeightMode) + out.RowHeight = in.RowHeight + out.FillScreen = in.FillScreen + + out.Items = make([]dashv2alpha1.DashboardAutoGridLayoutItemKind, len(in.Items)) + for i, item := range in.Items { + out.Items[i] = dashv2alpha1.DashboardAutoGridLayoutItemKind{ + Kind: item.Kind, + Spec: dashv2alpha1.DashboardAutoGridLayoutItemSpec{ + Element: dashv2alpha1.DashboardElementReference{ + Kind: item.Spec.Element.Kind, + Name: item.Spec.Element.Name, + }, + Repeat: convertAutoGridRepeatOptions_V2beta1_to_V2alpha1(item.Spec.Repeat), + ConditionalRendering: convertConditionalRenderingGroupKind_V2beta1_to_V2alpha1(item.Spec.ConditionalRendering), + }, + } + } + return nil +} + +func convertTabsLayoutSpec_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardTabsLayoutSpec, out *dashv2alpha1.DashboardTabsLayoutSpec, scope conversion.Scope) error { + out.Tabs = make([]dashv2alpha1.DashboardTabsLayoutTabKind, len(in.Tabs)) + for i, tab := range in.Tabs { + out.Tabs[i] = dashv2alpha1.DashboardTabsLayoutTabKind{ + Kind: tab.Kind, + Spec: dashv2alpha1.DashboardTabsLayoutTabSpec{ + Title: tab.Spec.Title, + ConditionalRendering: convertConditionalRenderingGroupKind_V2beta1_to_V2alpha1(tab.Spec.ConditionalRendering), + Repeat: convertTabRepeatOptions_V2beta1_to_V2alpha1(tab.Spec.Repeat), + }, + } + if err := convertTabLayout_V2beta1_to_V2alpha1(&tab.Spec.Layout, &out.Tabs[i].Spec.Layout, scope); err != nil { + return err + } + } + return nil +} + +func convertDashboardLink_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardDashboardLink, out *dashv2alpha1.DashboardDashboardLink) { + out.Title = in.Title + out.Type = dashv2alpha1.DashboardDashboardLinkType(in.Type) + out.Icon = in.Icon + out.Tooltip = in.Tooltip + out.Url = in.Url + out.Tags = in.Tags + out.AsDropdown = in.AsDropdown + out.TargetBlank = in.TargetBlank + out.IncludeVars = in.IncludeVars + out.KeepTime = in.KeepTime +} + +func convertDataLink_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardDataLink, out *dashv2alpha1.DashboardDataLink) { + out.Title = in.Title + out.Url = in.Url + out.TargetBlank = in.TargetBlank +} + +func convertTimeSettings_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardTimeSettingsSpec, out *dashv2alpha1.DashboardTimeSettingsSpec, scope conversion.Scope) error { + out.Timezone = in.Timezone + out.From = in.From + out.To = in.To + out.AutoRefresh = in.AutoRefresh + out.AutoRefreshIntervals = in.AutoRefreshIntervals + out.HideTimepicker = in.HideTimepicker + out.WeekStart = (*dashv2alpha1.DashboardTimeSettingsSpecWeekStart)(in.WeekStart) + out.FiscalYearStartMonth = in.FiscalYearStartMonth + out.NowDelay = in.NowDelay + + // Convert quick ranges + if in.QuickRanges != nil { + out.QuickRanges = make([]dashv2alpha1.DashboardTimeRangeOption, len(in.QuickRanges)) + for i, qr := range in.QuickRanges { + out.QuickRanges[i] = dashv2alpha1.DashboardTimeRangeOption{ + Display: qr.Display, + From: qr.From, + To: qr.To, + } + } + } + + return nil +} + +func convertVariable_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardVariableKind, out *dashv2alpha1.DashboardVariableKind, scope conversion.Scope) error { + if in.QueryVariableKind != nil { + out.QueryVariableKind = &dashv2alpha1.DashboardQueryVariableKind{ + Kind: in.QueryVariableKind.Kind, + } + return convertQueryVariableSpec_V2beta1_to_V2alpha1(&in.QueryVariableKind.Spec, &out.QueryVariableKind.Spec, scope) + } + + if in.TextVariableKind != nil { + out.TextVariableKind = &dashv2alpha1.DashboardTextVariableKind{ + Kind: in.TextVariableKind.Kind, + Spec: dashv2alpha1.DashboardTextVariableSpec{ + Name: in.TextVariableKind.Spec.Name, + Current: convertVariableOption_V2beta1_to_V2alpha1(in.TextVariableKind.Spec.Current), + Query: in.TextVariableKind.Spec.Query, + Label: in.TextVariableKind.Spec.Label, + Hide: dashv2alpha1.DashboardVariableHide(in.TextVariableKind.Spec.Hide), + SkipUrlSync: in.TextVariableKind.Spec.SkipUrlSync, + Description: in.TextVariableKind.Spec.Description, + }, + } + } + + if in.ConstantVariableKind != nil { + out.ConstantVariableKind = &dashv2alpha1.DashboardConstantVariableKind{ + Kind: in.ConstantVariableKind.Kind, + Spec: dashv2alpha1.DashboardConstantVariableSpec{ + Name: in.ConstantVariableKind.Spec.Name, + Query: in.ConstantVariableKind.Spec.Query, + Current: convertVariableOption_V2beta1_to_V2alpha1(in.ConstantVariableKind.Spec.Current), + Label: in.ConstantVariableKind.Spec.Label, + Hide: dashv2alpha1.DashboardVariableHide(in.ConstantVariableKind.Spec.Hide), + SkipUrlSync: in.ConstantVariableKind.Spec.SkipUrlSync, + Description: in.ConstantVariableKind.Spec.Description, + }, + } + } + + if in.DatasourceVariableKind != nil { + out.DatasourceVariableKind = &dashv2alpha1.DashboardDatasourceVariableKind{ + Kind: in.DatasourceVariableKind.Kind, + Spec: dashv2alpha1.DashboardDatasourceVariableSpec{ + Name: in.DatasourceVariableKind.Spec.Name, + PluginId: in.DatasourceVariableKind.Spec.PluginId, + Refresh: dashv2alpha1.DashboardVariableRefresh(in.DatasourceVariableKind.Spec.Refresh), + Regex: in.DatasourceVariableKind.Spec.Regex, + Current: convertVariableOption_V2beta1_to_V2alpha1(in.DatasourceVariableKind.Spec.Current), + Options: convertVariableOptions_V2beta1_to_V2alpha1(in.DatasourceVariableKind.Spec.Options), + Multi: in.DatasourceVariableKind.Spec.Multi, + IncludeAll: in.DatasourceVariableKind.Spec.IncludeAll, + AllValue: in.DatasourceVariableKind.Spec.AllValue, + Label: in.DatasourceVariableKind.Spec.Label, + Hide: dashv2alpha1.DashboardVariableHide(in.DatasourceVariableKind.Spec.Hide), + SkipUrlSync: in.DatasourceVariableKind.Spec.SkipUrlSync, + Description: in.DatasourceVariableKind.Spec.Description, + AllowCustomValue: in.DatasourceVariableKind.Spec.AllowCustomValue, + }, + } + } + + if in.IntervalVariableKind != nil { + out.IntervalVariableKind = &dashv2alpha1.DashboardIntervalVariableKind{ + Kind: in.IntervalVariableKind.Kind, + Spec: dashv2alpha1.DashboardIntervalVariableSpec{ + Name: in.IntervalVariableKind.Spec.Name, + Query: in.IntervalVariableKind.Spec.Query, + Current: convertVariableOption_V2beta1_to_V2alpha1(in.IntervalVariableKind.Spec.Current), + Options: convertVariableOptions_V2beta1_to_V2alpha1(in.IntervalVariableKind.Spec.Options), + Auto: in.IntervalVariableKind.Spec.Auto, + AutoMin: in.IntervalVariableKind.Spec.AutoMin, + AutoCount: in.IntervalVariableKind.Spec.AutoCount, + Refresh: dashv2alpha1.DashboardVariableRefresh("load"), // Interval variables always use "load" in v2alpha1 + Label: in.IntervalVariableKind.Spec.Label, + Hide: dashv2alpha1.DashboardVariableHide(in.IntervalVariableKind.Spec.Hide), + SkipUrlSync: in.IntervalVariableKind.Spec.SkipUrlSync, + Description: in.IntervalVariableKind.Spec.Description, + }, + } + } + + if in.CustomVariableKind != nil { + out.CustomVariableKind = &dashv2alpha1.DashboardCustomVariableKind{ + Kind: in.CustomVariableKind.Kind, + Spec: dashv2alpha1.DashboardCustomVariableSpec{ + Name: in.CustomVariableKind.Spec.Name, + Query: in.CustomVariableKind.Spec.Query, + Current: convertVariableOption_V2beta1_to_V2alpha1(in.CustomVariableKind.Spec.Current), + Options: convertVariableOptions_V2beta1_to_V2alpha1(in.CustomVariableKind.Spec.Options), + Multi: in.CustomVariableKind.Spec.Multi, + IncludeAll: in.CustomVariableKind.Spec.IncludeAll, + AllValue: in.CustomVariableKind.Spec.AllValue, + Label: in.CustomVariableKind.Spec.Label, + Hide: dashv2alpha1.DashboardVariableHide(in.CustomVariableKind.Spec.Hide), + SkipUrlSync: in.CustomVariableKind.Spec.SkipUrlSync, + Description: in.CustomVariableKind.Spec.Description, + AllowCustomValue: in.CustomVariableKind.Spec.AllowCustomValue, + }, + } + } + + if in.GroupByVariableKind != nil { + // Extract datasource from top-level fields + var dsType *string + var dsUID *string + if in.GroupByVariableKind.Datasource != nil && in.GroupByVariableKind.Datasource.Name != nil { + dsUID = in.GroupByVariableKind.Datasource.Name + } + if in.GroupByVariableKind.Group != "" { + dsType = &in.GroupByVariableKind.Group + } + + var datasource *dashv2alpha1.DashboardDataSourceRef + if dsType != nil || dsUID != nil { + datasource = &dashv2alpha1.DashboardDataSourceRef{ + Type: dsType, + Uid: dsUID, + } + } + + out.GroupByVariableKind = &dashv2alpha1.DashboardGroupByVariableKind{ + Kind: in.GroupByVariableKind.Kind, + Spec: dashv2alpha1.DashboardGroupByVariableSpec{ + Name: in.GroupByVariableKind.Spec.Name, + DefaultValue: convertVariableOptionPtr_V2beta1_to_V2alpha1(in.GroupByVariableKind.Spec.DefaultValue), + Current: convertVariableOption_V2beta1_to_V2alpha1(in.GroupByVariableKind.Spec.Current), + Options: convertVariableOptions_V2beta1_to_V2alpha1(in.GroupByVariableKind.Spec.Options), + Multi: in.GroupByVariableKind.Spec.Multi, + Label: in.GroupByVariableKind.Spec.Label, + Hide: dashv2alpha1.DashboardVariableHide(in.GroupByVariableKind.Spec.Hide), + SkipUrlSync: in.GroupByVariableKind.Spec.SkipUrlSync, + Description: in.GroupByVariableKind.Spec.Description, + Datasource: datasource, + }, + } + } + + if in.AdhocVariableKind != nil { + // Extract datasource from top-level fields + var dsType *string + var dsUID *string + if in.AdhocVariableKind.Datasource != nil && in.AdhocVariableKind.Datasource.Name != nil { + dsUID = in.AdhocVariableKind.Datasource.Name + } + if in.AdhocVariableKind.Group != "" { + dsType = &in.AdhocVariableKind.Group + } + + var datasource *dashv2alpha1.DashboardDataSourceRef + if dsType != nil || dsUID != nil { + datasource = &dashv2alpha1.DashboardDataSourceRef{ + Type: dsType, + Uid: dsUID, + } + } + + out.AdhocVariableKind = &dashv2alpha1.DashboardAdhocVariableKind{ + Kind: in.AdhocVariableKind.Kind, + Spec: dashv2alpha1.DashboardAdhocVariableSpec{ + Name: in.AdhocVariableKind.Spec.Name, + BaseFilters: convertAdHocFilters_V2beta1_to_V2alpha1(in.AdhocVariableKind.Spec.BaseFilters), + Filters: convertAdHocFilters_V2beta1_to_V2alpha1(in.AdhocVariableKind.Spec.Filters), + DefaultKeys: convertMetricFindValues_V2beta1_to_V2alpha1(in.AdhocVariableKind.Spec.DefaultKeys), + Label: in.AdhocVariableKind.Spec.Label, + Hide: dashv2alpha1.DashboardVariableHide(in.AdhocVariableKind.Spec.Hide), + SkipUrlSync: in.AdhocVariableKind.Spec.SkipUrlSync, + Description: in.AdhocVariableKind.Spec.Description, + AllowCustomValue: in.AdhocVariableKind.Spec.AllowCustomValue, + Datasource: datasource, + }, + } + } + + return nil +} + +func convertQueryVariableSpec_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardQueryVariableSpec, out *dashv2alpha1.DashboardQueryVariableSpec, scope conversion.Scope) error { + out.Name = in.Name + out.Current = convertVariableOption_V2beta1_to_V2alpha1(in.Current) + out.Label = in.Label + out.Hide = dashv2alpha1.DashboardVariableHide(in.Hide) + out.Refresh = dashv2alpha1.DashboardVariableRefresh(in.Refresh) + out.SkipUrlSync = in.SkipUrlSync + out.Description = in.Description + out.Regex = in.Regex + out.Sort = dashv2alpha1.DashboardVariableSort(in.Sort) + out.Definition = in.Definition + out.Options = convertVariableOptions_V2beta1_to_V2alpha1(in.Options) + out.Multi = in.Multi + out.IncludeAll = in.IncludeAll + out.AllValue = in.AllValue + out.Placeholder = in.Placeholder + out.AllowCustomValue = in.AllowCustomValue + out.StaticOptions = convertVariableOptions_V2beta1_to_V2alpha1(in.StaticOptions) + out.StaticOptionsOrder = (*dashv2alpha1.DashboardQueryVariableSpecStaticOptionsOrder)(in.StaticOptionsOrder) + + // Convert query - move datasource from query back to variable spec + // QueryVariableSpec.Query is required (not a pointer) in v2alpha1, so always create it + query, datasource, err := convertDataQuery_V2beta1_to_V2alpha1(&in.Query, scope) + if err != nil { + return err + } + if query == nil { + // Create default query if it was nil (shouldn't happen for query variables, but handle gracefully) + query = &dashv2alpha1.DashboardDataQueryKind{ + Kind: in.Query.Group, + Spec: in.Query.Spec, + } + } + out.Query = *query + out.Datasource = datasource + + return nil +} + +func convertVariableOption_V2beta1_to_V2alpha1(in dashv2beta1.DashboardVariableOption) dashv2alpha1.DashboardVariableOption { + return dashv2alpha1.DashboardVariableOption{ + Selected: in.Selected, + Text: dashv2alpha1.DashboardStringOrArrayOfString(in.Text), + Value: dashv2alpha1.DashboardStringOrArrayOfString(in.Value), + } +} + +func convertVariableOptionPtr_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardVariableOption) *dashv2alpha1.DashboardVariableOption { + if in == nil { + return nil + } + out := convertVariableOption_V2beta1_to_V2alpha1(*in) + return &out +} + +func convertVariableOptions_V2beta1_to_V2alpha1(in []dashv2beta1.DashboardVariableOption) []dashv2alpha1.DashboardVariableOption { + if in == nil { + return nil + } + out := make([]dashv2alpha1.DashboardVariableOption, len(in)) + for i, option := range in { + out[i] = convertVariableOption_V2beta1_to_V2alpha1(option) + } + return out +} + +func convertAdHocFilters_V2beta1_to_V2alpha1(in []dashv2beta1.DashboardAdHocFilterWithLabels) []dashv2alpha1.DashboardAdHocFilterWithLabels { + if in == nil { + return nil + } + out := make([]dashv2alpha1.DashboardAdHocFilterWithLabels, len(in)) + for i, filter := range in { + out[i] = dashv2alpha1.DashboardAdHocFilterWithLabels{ + Key: filter.Key, + Operator: filter.Operator, + Value: filter.Value, + Values: filter.Values, + KeyLabel: filter.KeyLabel, + ValueLabels: filter.ValueLabels, + ForceEdit: filter.ForceEdit, + Origin: filter.Origin, + Condition: filter.Condition, + } + } + return out +} + +func convertMetricFindValues_V2beta1_to_V2alpha1(in []dashv2beta1.DashboardMetricFindValue) []dashv2alpha1.DashboardMetricFindValue { + if in == nil { + return nil + } + out := make([]dashv2alpha1.DashboardMetricFindValue, len(in)) + for i, value := range in { + out[i] = dashv2alpha1.DashboardMetricFindValue{ + Text: value.Text, + Value: (*dashv2alpha1.DashboardStringOrFloat64)(value.Value), + Group: value.Group, + Expandable: value.Expandable, + } + } + return out +} + +func convertRepeatOptions_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardRepeatOptions) *dashv2alpha1.DashboardRepeatOptions { + if in == nil { + return nil + } + return &dashv2alpha1.DashboardRepeatOptions{ + Mode: in.Mode, + Value: in.Value, + Direction: (*dashv2alpha1.DashboardRepeatOptionsDirection)(in.Direction), + MaxPerRow: in.MaxPerRow, + } +} + +func convertRowRepeatOptions_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardRowRepeatOptions) *dashv2alpha1.DashboardRowRepeatOptions { + if in == nil { + return nil + } + return &dashv2alpha1.DashboardRowRepeatOptions{ + Mode: in.Mode, + Value: in.Value, + } +} + +func convertAutoGridRepeatOptions_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardAutoGridRepeatOptions) *dashv2alpha1.DashboardAutoGridRepeatOptions { + if in == nil { + return nil + } + return &dashv2alpha1.DashboardAutoGridRepeatOptions{ + Mode: in.Mode, + Value: in.Value, + } +} + +func convertTabRepeatOptions_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardTabRepeatOptions) *dashv2alpha1.DashboardTabRepeatOptions { + if in == nil { + return nil + } + return &dashv2alpha1.DashboardTabRepeatOptions{ + Mode: in.Mode, + Value: in.Value, + } +} + +func convertConditionalRenderingGroupKind_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardConditionalRenderingGroupKind) *dashv2alpha1.DashboardConditionalRenderingGroupKind { + if in == nil { + return nil + } + + out := &dashv2alpha1.DashboardConditionalRenderingGroupKind{ + Kind: in.Kind, + Spec: dashv2alpha1.DashboardConditionalRenderingGroupSpec{ + Visibility: dashv2alpha1.DashboardConditionalRenderingGroupSpecVisibility(in.Spec.Visibility), + Condition: dashv2alpha1.DashboardConditionalRenderingGroupSpecCondition(in.Spec.Condition), + Items: make([]dashv2alpha1.DashboardConditionalRenderingVariableKindOrConditionalRenderingDataKindOrConditionalRenderingTimeRangeSizeKind, len(in.Spec.Items)), + }, + } + + // Convert each item in the Items slice + for i, item := range in.Spec.Items { + out.Spec.Items[i] = dashv2alpha1.DashboardConditionalRenderingVariableKindOrConditionalRenderingDataKindOrConditionalRenderingTimeRangeSizeKind{} + + if item.ConditionalRenderingVariableKind != nil { + out.Spec.Items[i].ConditionalRenderingVariableKind = &dashv2alpha1.DashboardConditionalRenderingVariableKind{ + Kind: item.ConditionalRenderingVariableKind.Kind, + Spec: dashv2alpha1.DashboardConditionalRenderingVariableSpec{ + Variable: item.ConditionalRenderingVariableKind.Spec.Variable, + Operator: dashv2alpha1.DashboardConditionalRenderingVariableSpecOperator(item.ConditionalRenderingVariableKind.Spec.Operator), + Value: item.ConditionalRenderingVariableKind.Spec.Value, + }, + } + } + + if item.ConditionalRenderingDataKind != nil { + out.Spec.Items[i].ConditionalRenderingDataKind = &dashv2alpha1.DashboardConditionalRenderingDataKind{ + Kind: item.ConditionalRenderingDataKind.Kind, + Spec: dashv2alpha1.DashboardConditionalRenderingDataSpec{ + Value: item.ConditionalRenderingDataKind.Spec.Value, + }, + } + } + + if item.ConditionalRenderingTimeRangeSizeKind != nil { + out.Spec.Items[i].ConditionalRenderingTimeRangeSizeKind = &dashv2alpha1.DashboardConditionalRenderingTimeRangeSizeKind{ + Kind: item.ConditionalRenderingTimeRangeSizeKind.Kind, + Spec: dashv2alpha1.DashboardConditionalRenderingTimeRangeSizeSpec{ + Value: item.ConditionalRenderingTimeRangeSizeKind.Spec.Value, + }, + } + } + } + + return out +} + +func convertRowLayout_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind, out *dashv2alpha1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind, scope conversion.Scope) error { + if in.GridLayoutKind != nil { + out.GridLayoutKind = &dashv2alpha1.DashboardGridLayoutKind{ + Kind: in.GridLayoutKind.Kind, + } + return convertGridLayoutSpec_V2beta1_to_V2alpha1(&in.GridLayoutKind.Spec, &out.GridLayoutKind.Spec, scope) + } + + if in.AutoGridLayoutKind != nil { + out.AutoGridLayoutKind = &dashv2alpha1.DashboardAutoGridLayoutKind{ + Kind: in.AutoGridLayoutKind.Kind, + } + return convertAutoGridLayoutSpec_V2beta1_to_V2alpha1(&in.AutoGridLayoutKind.Spec, &out.AutoGridLayoutKind.Spec, scope) + } + + if in.TabsLayoutKind != nil { + out.TabsLayoutKind = &dashv2alpha1.DashboardTabsLayoutKind{ + Kind: in.TabsLayoutKind.Kind, + } + return convertTabsLayoutSpec_V2beta1_to_V2alpha1(&in.TabsLayoutKind.Spec, &out.TabsLayoutKind.Spec, scope) + } + + if in.RowsLayoutKind != nil { + out.RowsLayoutKind = &dashv2alpha1.DashboardRowsLayoutKind{ + Kind: in.RowsLayoutKind.Kind, + } + return convertRowsLayoutSpec_V2beta1_to_V2alpha1(&in.RowsLayoutKind.Spec, &out.RowsLayoutKind.Spec, scope) + } + + return nil +} + +func convertTabLayout_V2beta1_to_V2alpha1(in *dashv2beta1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind, out *dashv2alpha1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind, scope conversion.Scope) error { + return convertLayout_V2beta1_to_V2alpha1(in, out, scope) +} diff --git a/apps/dashboard/pkg/migration/conversion/v2beta1_to_v2alpha1_test.go b/apps/dashboard/pkg/migration/conversion/v2beta1_to_v2alpha1_test.go new file mode 100644 index 00000000000..773961a31fb --- /dev/null +++ b/apps/dashboard/pkg/migration/conversion/v2beta1_to_v2alpha1_test.go @@ -0,0 +1,580 @@ +package conversion + +import ( + "encoding/json" + "fmt" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "k8s.io/apimachinery/pkg/runtime" + + dashv2alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1" + dashv2beta1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2beta1" + "github.com/grafana/grafana/apps/dashboard/pkg/migration" + migrationtestutil "github.com/grafana/grafana/apps/dashboard/pkg/migration/testutil" +) + +// TestV2beta1ToV2alpha1RoundTrip tests round-trip conversion: v2beta1 → v2alpha1 → v2beta1 +// This ensures no data loss during conversion between v2 versions +func TestV2beta1ToV2alpha1RoundTrip(t *testing.T) { + // Initialize the migrator with test providers + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) + + // Set up conversion scheme + scheme := runtime.NewScheme() + err := RegisterConversions(scheme, dsProvider, leProvider) + require.NoError(t, err) + + // Read all v2beta1 output files (these are converted from v1beta1 or v2alpha1) + outputDir := filepath.Join("testdata", "output") + files, err := os.ReadDir(outputDir) + require.NoError(t, err, "Failed to read output directory") + + for _, file := range files { + if file.IsDir() { + continue + } + + // Only process v2beta1 files + if !strings.Contains(file.Name(), ".v2beta1.json") { + continue + } + + t.Run(fmt.Sprintf("RoundTrip_%s", file.Name()), func(t *testing.T) { + // Read v2beta1 dashboard file + inputFile := filepath.Join(outputDir, file.Name()) + // ignore gosec G304 as this function is only used in the test process + //nolint:gosec + inputData, err := os.ReadFile(inputFile) + require.NoError(t, err, "Failed to read input file") + + // Parse v2beta1 dashboard + var originalV2beta1 dashv2beta1.Dashboard + err = json.Unmarshal(inputData, &originalV2beta1) + require.NoError(t, err, "Failed to unmarshal v2beta1 dashboard") + + // Collect original statistics + originalStats := collectStatsV2beta1(originalV2beta1.Spec) + + // Step 1: Convert v2beta1 → v2alpha1 + var v2alpha1 dashv2alpha1.Dashboard + err = scheme.Convert(&originalV2beta1, &v2alpha1, nil) + require.NoError(t, err, "Failed to convert v2beta1 to v2alpha1") + + // Collect v2alpha1 statistics + v2alpha1Stats := collectStatsV2alpha1(v2alpha1.Spec) + + // Verify no data loss in first conversion + err = detectConversionDataLoss(originalStats, v2alpha1Stats, "V2beta1", "V2alpha1") + assert.NoError(t, err, "Data loss detected in v2beta1 → v2alpha1 conversion") + + // Step 2: Convert v2alpha1 → v2beta1 (back) + var roundTripV2beta1 dashv2beta1.Dashboard + err = scheme.Convert(&v2alpha1, &roundTripV2beta1, nil) + require.NoError(t, err, "Failed to convert v2alpha1 back to v2beta1") + + // Collect round-trip statistics + roundTripStats := collectStatsV2beta1(roundTripV2beta1.Spec) + + // Verify no data loss in round-trip conversion + err = detectConversionDataLoss(originalStats, roundTripStats, "V2beta1", "V2beta1_RoundTrip") + assert.NoError(t, err, "Data loss detected in round-trip conversion") + + // Verify counts match exactly + assert.Equal(t, originalStats.panelCount, roundTripStats.panelCount, "Panel count mismatch after round-trip") + assert.Equal(t, originalStats.queryCount, roundTripStats.queryCount, "Query count mismatch after round-trip") + assert.Equal(t, originalStats.annotationCount, roundTripStats.annotationCount, "Annotation count mismatch after round-trip") + assert.Equal(t, originalStats.linkCount, roundTripStats.linkCount, "Link count mismatch after round-trip") + assert.Equal(t, originalStats.variableCount, roundTripStats.variableCount, "Variable count mismatch after round-trip") + + // Compare the entire v2beta1 spec before and after round-trip - they should be exactly equal + assert.Equal(t, originalV2beta1.Spec, roundTripV2beta1.Spec, "v2beta1 spec should be exactly equal before and after round-trip conversion") + }) + } +} + +// TestV2beta1ToV2alpha1FromOutputFiles tests conversion from v2beta1 output files back to v2alpha1 +// and compares with the original v2alpha1 input files to ensure the conversion is correct. +// This test takes files from output directory that are prefixed with "v2alpha1." and suffixed with ".v2beta1.json", +// converts them from v2beta1 to v2alpha1, and compares the result with the corresponding input file. +func TestV2beta1ToV2alpha1FromOutputFiles(t *testing.T) { + // Initialize the migrator with test providers + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) + + // Set up conversion scheme + scheme := runtime.NewScheme() + err := RegisterConversions(scheme, dsProvider, leProvider) + require.NoError(t, err) + + // Read all v2beta1 output files that were converted from v2alpha1 + outputDir := filepath.Join("testdata", "output") + files, err := os.ReadDir(outputDir) + require.NoError(t, err, "Failed to read output directory") + + for _, file := range files { + if file.IsDir() { + continue + } + + // Only process files that are prefixed with "v2alpha1." and suffixed with ".v2beta1.json" + // These are v2beta1 files that were converted from v2alpha1 input files + if !strings.HasPrefix(file.Name(), "v2alpha1.") || !strings.HasSuffix(file.Name(), ".v2beta1.json") { + continue + } + + // Extract the base name (e.g., "v2alpha1.complete" from "v2alpha1.complete.v2beta1.json") + baseName := strings.TrimSuffix(file.Name(), ".v2beta1.json") + // The corresponding input file should be "v2alpha1.complete.json" + expectedInputFile := baseName + ".json" + + t.Run(fmt.Sprintf("Convert_%s", file.Name()), func(t *testing.T) { + // Read the v2beta1 output file + v2beta1OutputFile := filepath.Join(outputDir, file.Name()) + // ignore gosec G304 as this function is only used in the test process + //nolint:gosec + v2beta1Data, err := os.ReadFile(v2beta1OutputFile) + require.NoError(t, err, "Failed to read v2beta1 output file") + + // Parse v2beta1 dashboard + var v2beta1 dashv2beta1.Dashboard + err = json.Unmarshal(v2beta1Data, &v2beta1) + require.NoError(t, err, "Failed to unmarshal v2beta1 dashboard") + + // Convert v2beta1 → v2alpha1 + var convertedV2alpha1 dashv2alpha1.Dashboard + err = scheme.Convert(&v2beta1, &convertedV2alpha1, nil) + require.NoError(t, err, "Failed to convert v2beta1 to v2alpha1") + + // Read the original v2alpha1 input file + inputDir := filepath.Join("testdata", "input") + expectedInputPath := filepath.Join(inputDir, expectedInputFile) + // ignore gosec G304 as this function is only used in the test process + //nolint:gosec + expectedInputData, err := os.ReadFile(expectedInputPath) + if err != nil { + t.Skipf("Skipping test: expected input file %s not found", expectedInputFile) + return + } + + // Parse expected v2alpha1 dashboard + var expectedV2alpha1 dashv2alpha1.Dashboard + err = json.Unmarshal(expectedInputData, &expectedV2alpha1) + require.NoError(t, err, "Failed to unmarshal expected v2alpha1 dashboard") + + // Compare statistics to ensure no data loss + expectedStats := collectStatsV2alpha1(expectedV2alpha1.Spec) + convertedStats := collectStatsV2alpha1(convertedV2alpha1.Spec) + + // Verify no data loss using statistics + assert.Equal(t, expectedStats.panelCount, convertedStats.panelCount, "Panel count mismatch") + assert.Equal(t, expectedStats.queryCount, convertedStats.queryCount, "Query count mismatch") + assert.Equal(t, expectedStats.annotationCount, convertedStats.annotationCount, "Annotation count mismatch") + assert.Equal(t, expectedStats.linkCount, convertedStats.linkCount, "Link count mismatch") + assert.Equal(t, expectedStats.variableCount, convertedStats.variableCount, "Variable count mismatch") + + // Compare the entire spec structures - they should be equal + assert.Equal(t, expectedV2alpha1.Spec, convertedV2alpha1.Spec, "Converted v2alpha1 spec should match expected v2alpha1 spec") + }) + } +} + +// TestV2beta1ToV2alpha1 tests the conversion logic for v2beta1 to v2alpha1. +// The conversion uses the Group field directly as the query kind and datasource type. +// No fallback mechanisms (provider lookup or UID inference) are used. +func TestV2beta1ToV2alpha1(t *testing.T) { + // Initialize the migrator with test providers + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + migration.Initialize(dsProvider, leProvider) + + // Set up conversion scheme + scheme := runtime.NewScheme() + err := RegisterConversions(scheme, dsProvider, leProvider) + require.NoError(t, err) + + testCases := []struct { + name string + createV2beta1 func() *dashv2beta1.Dashboard + validateV2alpha1 func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) + }{ + { + name: "dashboard with panels and queries - datasource extraction", + createV2beta1: func() *dashv2beta1.Dashboard { + return &dashv2beta1.Dashboard{ + Spec: dashv2beta1.DashboardSpec{ + Title: "Test Dashboard", + Elements: map[string]dashv2beta1.DashboardElement{ + "panel-1": { + PanelKind: &dashv2beta1.DashboardPanelKind{ + Kind: "Panel", + Spec: dashv2beta1.DashboardPanelSpec{ + Id: 1, + Title: "Test Panel", + Data: dashv2beta1.DashboardQueryGroupKind{ + Spec: dashv2beta1.DashboardQueryGroupSpec{ + Queries: []dashv2beta1.DashboardPanelQueryKind{ + { + Kind: "PanelQuery", + Spec: dashv2beta1.DashboardPanelQuerySpec{ + RefId: "A", + Hidden: false, + Query: dashv2beta1.DashboardDataQueryKind{ + Kind: "DataQuery", + Version: "v0", + Group: "prometheus", + Datasource: &dashv2beta1.DashboardV2beta1DataQueryKindDatasource{ + Name: stringPtr("prometheus-uid"), + }, + Spec: map[string]interface{}{ + "expr": "up", + }, + }, + }, + }, + }, + }, + }, + VizConfig: dashv2beta1.DashboardVizConfigKind{ + Kind: "VizConfig", + Group: "timeseries", + Version: "1.0.0", + Spec: dashv2beta1.DashboardVizConfigSpec{ + Options: map[string]interface{}{}, + }, + }, + }, + }, + }, + }, + }, + } + }, + validateV2alpha1: func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) { + assert.Equal(t, "Test Dashboard", v2alpha1.Spec.Title) + assert.NotNil(t, v2alpha1.Spec.Elements["panel-1"]) + panel := v2alpha1.Spec.Elements["panel-1"].PanelKind + require.NotNil(t, panel) + assert.Equal(t, float64(1), panel.Spec.Id) + assert.Equal(t, "Test Panel", panel.Spec.Title) + // Verify datasource was moved from query to panel query spec + require.Len(t, panel.Spec.Data.Spec.Queries, 1) + query := panel.Spec.Data.Spec.Queries[0] + assert.NotNil(t, query.Spec.Datasource) + assert.Equal(t, "prometheus-uid", *query.Spec.Datasource.Uid) + assert.Equal(t, "prometheus", *query.Spec.Datasource.Type) + // Verify query kind was extracted from group + assert.Equal(t, "prometheus", query.Spec.Query.Kind) + // Verify vizConfig was converted + assert.Equal(t, "timeseries", panel.Spec.VizConfig.Kind) + assert.Equal(t, "1.0.0", panel.Spec.VizConfig.Spec.PluginVersion) + }, + }, + { + name: "empty group in panel query - preserved as empty kind", + createV2beta1: func() *dashv2beta1.Dashboard { + return &dashv2beta1.Dashboard{ + Spec: dashv2beta1.DashboardSpec{ + Title: "Test Dashboard", + Elements: map[string]dashv2beta1.DashboardElement{ + "panel-1": { + PanelKind: &dashv2beta1.DashboardPanelKind{ + Kind: "Panel", + Spec: dashv2beta1.DashboardPanelSpec{ + Id: 1, + Title: "Test Panel", + Data: dashv2beta1.DashboardQueryGroupKind{ + Spec: dashv2beta1.DashboardQueryGroupSpec{ + Queries: []dashv2beta1.DashboardPanelQueryKind{ + { + Kind: "PanelQuery", + Spec: dashv2beta1.DashboardPanelQuerySpec{ + RefId: "A", + Hidden: false, + Query: dashv2beta1.DashboardDataQueryKind{ + Kind: "DataQuery", + Version: "v0", + Group: "", // Empty group + Spec: map[string]interface{}{ + "expr": "up", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + }, + validateV2alpha1: func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) { + panel := v2alpha1.Spec.Elements["panel-1"].PanelKind + require.NotNil(t, panel) + require.Len(t, panel.Spec.Data.Spec.Queries, 1) + query := panel.Spec.Data.Spec.Queries[0] + assert.Equal(t, "", query.Spec.Query.Kind, "Empty group should result in empty kind") + }, + }, + { + name: "dashboard with annotations - datasource extraction", + createV2beta1: func() *dashv2beta1.Dashboard { + return &dashv2beta1.Dashboard{ + Spec: dashv2beta1.DashboardSpec{ + Title: "Test Dashboard", + Annotations: []dashv2beta1.DashboardAnnotationQueryKind{ + { + Kind: "AnnotationQuery", + Spec: dashv2beta1.DashboardAnnotationQuerySpec{ + Name: "Test Annotation", + Enable: true, + Query: dashv2beta1.DashboardDataQueryKind{ + Kind: "DataQuery", + Version: "v0", + Group: "prometheus", + Datasource: &dashv2beta1.DashboardV2beta1DataQueryKindDatasource{ + Name: stringPtr("prometheus-uid"), + }, + Spec: map[string]interface{}{ + "expr": "up", + }, + }, + }, + }, + }, + }, + } + }, + validateV2alpha1: func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) { + require.Len(t, v2alpha1.Spec.Annotations, 1) + annotation := v2alpha1.Spec.Annotations[0] + assert.Equal(t, "Test Annotation", annotation.Spec.Name) + assert.True(t, annotation.Spec.Enable) + // Verify datasource was moved from query to annotation spec + assert.NotNil(t, annotation.Spec.Datasource) + assert.Equal(t, "prometheus-uid", *annotation.Spec.Datasource.Uid) + assert.Equal(t, "prometheus", *annotation.Spec.Datasource.Type) + // Verify query kind was extracted from group + require.NotNil(t, annotation.Spec.Query) + assert.Equal(t, "prometheus", annotation.Spec.Query.Kind) + }, + }, + { + name: "empty group in annotation query - preserved as empty kind", + createV2beta1: func() *dashv2beta1.Dashboard { + return &dashv2beta1.Dashboard{ + Spec: dashv2beta1.DashboardSpec{ + Title: "Test Dashboard", + Annotations: []dashv2beta1.DashboardAnnotationQueryKind{ + { + Kind: "AnnotationQuery", + Spec: dashv2beta1.DashboardAnnotationQuerySpec{ + Name: "Test Annotation", + Enable: true, + Query: dashv2beta1.DashboardDataQueryKind{ + Kind: "DataQuery", + Version: "v0", + Group: "", // Empty group + Spec: map[string]interface{}{ + "expr": "up", + }, + }, + }, + }, + }, + }, + } + }, + validateV2alpha1: func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) { + require.Len(t, v2alpha1.Spec.Annotations, 1) + annotation := v2alpha1.Spec.Annotations[0] + require.NotNil(t, annotation.Spec.Query) + assert.Equal(t, "", annotation.Spec.Query.Kind, "Empty group should result in empty kind") + }, + }, + { + name: "dashboard with query variable - datasource extraction", + createV2beta1: func() *dashv2beta1.Dashboard { + return &dashv2beta1.Dashboard{ + Spec: dashv2beta1.DashboardSpec{ + Title: "Test Dashboard", + Variables: []dashv2beta1.DashboardVariableKind{ + { + QueryVariableKind: &dashv2beta1.DashboardQueryVariableKind{ + Kind: "QueryVariable", + Spec: dashv2beta1.DashboardQueryVariableSpec{ + Name: "testVar", + Query: dashv2beta1.DashboardDataQueryKind{ + Kind: "DataQuery", + Version: "v0", + Group: "prometheus", + Datasource: &dashv2beta1.DashboardV2beta1DataQueryKindDatasource{ + Name: stringPtr("prometheus-uid"), + }, + Spec: map[string]interface{}{ + "expr": "label_values(up, instance)", + }, + }, + }, + }, + }, + }, + }, + } + }, + validateV2alpha1: func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) { + require.Len(t, v2alpha1.Spec.Variables, 1) + variable := v2alpha1.Spec.Variables[0] + require.NotNil(t, variable.QueryVariableKind) + assert.Equal(t, "testVar", variable.QueryVariableKind.Spec.Name) + // Verify datasource was moved from query to variable spec + assert.NotNil(t, variable.QueryVariableKind.Spec.Datasource) + assert.Equal(t, "prometheus-uid", *variable.QueryVariableKind.Spec.Datasource.Uid) + assert.Equal(t, "prometheus", *variable.QueryVariableKind.Spec.Datasource.Type) + // Verify query kind was extracted from group + assert.Equal(t, "prometheus", variable.QueryVariableKind.Spec.Query.Kind) + }, + }, + { + name: "empty group in query variable - preserved as empty kind", + createV2beta1: func() *dashv2beta1.Dashboard { + return &dashv2beta1.Dashboard{ + Spec: dashv2beta1.DashboardSpec{ + Title: "Test Dashboard", + Variables: []dashv2beta1.DashboardVariableKind{ + { + QueryVariableKind: &dashv2beta1.DashboardQueryVariableKind{ + Kind: "QueryVariable", + Spec: dashv2beta1.DashboardQueryVariableSpec{ + Name: "testVar", + Query: dashv2beta1.DashboardDataQueryKind{ + Kind: "DataQuery", + Version: "v0", + Group: "", // Empty group + Spec: map[string]interface{}{ + "expr": "label_values(up, instance)", + }, + }, + }, + }, + }, + }, + }, + } + }, + validateV2alpha1: func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) { + require.Len(t, v2alpha1.Spec.Variables, 1) + variable := v2alpha1.Spec.Variables[0] + require.NotNil(t, variable.QueryVariableKind) + assert.Equal(t, "", variable.QueryVariableKind.Spec.Query.Kind, "Empty group should result in empty kind") + }, + }, + { + name: "dashboard with rows layout", + createV2beta1: func() *dashv2beta1.Dashboard { + return &dashv2beta1.Dashboard{ + Spec: dashv2beta1.DashboardSpec{ + Title: "Test Dashboard", + Elements: map[string]dashv2beta1.DashboardElement{ + "panel-1": { + PanelKind: &dashv2beta1.DashboardPanelKind{ + Kind: "Panel", + Spec: dashv2beta1.DashboardPanelSpec{ + Id: 1, + Title: "Panel 1", + }, + }, + }, + }, + Layout: dashv2beta1.DashboardGridLayoutKindOrRowsLayoutKindOrAutoGridLayoutKindOrTabsLayoutKind{ + RowsLayoutKind: &dashv2beta1.DashboardRowsLayoutKind{ + Kind: "RowsLayout", + Spec: dashv2beta1.DashboardRowsLayoutSpec{ + Rows: []dashv2beta1.DashboardRowsLayoutRowKind{ + { + Kind: "RowsLayoutRow", + Spec: dashv2beta1.DashboardRowsLayoutRowSpec{ + Title: stringPtr("Row 1"), + Collapse: boolPtr(false), + Layout: dashv2beta1.DashboardGridLayoutKindOrAutoGridLayoutKindOrTabsLayoutKindOrRowsLayoutKind{ + GridLayoutKind: &dashv2beta1.DashboardGridLayoutKind{ + Kind: "GridLayout", + Spec: dashv2beta1.DashboardGridLayoutSpec{ + Items: []dashv2beta1.DashboardGridLayoutItemKind{ + { + Kind: "GridLayoutItem", + Spec: dashv2beta1.DashboardGridLayoutItemSpec{ + Element: dashv2beta1.DashboardElementReference{ + Kind: "ElementReference", + Name: "panel-1", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + }, + validateV2alpha1: func(t *testing.T, v2alpha1 *dashv2alpha1.Dashboard) { + require.NotNil(t, v2alpha1.Spec.Layout.RowsLayoutKind) + require.Len(t, v2alpha1.Spec.Layout.RowsLayoutKind.Spec.Rows, 1) + row := v2alpha1.Spec.Layout.RowsLayoutKind.Spec.Rows[0] + assert.Equal(t, "Row 1", *row.Spec.Title) + assert.False(t, *row.Spec.Collapse) + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + // Create v2beta1 dashboard + v2beta1 := tc.createV2beta1() + + // Collect original statistics + originalStats := collectStatsV2beta1(v2beta1.Spec) + + // Convert to v2alpha1 + var v2alpha1 dashv2alpha1.Dashboard + err := scheme.Convert(v2beta1, &v2alpha1, nil) + require.NoError(t, err, "Failed to convert v2beta1 to v2alpha1") + + // Collect v2alpha1 statistics + v2alpha1Stats := collectStatsV2alpha1(v2alpha1.Spec) + + // Verify no data loss + err = detectConversionDataLoss(originalStats, v2alpha1Stats, "V2beta1", "V2alpha1") + assert.NoError(t, err, "Data loss detected in conversion") + + // Run custom validation + tc.validateV2alpha1(t, &v2alpha1) + }) + } +} + +// Helper function to create string pointer +func stringPtr(s string) *string { + return &s +} + +// Helper function to create bool pointer +func boolPtr(b bool) *bool { + return &b +} diff --git a/apps/dashboard/pkg/migration/migrate.go b/apps/dashboard/pkg/migration/migrate.go index cce80cfe209..9c87a45b2db 100644 --- a/apps/dashboard/pkg/migration/migrate.go +++ b/apps/dashboard/pkg/migration/migrate.go @@ -9,8 +9,8 @@ import ( ) // Initialize provides the migrator singleton with required dependencies and builds the map of migrations. -func Initialize(dsIndexProvider schemaversion.DataSourceIndexProvider) { - migratorInstance.init(dsIndexProvider) +func Initialize(dsIndexProvider schemaversion.DataSourceIndexProvider, leIndexProvider schemaversion.LibraryElementIndexProvider) { + migratorInstance.init(dsIndexProvider, leIndexProvider) } // GetDataSourceIndexProvider returns the datasource index provider instance that was initialized. @@ -20,12 +20,20 @@ func GetDataSourceIndexProvider() schemaversion.DataSourceIndexProvider { return migratorInstance.dsIndexProvider } +// GetLibraryElementIndexProvider returns the library element index provider instance that was initialized. +func GetLibraryElementIndexProvider() schemaversion.LibraryElementIndexProvider { + // Wait for initialization to complete + <-migratorInstance.ready + return migratorInstance.leIndexProvider +} + // ResetForTesting resets the migrator singleton for testing purposes. func ResetForTesting() { migratorInstance = &migrator{ migrations: map[int]schemaversion.SchemaVersionMigrationFunc{}, ready: make(chan struct{}), dsIndexProvider: nil, + leIndexProvider: nil, } initOnce = sync.Once{} } @@ -48,12 +56,14 @@ type migrator struct { ready chan struct{} migrations map[int]schemaversion.SchemaVersionMigrationFunc dsIndexProvider schemaversion.DataSourceIndexProvider + leIndexProvider schemaversion.LibraryElementIndexProvider } -func (m *migrator) init(dsIndexProvider schemaversion.DataSourceIndexProvider) { +func (m *migrator) init(dsIndexProvider schemaversion.DataSourceIndexProvider, leIndexProvider schemaversion.LibraryElementIndexProvider) { initOnce.Do(func() { m.dsIndexProvider = dsIndexProvider - m.migrations = schemaversion.GetMigrations(dsIndexProvider) + m.leIndexProvider = leIndexProvider + m.migrations = schemaversion.GetMigrations(dsIndexProvider, leIndexProvider) close(m.ready) }) } diff --git a/apps/dashboard/pkg/migration/migrate_test.go b/apps/dashboard/pkg/migration/migrate_test.go index 5e993624e09..8bb150f91ca 100644 --- a/apps/dashboard/pkg/migration/migrate_test.go +++ b/apps/dashboard/pkg/migration/migrate_test.go @@ -29,7 +29,9 @@ const DEV_DASHBOARDS_OUTPUT_DIR = "testdata/dev-dashboards-output" func TestMigrate(t *testing.T) { // Reset the migration singleton and use the same datasource provider as the frontend test to ensure consistency ResetForTesting() - Initialize(migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)) + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + Initialize(dsProvider, leProvider) t.Run("minimum version check", func(t *testing.T) { err := Migrate(context.Background(), map[string]interface{}{ @@ -45,7 +47,9 @@ func TestMigrate(t *testing.T) { func TestMigrateSingleVersion(t *testing.T) { // Use the same datasource provider as the frontend test to ensure consistency - Initialize(migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)) + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + Initialize(dsProvider, leProvider) runSingleVersionMigrationTests(t, SINGLE_VERSION_OUTPUT_DIR) } @@ -212,7 +216,9 @@ func loadDashboard(t *testing.T, path string) map[string]interface{} { // TestSchemaMigrationMetrics tests that schema migration metrics are recorded correctly func TestSchemaMigrationMetrics(t *testing.T) { // Initialize migration with test providers - Initialize(migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)) + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + Initialize(dsProvider, leProvider) // Create a test registry for metrics registry := prometheus.NewRegistry() @@ -296,7 +302,9 @@ func TestSchemaMigrationMetrics(t *testing.T) { // TestSchemaMigrationLogging tests that schema migration logging works correctly func TestSchemaMigrationLogging(t *testing.T) { - Initialize(migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig)) + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.StandardTestConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + Initialize(dsProvider, leProvider) tests := []struct { name string @@ -413,7 +421,9 @@ func TestMigrateDevDashboards(t *testing.T) { // Reset the migration singleton and use the dev dashboard datasource provider // to match the frontend devDashboardDataSources configuration ResetForTesting() - Initialize(migrationtestutil.NewDataSourceProvider(migrationtestutil.DevDashboardConfig)) + dsProvider := migrationtestutil.NewDataSourceProvider(migrationtestutil.DevDashboardConfig) + leProvider := migrationtestutil.NewLibraryElementProvider() + Initialize(dsProvider, leProvider) runDevDashboardMigrationTests(t, schemaversion.LATEST_VERSION, DEV_DASHBOARDS_OUTPUT_DIR) } diff --git a/apps/dashboard/pkg/migration/schemaversion/migrations.go b/apps/dashboard/pkg/migration/schemaversion/migrations.go index 0a7be846474..3e55b25b55c 100644 --- a/apps/dashboard/pkg/migration/schemaversion/migrations.go +++ b/apps/dashboard/pkg/migration/schemaversion/migrations.go @@ -27,12 +27,27 @@ type DataSourceIndexProvider interface { Index(ctx context.Context) *DatasourceIndex } +type LibraryElementInfo struct { + UID string + Name string + Kind int64 + Type string + Description string + FolderUID string +} + +type LibraryElementIndexProvider interface { + + // GetLibraryElementInfo returns library element information for use in migrations. + GetLibraryElementInfo(ctx context.Context) []LibraryElementInfo +} + type PanelPluginInfo struct { ID string Version string } -func GetMigrations(dsIndexProvider DataSourceIndexProvider) map[int]SchemaVersionMigrationFunc { +func GetMigrations(dsIndexProvider DataSourceIndexProvider, _ LibraryElementIndexProvider) map[int]SchemaVersionMigrationFunc { return map[int]SchemaVersionMigrationFunc{ 2: V2, 3: V3, diff --git a/apps/dashboard/pkg/migration/testdata/input/v15.no-op-migration.json b/apps/dashboard/pkg/migration/testdata/input/v15.no-op-migration.json index df3a62e6dae..d8fc5361f11 100644 --- a/apps/dashboard/pkg/migration/testdata/input/v15.no-op-migration.json +++ b/apps/dashboard/pkg/migration/testdata/input/v15.no-op-migration.json @@ -32,7 +32,9 @@ { "name": "server", "type": "query", - "datasource": "prometheus", + "datasource": { + "type": "prometheus" + }, "query": "label_values(server)", "refresh": 1, "options": [] diff --git a/apps/dashboard/pkg/migration/testdata/output/latest_version/v15.no-op-migration.v42.json b/apps/dashboard/pkg/migration/testdata/output/latest_version/v15.no-op-migration.v42.json index e9eaff02aa7..065fe792748 100644 --- a/apps/dashboard/pkg/migration/testdata/output/latest_version/v15.no-op-migration.v42.json +++ b/apps/dashboard/pkg/migration/testdata/output/latest_version/v15.no-op-migration.v42.json @@ -89,7 +89,9 @@ "templating": { "list": [ { - "datasource": "prometheus", + "datasource": { + "type": "prometheus" + }, "name": "server", "options": [], "query": "label_values(server)", diff --git a/apps/dashboard/pkg/migration/testdata/output/single_version/v15.no-op-migration.v15.json b/apps/dashboard/pkg/migration/testdata/output/single_version/v15.no-op-migration.v15.json index d66d7d9aed4..bb4b0b51341 100644 --- a/apps/dashboard/pkg/migration/testdata/output/single_version/v15.no-op-migration.v15.json +++ b/apps/dashboard/pkg/migration/testdata/output/single_version/v15.no-op-migration.v15.json @@ -58,7 +58,9 @@ "templating": { "list": [ { - "datasource": "prometheus", + "datasource": { + "type": "prometheus" + }, "name": "server", "options": [], "query": "label_values(server)", diff --git a/apps/dashboard/pkg/migration/testutil/mocks.go b/apps/dashboard/pkg/migration/testutil/mocks.go index 49c1df0f403..6c8b4709137 100644 --- a/apps/dashboard/pkg/migration/testutil/mocks.go +++ b/apps/dashboard/pkg/migration/testutil/mocks.go @@ -6,6 +6,19 @@ import ( "github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion" ) +// EmptyLibraryElementProvider provides an empty library element list for tests +type EmptyLibraryElementProvider struct{} + +// NewLibraryElementProvider creates a new empty library element provider for tests +func NewLibraryElementProvider() *EmptyLibraryElementProvider { + return &EmptyLibraryElementProvider{} +} + +// GetLibraryElementInfo returns an empty list for tests +func (p *EmptyLibraryElementProvider) GetLibraryElementInfo(_ context.Context) []schemaversion.LibraryElementInfo { + return []schemaversion.LibraryElementInfo{} +} + // DataSourceConfig defines different test configurations type DataSourceConfig string diff --git a/apps/example/go.mod b/apps/example/go.mod index 7b5d1783cf7..acb714107b3 100644 --- a/apps/example/go.mod +++ b/apps/example/go.mod @@ -35,7 +35,7 @@ require ( github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f // indirect - github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 // indirect + github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 // indirect github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -56,7 +56,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/spf13/pflag v1.0.10 // indirect @@ -75,7 +75,7 @@ require ( go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.44.0 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/example/go.sum b/apps/example/go.sum index 837151cf605..00f1a6a2620 100644 --- a/apps/example/go.sum +++ b/apps/example/go.sum @@ -52,8 +52,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f h1:Cbm6OKkOcJ+7CSZsGsEJzktC/SIa5bxVeYKQLuYK86o= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f/go.mod h1:axY0cdOg3q0TZHwpHnIz5x16xZ8ZBxJHShsSHHXcHQg= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 h1:qEwZ+7MbPjzRvTi31iT9w7NBhKIpKwZrFbYmOZLqkwA= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 h1:Muoy+FMGrHj3GdFbvsMzUT7eusgii9PKf9L1ZaXDDbY= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 h1:jSojuc7njleS3UOz223WDlXOinmuLAIPI0z2vtq8EgI= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4/go.mod h1:VahT+GtfQIM+o8ht2StR6J9g+Ef+C2Vokh5uuSmOD/4= github.com/grafana/grafana-app-sdk v0.48.2 h1:CQQDhwo1fWaXQVKvxxOcK6azbuY3E2TgJHNAZlYYn7U= @@ -116,8 +116,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/folder/go.mod b/apps/folder/go.mod index 29948f31b83..1c9249745a9 100644 --- a/apps/folder/go.mod +++ b/apps/folder/go.mod @@ -40,7 +40,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.11.1 // indirect @@ -51,7 +51,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect golang.org/x/text v0.31.0 // indirect diff --git a/apps/folder/go.sum b/apps/folder/go.sum index f795f67e514..944e0d69721 100644 --- a/apps/folder/go.sum +++ b/apps/folder/go.sum @@ -85,8 +85,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -128,8 +128,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/iam/go.mod b/apps/iam/go.mod index 8db0429adcd..adb3755c58f 100644 --- a/apps/iam/go.mod +++ b/apps/iam/go.mod @@ -46,7 +46,7 @@ replace github.com/prometheus/alertmanager => github.com/grafana/prometheus-aler require ( github.com/grafana/grafana v0.0.0-00010101000000-000000000000 - github.com/grafana/grafana-app-sdk v0.48.1 + github.com/grafana/grafana-app-sdk v0.48.2 github.com/grafana/grafana-app-sdk/logging v0.48.1 github.com/grafana/grafana/apps/folder v0.0.0 github.com/grafana/grafana/pkg/apimachinery v0.0.0 @@ -231,12 +231,12 @@ require ( github.com/gorilla/mux v1.8.1 // indirect github.com/grafana/alerting v0.0.0-20251009192429-9427c24835ae // indirect github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f // indirect - github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 // indirect + github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 // indirect github.com/grafana/dataplane/sdata v0.0.9 // indirect github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 // indirect github.com/grafana/grafana-aws-sdk v1.3.0 // indirect github.com/grafana/grafana-azure-sdk-go/v2 v2.3.1 // indirect - github.com/grafana/grafana-plugin-sdk-go v0.281.0 // indirect + github.com/grafana/grafana-plugin-sdk-go v0.283.0 // indirect github.com/grafana/grafana/apps/dashboard v0.0.0 // indirect github.com/grafana/grafana/apps/plugins v0.0.0 // indirect github.com/grafana/grafana/apps/provisioning v0.0.0 // indirect @@ -251,7 +251,7 @@ require ( github.com/grafana/sqlds/v4 v4.2.7 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/hashicorp/consul/api v1.31.2 // indirect @@ -349,7 +349,7 @@ require ( github.com/pressly/goose/v3 v3.25.0 // indirect github.com/prometheus/alertmanager v0.28.0 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.2 // indirect github.com/prometheus/common/sigv4 v0.1.0 // indirect github.com/prometheus/exporter-toolkit v0.14.0 // indirect github.com/prometheus/procfs v0.16.1 // indirect @@ -425,18 +425,18 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect gocloud.dev v0.43.0 // indirect - golang.org/x/crypto v0.43.0 // indirect + golang.org/x/crypto v0.44.0 // indirect golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9 // indirect - golang.org/x/mod v0.29.0 // indirect - golang.org/x/net v0.46.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect - golang.org/x/sync v0.17.0 // indirect - golang.org/x/sys v0.37.0 // indirect - golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 // indirect - golang.org/x/term v0.36.0 // indirect - golang.org/x/text v0.30.0 // indirect + golang.org/x/mod v0.30.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect + golang.org/x/sync v0.18.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54 // indirect + golang.org/x/term v0.37.0 // indirect + golang.org/x/text v0.31.0 // indirect golang.org/x/time v0.14.0 // indirect - golang.org/x/tools v0.38.0 // indirect + golang.org/x/tools v0.39.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect gonum.org/v1/gonum v0.16.0 // indirect diff --git a/apps/iam/go.sum b/apps/iam/go.sum index 31148a98766..b23eb7f0e4d 100644 --- a/apps/iam/go.sum +++ b/apps/iam/go.sum @@ -839,6 +839,8 @@ github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f h1:Cbm6OKkOcJ+7CSZ github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f/go.mod h1:axY0cdOg3q0TZHwpHnIz5x16xZ8ZBxJHShsSHHXcHQg= github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 h1:qEwZ+7MbPjzRvTi31iT9w7NBhKIpKwZrFbYmOZLqkwA= github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 h1:Muoy+FMGrHj3GdFbvsMzUT7eusgii9PKf9L1ZaXDDbY= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= github.com/grafana/dataplane/examples v0.0.1 h1:K9M5glueWyLoL4//H+EtTQq16lXuHLmOhb6DjSCahzA= github.com/grafana/dataplane/examples v0.0.1/go.mod h1:h5YwY8s407/17XF5/dS8XrUtsTVV2RnuW8+m1Mp46mg= github.com/grafana/dataplane/sdata v0.0.9 h1:AGL1LZnCUG4MnQtnWpBPbQ8ZpptaZs14w6kE/MWfg7s= @@ -853,6 +855,7 @@ github.com/grafana/gomemcache v0.0.0-20250828162811-a96f6acee2fe h1:q+QaVANzNZxv github.com/grafana/gomemcache v0.0.0-20250828162811-a96f6acee2fe/go.mod h1:j/s0jkda4UXTemDs7Pgw/vMT06alWc42CHisvYac0qw= github.com/grafana/grafana-app-sdk v0.48.1 h1:bKJadWH18WCpJ+Zk8AezRFXCcZgGredRv+fRS+8zkek= github.com/grafana/grafana-app-sdk v0.48.1/go.mod h1:5LljCz+wvmGfkQ8ZKTOfserhtXNEF0cSFthoWShvN6c= +github.com/grafana/grafana-app-sdk v0.48.2/go.mod h1:LDOvQ7OOyHLcXdSa0InATCa5OMoYAd6E1+rGLrMgHuk= github.com/grafana/grafana-app-sdk/logging v0.48.1 h1:veM0X5LAPyN3KsDLglWjIofndbGuf7MqnrDuDN+F/Ng= github.com/grafana/grafana-app-sdk/logging v0.48.1/go.mod h1:Gh/nBWnspK3oDNWtiM5qUF/fardHzOIEez+SPI3JeHA= github.com/grafana/grafana-aws-sdk v1.3.0 h1:/bfJzP93rCel1GbWoRSq0oUo424MZXt8jAp2BK9w8tM= @@ -867,6 +870,7 @@ github.com/grafana/grafana-openapi-client-go v0.0.0-20231213163343-bd475d63fb79 github.com/grafana/grafana-openapi-client-go v0.0.0-20231213163343-bd475d63fb79/go.mod h1:wc6Hbh3K2TgCUSfBC/BOzabItujtHMESZeFk5ZhdxhQ= github.com/grafana/grafana-plugin-sdk-go v0.281.0 h1:V8dGyatzcOLQeivFhBV2JWMwTSZH/clDnpfKG9p3dTA= github.com/grafana/grafana-plugin-sdk-go v0.281.0/go.mod h1:3I0g+v6jAwVmrt6BEjDUP4V6pkhGP5QKY5NkXY4Ayr4= +github.com/grafana/grafana-plugin-sdk-go v0.283.0/go.mod h1:20qhoYxIgbZRmwCEO1KMP8q2yq/Kge5+xE/99/hLEk0= github.com/grafana/grafana/apps/example v0.0.0-20251027162426-edef69fdc82b h1:6Bo65etvjQ4tStkaA5+N3A3ENbO4UAWj53TxF6g2Hdk= github.com/grafana/grafana/apps/example v0.0.0-20251027162426-edef69fdc82b/go.mod h1:6+wASOCN8LWt6FJ8dc0oODUBIEY5XHaE6ABi8g0mR+k= github.com/grafana/grafana/pkg/promlib v0.0.8 h1:VUWsqttdf0wMI4j9OX9oNrykguQpZcruudDAFpJJVw0= @@ -901,6 +905,7 @@ github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 h1:sGm2vDRFUrQJO/Veii4h4zG2vvqG6uWNkBHSTqXOZk0= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2/go.mod h1:wd1YpapPLivG6nQgbf7ZkG1hhSOXDhhn4MLTknx2aAc= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 h1:uGoIog/wiQHI9GAxXO5TJbT0wWKH3O9HhOJW1F9c3fY= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340/go.mod h1:3bDW6wMZJB7tiONtC/1Xpicra6Wp5GgbTbQWCbI5fkc= @@ -1374,6 +1379,7 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9 github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.2/go.mod h1:63W3KZb1JOKgcjlIr64WW/LvFGAqKPj0atm+knVGEko= github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/exporter-toolkit v0.14.0 h1:NMlswfibpcZZ+H0sZBiTjrA3/aBFHkNZqE+iCj5EmRg= @@ -1730,6 +1736,7 @@ golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= +golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1773,6 +1780,7 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA= golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w= +golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1829,6 +1837,7 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1853,6 +1862,7 @@ golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1867,6 +1877,7 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220513210516-0976fa681c29/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1961,12 +1972,15 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 h1:LvzTn0GQhWuvKH/kVRS3R3bVAsdQWI7hvfLHGgh9+lU= golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8/go.mod h1:Pi4ztBfryZoJEkyFTI5/Ocsu2jXyDr6iSdgJiYE/uwE= +golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54/go.mod h1:hKdjCMrbv9skySur+Nek8Hd0uJ0GuxJIoIX2payrIdQ= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= +golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1978,6 +1992,7 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2046,6 +2061,7 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ= golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs= +golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ= golang.org/x/tools/godoc v0.1.0-deprecated h1:o+aZ1BOj6Hsx/GBdJO/s815sqftjSnrZZwyYTHODvtk= golang.org/x/tools/godoc v0.1.0-deprecated/go.mod h1:qM63CriJ961IHWmnWa9CjZnBndniPt4a3CK0PVB9bIg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -2305,20 +2321,27 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM= k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk= +k8s.io/api v0.34.2/go.mod h1:MMBPaWlED2a8w4RSeanD76f7opUoypY8TFYkSM+3XHw= k8s.io/apiextensions-apiserver v0.34.1 h1:NNPBva8FNAPt1iSVwIE0FsdrVriRXMsaWFMqJbII2CI= k8s.io/apiextensions-apiserver v0.34.1/go.mod h1:hP9Rld3zF5Ay2Of3BeEpLAToP+l4s5UlxiHfqRaRcMc= +k8s.io/apiextensions-apiserver v0.34.2/go.mod h1:398CJrsgXF1wytdaanynDpJ67zG4Xq7yj91GrmYN2SE= k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4= k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +k8s.io/apimachinery v0.34.2/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= k8s.io/apiserver v0.34.1 h1:U3JBGdgANK3dfFcyknWde1G6X1F4bg7PXuvlqt8lITA= k8s.io/apiserver v0.34.1/go.mod h1:eOOc9nrVqlBI1AFCvVzsob0OxtPZUCPiUJL45JOTBG0= +k8s.io/apiserver v0.34.2/go.mod h1:gqJQy2yDOB50R3JUReHSFr+cwJnL8G1dzTA0YLEqAPI= k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY= k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8= +k8s.io/client-go v0.34.2/go.mod h1:2VYDl1XXJsdcAxw7BenFslRQX28Dxz91U9MWKjX97fE= k8s.io/component-base v0.34.1 h1:v7xFgG+ONhytZNFpIz5/kecwD+sUhVE6HU7qQUiRM4A= k8s.io/component-base v0.34.1/go.mod h1:mknCpLlTSKHzAQJJnnHVKqjxR7gBeHRv0rPXA7gdtQ0= +k8s.io/component-base v0.34.2/go.mod h1:9xw2FHJavUHBFpiGkZoKuYZ5pdtLKe97DEByaA+hHbM= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kms v0.34.1 h1:iCFOvewDPzWM9fMTfyIPO+4MeuZ0tcZbugxLNSHFG4w= k8s.io/kms v0.34.1/go.mod h1:s1CFkLG7w9eaTYvctOxosx88fl4spqmixnNpys0JAtM= +k8s.io/kms v0.34.2/go.mod h1:s1CFkLG7w9eaTYvctOxosx88fl4spqmixnNpys0JAtM= k8s.io/kube-aggregator v0.34.1 h1:WNLV0dVNoFKmuyvdWLd92iDSyD/TSTjqwaPj0U9XAEU= k8s.io/kube-aggregator v0.34.1/go.mod h1:RU8j+5ERfp0h+gIvWtxRPfsa5nK7rboDm8RST8BJfYQ= k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= diff --git a/apps/investigations/go.mod b/apps/investigations/go.mod index 11acc87bbc2..d4f3685a2aa 100644 --- a/apps/investigations/go.mod +++ b/apps/investigations/go.mod @@ -50,7 +50,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -69,7 +69,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/investigations/go.sum b/apps/investigations/go.sum index b15ac884e9a..7eadc30e628 100644 --- a/apps/investigations/go.sum +++ b/apps/investigations/go.sum @@ -104,8 +104,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -165,8 +165,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/logsdrilldown/go.mod b/apps/logsdrilldown/go.mod index 014a0c5bd95..712d99405d0 100644 --- a/apps/logsdrilldown/go.mod +++ b/apps/logsdrilldown/go.mod @@ -51,7 +51,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -70,7 +70,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/logsdrilldown/go.sum b/apps/logsdrilldown/go.sum index b15ac884e9a..7eadc30e628 100644 --- a/apps/logsdrilldown/go.sum +++ b/apps/logsdrilldown/go.sum @@ -104,8 +104,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -165,8 +165,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/playlist/go.mod b/apps/playlist/go.mod index be65bd498a1..8a254e980d1 100644 --- a/apps/playlist/go.mod +++ b/apps/playlist/go.mod @@ -51,7 +51,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect @@ -70,7 +70,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/playlist/go.sum b/apps/playlist/go.sum index b15ac884e9a..7eadc30e628 100644 --- a/apps/playlist/go.sum +++ b/apps/playlist/go.sum @@ -104,8 +104,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -165,8 +165,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/plugins/go.mod b/apps/plugins/go.mod index ece0c3eaeaf..b24c9260327 100644 --- a/apps/plugins/go.mod +++ b/apps/plugins/go.mod @@ -37,7 +37,7 @@ require ( github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f // indirect - github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 // indirect + github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 // indirect github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -58,7 +58,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/spf13/pflag v1.0.10 // indirect @@ -77,7 +77,7 @@ require ( go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.44.0 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/plugins/go.sum b/apps/plugins/go.sum index 2e25d0f885f..b769fbe3916 100644 --- a/apps/plugins/go.sum +++ b/apps/plugins/go.sum @@ -52,8 +52,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f h1:Cbm6OKkOcJ+7CSZsGsEJzktC/SIa5bxVeYKQLuYK86o= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f/go.mod h1:axY0cdOg3q0TZHwpHnIz5x16xZ8ZBxJHShsSHHXcHQg= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 h1:qEwZ+7MbPjzRvTi31iT9w7NBhKIpKwZrFbYmOZLqkwA= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 h1:Muoy+FMGrHj3GdFbvsMzUT7eusgii9PKf9L1ZaXDDbY= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 h1:jSojuc7njleS3UOz223WDlXOinmuLAIPI0z2vtq8EgI= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4/go.mod h1:VahT+GtfQIM+o8ht2StR6J9g+Ef+C2Vokh5uuSmOD/4= github.com/grafana/grafana-app-sdk v0.48.2 h1:CQQDhwo1fWaXQVKvxxOcK6azbuY3E2TgJHNAZlYYn7U= @@ -116,8 +116,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/plugins/kinds/plugin.cue b/apps/plugins/kinds/plugin.cue index 4f381082969..50c475cd430 100644 --- a/apps/plugins/kinds/plugin.cue +++ b/apps/plugins/kinds/plugin.cue @@ -13,7 +13,7 @@ pluginV0Alpha1: { id: string version: string url?: string - class: "core" | "external" | "cdn" + class: "core" | "external" } } routes: { @@ -233,4 +233,4 @@ pluginV0Alpha1: { title?: string description?: string }] -} \ No newline at end of file +} diff --git a/apps/plugins/pkg/apis/plugins/v0alpha1/plugin_spec_gen.go b/apps/plugins/pkg/apis/plugins/v0alpha1/plugin_spec_gen.go index d46a0a4aed1..9ae14bcbdc5 100644 --- a/apps/plugins/pkg/apis/plugins/v0alpha1/plugin_spec_gen.go +++ b/apps/plugins/pkg/apis/plugins/v0alpha1/plugin_spec_gen.go @@ -21,5 +21,4 @@ type PluginSpecClass string const ( PluginSpecClassCore PluginSpecClass = "core" PluginSpecClassExternal PluginSpecClass = "external" - PluginSpecClassCdn PluginSpecClass = "cdn" ) diff --git a/apps/plugins/pkg/apis/plugins_manifest.go b/apps/plugins/pkg/apis/plugins_manifest.go index 428971aa0b5..09c57eaa186 100644 --- a/apps/plugins/pkg/apis/plugins_manifest.go +++ b/apps/plugins/pkg/apis/plugins_manifest.go @@ -20,7 +20,7 @@ import ( ) var ( - rawSchemaPluginv0alpha1 = []byte(`{"OperatorState":{"additionalProperties":false,"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"details contains any extra information that is operator-specific","type":"object"},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"Plugin":{"properties":{"spec":{"$ref":"#/components/schemas/spec"},"status":{"$ref":"#/components/schemas/status"}},"required":["spec"]},"getMetaDependencies":{"type":"object","required":["grafanaDependency"],"properties":{"extensions":{"type":"object","properties":{"exposedComponents":{"description":"+listType=set","type":"array","items":{"type":"string"}}},"additionalProperties":false},"grafanaDependency":{"description":"Required field","type":"string"},"grafanaVersion":{"description":"Optional fields","type":"string"},"plugins":{"description":"+listType=set\n+listMapKey=id","type":"array","items":{"type":"object","required":["id","type","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["app","datasource","panel"]}},"additionalProperties":false}}},"additionalProperties":false},"getMetaEnterpriseFeatures":{"type":"object","properties":{"healthDiagnosticsErrors":{"description":"Allow additional properties","type":"boolean","default":false}},"additionalProperties":false},"getMetaExtensions":{"type":"object","properties":{"addedComponents":{"description":"+listType=atomic","type":"array","items":{"type":"object","required":["targets","title"],"properties":{"description":{"type":"string"},"targets":{"description":"+listType=set","type":"array","items":{"type":"string"}},"title":{"type":"string"}},"additionalProperties":false}},"addedLinks":{"description":"+listType=atomic","type":"array","items":{"type":"object","required":["targets","title"],"properties":{"description":{"type":"string"},"targets":{"description":"+listType=set","type":"array","items":{"type":"string"}},"title":{"type":"string"}},"additionalProperties":false}},"exposedComponents":{"description":"+listType=set\n+listMapKey=id","type":"array","items":{"type":"object","required":["id"],"properties":{"description":{"type":"string"},"id":{"type":"string"},"title":{"type":"string"}},"additionalProperties":false}},"extensionPoints":{"description":"+listType=set\n+listMapKey=id","type":"array","items":{"type":"object","required":["id"],"properties":{"description":{"type":"string"},"id":{"type":"string"},"title":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"getMetaIAM":{"type":"object","properties":{"permissions":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"scope":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"getMetaInclude":{"type":"object","properties":{"action":{"type":"string"},"addToNav":{"type":"boolean"},"component":{"type":"string"},"defaultNav":{"type":"boolean"},"icon":{"type":"string"},"name":{"type":"string"},"path":{"type":"string"},"role":{"type":"string","enum":["Admin","Editor","Viewer"]},"type":{"type":"string","enum":["dashboard","page","panel","datasource"]},"uid":{"type":"string"}},"additionalProperties":false},"getMetaInfo":{"type":"object","required":["keywords","logos","updated","version"],"properties":{"author":{"description":"Optional fields","type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"}},"additionalProperties":false},"description":{"type":"string"},"keywords":{"description":"Required fields\n+listType=set","type":"array","items":{"type":"string"}},"links":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}},"additionalProperties":false}},"logos":{"type":"object","required":["small","large"],"properties":{"large":{"type":"string"},"small":{"type":"string"}},"additionalProperties":false},"screenshots":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"path":{"type":"string"}},"additionalProperties":false}},"updated":{"type":"string","format":"date-time"},"version":{"type":"string"}},"additionalProperties":false},"getMetaQueryOptions":{"type":"object","properties":{"cacheTimeout":{"type":"boolean"},"maxDataPoints":{"type":"boolean"},"minInterval":{"type":"boolean"}},"additionalProperties":false},"getMetaRole":{"type":"object","properties":{"grants":{"description":"+listType=set","type":"array","items":{"type":"string"}},"role":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"permissions":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"scope":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false},"getMetaRoute":{"type":"object","properties":{"body":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{}}},"headers":{"description":"+listType=atomic","type":"array","items":{"type":"string"}},"jwtTokenAuth":{"type":"object","properties":{"params":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{}}},"scopes":{"description":"+listType=set","type":"array","items":{"type":"string"}},"url":{"type":"string"}},"additionalProperties":false},"method":{"type":"string"},"path":{"type":"string"},"reqAction":{"type":"string"},"reqRole":{"type":"string"},"reqSignedIn":{"type":"boolean"},"tokenAuth":{"type":"object","properties":{"params":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{}}},"scopes":{"description":"+listType=set","type":"array","items":{"type":"string"}},"url":{"type":"string"}},"additionalProperties":false},"url":{"type":"string"},"urlParams":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"content":{"type":"string"},"name":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"spec":{"additionalProperties":false,"properties":{"class":{"enum":["core","external","cdn"],"type":"string"},"id":{"type":"string"},"url":{"type":"string"},"version":{"type":"string"}},"required":["id","version","class"],"type":"object"},"status":{"additionalProperties":false,"properties":{"additionalFields":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"additionalFields is reserved for future use","type":"object"},"operatorStates":{"additionalProperties":{"$ref":"#/components/schemas/OperatorState"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object"}}`) + rawSchemaPluginv0alpha1 = []byte(`{"OperatorState":{"additionalProperties":false,"properties":{"descriptiveState":{"description":"descriptiveState is an optional more descriptive state field which has no requirements on format","type":"string"},"details":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"details contains any extra information that is operator-specific","type":"object"},"lastEvaluation":{"description":"lastEvaluation is the ResourceVersion last evaluated","type":"string"},"state":{"description":"state describes the state of the lastEvaluation.\nIt is limited to three possible states for machine evaluation.","enum":["success","in_progress","failed"],"type":"string"}},"required":["lastEvaluation","state"],"type":"object"},"Plugin":{"properties":{"spec":{"$ref":"#/components/schemas/spec"},"status":{"$ref":"#/components/schemas/status"}},"required":["spec"]},"getMetaDependencies":{"type":"object","required":["grafanaDependency"],"properties":{"extensions":{"type":"object","properties":{"exposedComponents":{"description":"+listType=set","type":"array","items":{"type":"string"}}},"additionalProperties":false},"grafanaDependency":{"description":"Required field","type":"string"},"grafanaVersion":{"description":"Optional fields","type":"string"},"plugins":{"description":"+listType=set\n+listMapKey=id","type":"array","items":{"type":"object","required":["id","type","name"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["app","datasource","panel"]}},"additionalProperties":false}}},"additionalProperties":false},"getMetaEnterpriseFeatures":{"type":"object","properties":{"healthDiagnosticsErrors":{"description":"Allow additional properties","type":"boolean","default":false}},"additionalProperties":false},"getMetaExtensions":{"type":"object","properties":{"addedComponents":{"description":"+listType=atomic","type":"array","items":{"type":"object","required":["targets","title"],"properties":{"description":{"type":"string"},"targets":{"description":"+listType=set","type":"array","items":{"type":"string"}},"title":{"type":"string"}},"additionalProperties":false}},"addedLinks":{"description":"+listType=atomic","type":"array","items":{"type":"object","required":["targets","title"],"properties":{"description":{"type":"string"},"targets":{"description":"+listType=set","type":"array","items":{"type":"string"}},"title":{"type":"string"}},"additionalProperties":false}},"exposedComponents":{"description":"+listType=set\n+listMapKey=id","type":"array","items":{"type":"object","required":["id"],"properties":{"description":{"type":"string"},"id":{"type":"string"},"title":{"type":"string"}},"additionalProperties":false}},"extensionPoints":{"description":"+listType=set\n+listMapKey=id","type":"array","items":{"type":"object","required":["id"],"properties":{"description":{"type":"string"},"id":{"type":"string"},"title":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"getMetaIAM":{"type":"object","properties":{"permissions":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"scope":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"getMetaInclude":{"type":"object","properties":{"action":{"type":"string"},"addToNav":{"type":"boolean"},"component":{"type":"string"},"defaultNav":{"type":"boolean"},"icon":{"type":"string"},"name":{"type":"string"},"path":{"type":"string"},"role":{"type":"string","enum":["Admin","Editor","Viewer"]},"type":{"type":"string","enum":["dashboard","page","panel","datasource"]},"uid":{"type":"string"}},"additionalProperties":false},"getMetaInfo":{"type":"object","required":["keywords","logos","updated","version"],"properties":{"author":{"description":"Optional fields","type":"object","properties":{"email":{"type":"string"},"name":{"type":"string"},"url":{"type":"string"}},"additionalProperties":false},"description":{"type":"string"},"keywords":{"description":"Required fields\n+listType=set","type":"array","items":{"type":"string"}},"links":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}},"additionalProperties":false}},"logos":{"type":"object","required":["small","large"],"properties":{"large":{"type":"string"},"small":{"type":"string"}},"additionalProperties":false},"screenshots":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"path":{"type":"string"}},"additionalProperties":false}},"updated":{"type":"string","format":"date-time"},"version":{"type":"string"}},"additionalProperties":false},"getMetaQueryOptions":{"type":"object","properties":{"cacheTimeout":{"type":"boolean"},"maxDataPoints":{"type":"boolean"},"minInterval":{"type":"boolean"}},"additionalProperties":false},"getMetaRole":{"type":"object","properties":{"grants":{"description":"+listType=set","type":"array","items":{"type":"string"}},"role":{"type":"object","properties":{"description":{"type":"string"},"name":{"type":"string"},"permissions":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"scope":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false},"getMetaRoute":{"type":"object","properties":{"body":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{}}},"headers":{"description":"+listType=atomic","type":"array","items":{"type":"string"}},"jwtTokenAuth":{"type":"object","properties":{"params":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{}}},"scopes":{"description":"+listType=set","type":"array","items":{"type":"string"}},"url":{"type":"string"}},"additionalProperties":false},"method":{"type":"string"},"path":{"type":"string"},"reqAction":{"type":"string"},"reqRole":{"type":"string"},"reqSignedIn":{"type":"boolean"},"tokenAuth":{"type":"object","properties":{"params":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{}}},"scopes":{"description":"+listType=set","type":"array","items":{"type":"string"}},"url":{"type":"string"}},"additionalProperties":false},"url":{"type":"string"},"urlParams":{"description":"+listType=atomic","type":"array","items":{"type":"object","properties":{"content":{"type":"string"},"name":{"type":"string"}},"additionalProperties":false}}},"additionalProperties":false},"spec":{"additionalProperties":false,"properties":{"class":{"enum":["core","external"],"type":"string"},"id":{"type":"string"},"url":{"type":"string"},"version":{"type":"string"}},"required":["id","version","class"],"type":"object"},"status":{"additionalProperties":false,"properties":{"additionalFields":{"additionalProperties":{"additionalProperties":{},"type":"object"},"description":"additionalFields is reserved for future use","type":"object"},"operatorStates":{"additionalProperties":{"$ref":"#/components/schemas/OperatorState"},"description":"operatorStates is a map of operator ID to operator state evaluations.\nAny operator which consumes this kind SHOULD add its state evaluation information to this field.","type":"object"}},"type":"object"}}`) versionSchemaPluginv0alpha1 app.VersionSchema _ = json.Unmarshal(rawSchemaPluginv0alpha1, &versionSchemaPluginv0alpha1) ) diff --git a/apps/plugins/pkg/app/install/registrar.go b/apps/plugins/pkg/app/install/registrar.go index fe747eb2806..3977fd88cf0 100644 --- a/apps/plugins/pkg/app/install/registrar.go +++ b/apps/plugins/pkg/app/install/registrar.go @@ -23,7 +23,6 @@ type Class = string const ( ClassCore Class = "core" ClassExternal Class = "external" - ClassCDN Class = "cdn" ) type Source = string diff --git a/apps/plugins/pkg/app/install/registrar_test.go b/apps/plugins/pkg/app/install/registrar_test.go index 36359896ae6..f1e0adbc508 100644 --- a/apps/plugins/pkg/app/install/registrar_test.go +++ b/apps/plugins/pkg/app/install/registrar_test.go @@ -446,19 +446,6 @@ func TestPluginInstall_ToPluginInstallV0Alpha1(t *testing.T) { require.Equal(t, pluginsv0alpha1.PluginSpecClass(ClassCore), p.Spec.Class) }, }, - { - name: "cdn class is mapped correctly", - install: PluginInstall{ - ID: "plugin-cdn", - Version: "3.0.0", - Class: ClassCDN, - Source: SourcePluginStore, - }, - namespace: "org-3", - validate: func(t *testing.T, p *pluginsv0alpha1.Plugin) { - require.Equal(t, pluginsv0alpha1.PluginSpecClass(ClassCDN), p.Spec.Class) - }, - }, { name: "source annotation is set correctly", install: PluginInstall{ diff --git a/apps/preferences/go.mod b/apps/preferences/go.mod index adc0ba32b44..cd702672de6 100644 --- a/apps/preferences/go.mod +++ b/apps/preferences/go.mod @@ -5,7 +5,6 @@ go 1.25.3 require ( github.com/grafana/grafana-app-sdk v0.48.2 github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250804150913-990f1c69ecc2 - github.com/stretchr/testify v1.11.1 k8s.io/apimachinery v0.34.2 k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 ) @@ -41,9 +40,10 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/stretchr/objx v0.5.2 // indirect + github.com/stretchr/testify v1.11.1 // indirect github.com/woodsbury/decimal128 v1.3.0 // indirect github.com/x448/float16 v0.8.4 // indirect go.opentelemetry.io/otel v1.38.0 // indirect @@ -51,7 +51,7 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect golang.org/x/text v0.31.0 // indirect diff --git a/apps/preferences/go.sum b/apps/preferences/go.sum index c09ddffd51b..8d576bfaa8b 100644 --- a/apps/preferences/go.sum +++ b/apps/preferences/go.sum @@ -85,8 +85,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -128,8 +128,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/preferences/kinds/manifest.cue b/apps/preferences/kinds/manifest.cue index aa75aa2d0ed..f7d08b81494 100644 --- a/apps/preferences/kinds/manifest.cue +++ b/apps/preferences/kinds/manifest.cue @@ -10,8 +10,7 @@ manifest: { go: {enabled: true} } kinds: [ - preferencesV1alpha1, - starsV1alpha1, + preferencesV1alpha1 ] } } diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/register.go b/apps/preferences/pkg/apis/preferences/v1alpha1/register.go index 6bedc78a325..4de18c09ef6 100644 --- a/apps/preferences/pkg/apis/preferences/v1alpha1/register.go +++ b/apps/preferences/pkg/apis/preferences/v1alpha1/register.go @@ -32,28 +32,6 @@ var PreferencesResourceInfo = utils.NewResourceInfo(APIGroup, APIVersion, }, ) -var StarsResourceInfo = utils.NewResourceInfo(APIGroup, APIVersion, - "stars", "stars", "Stars", - func() runtime.Object { return &Stars{} }, - func() runtime.Object { return &StarsList{} }, - utils.TableColumns{ - Definition: []metav1.TableColumnDefinition{ - {Name: "Name", Type: "string", Format: "name"}, - {Name: "Created At", Type: "date"}, - }, - Reader: func(obj any) ([]any, error) { - p, ok := obj.(*Stars) - if ok && p != nil { - return []any{ - p.Name, - p.CreationTimestamp.UTC().Format(time.RFC3339), - }, nil - } - return nil, fmt.Errorf("expected stars") - }, - }, -) - var ( SchemeBuilder runtime.SchemeBuilder localSchemeBuilder = &SchemeBuilder @@ -70,8 +48,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(schemeGroupVersion, &Preferences{}, &PreferencesList{}, - &Stars{}, - &StarsList{}, ) metav1.AddToGroupVersion(scheme, schemeGroupVersion) return nil diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi.go b/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi.go index c8700a3dfa5..542d5918626 100644 --- a/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi.go +++ b/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi.go @@ -20,10 +20,6 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.PreferencesNavbarPreference": schema_pkg_apis_preferences_v1alpha1_PreferencesNavbarPreference(ref), "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.PreferencesQueryHistoryPreference": schema_pkg_apis_preferences_v1alpha1_PreferencesQueryHistoryPreference(ref), "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.PreferencesSpec": schema_pkg_apis_preferences_v1alpha1_PreferencesSpec(ref), - "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.Stars": schema_pkg_apis_preferences_v1alpha1_Stars(ref), - "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.StarsList": schema_pkg_apis_preferences_v1alpha1_StarsList(ref), - "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.StarsResource": schema_pkg_apis_preferences_v1alpha1_StarsResource(ref), - "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.StarsSpec": schema_pkg_apis_preferences_v1alpha1_StarsSpec(ref), } } @@ -266,168 +262,3 @@ func schema_pkg_apis_preferences_v1alpha1_PreferencesSpec(ref common.ReferenceCa "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.PreferencesCookiePreferences", "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.PreferencesNavbarPreference", "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.PreferencesQueryHistoryPreference"}, } } - -func schema_pkg_apis_preferences_v1alpha1_Stars(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), - }, - }, - "spec": { - SchemaProps: spec.SchemaProps{ - Description: "Spec is the spec of the Stars", - Default: map[string]interface{}{}, - Ref: ref("github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.StarsSpec"), - }, - }, - }, - Required: []string{"metadata", "spec"}, - }, - }, - Dependencies: []string{ - "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.StarsSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, - } -} - -func schema_pkg_apis_preferences_v1alpha1_StarsList(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "kind": { - SchemaProps: spec.SchemaProps{ - Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - Type: []string{"string"}, - Format: "", - }, - }, - "apiVersion": { - SchemaProps: spec.SchemaProps{ - Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", - Type: []string{"string"}, - Format: "", - }, - }, - "metadata": { - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), - }, - }, - "items": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.Stars"), - }, - }, - }, - }, - }, - }, - Required: []string{"metadata", "items"}, - }, - }, - Dependencies: []string{ - "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.Stars", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, - } -} - -func schema_pkg_apis_preferences_v1alpha1_StarsResource(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "group": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "kind": { - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - "names": { - VendorExtensible: spec.VendorExtensible{ - Extensions: spec.Extensions{ - "x-kubernetes-list-type": "set", - }, - }, - SchemaProps: spec.SchemaProps{ - Description: "The set of resources", - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", - }, - }, - }, - }, - }, - }, - Required: []string{"group", "kind", "names"}, - }, - }, - } -} - -func schema_pkg_apis_preferences_v1alpha1_StarsSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { - return common.OpenAPIDefinition{ - Schema: spec.Schema{ - SchemaProps: spec.SchemaProps{ - Type: []string{"object"}, - Properties: map[string]spec.Schema{ - "resource": { - SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ - Schema: &spec.Schema{ - SchemaProps: spec.SchemaProps{ - Default: map[string]interface{}{}, - Ref: ref("github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.StarsResource"), - }, - }, - }, - }, - }, - }, - Required: []string{"resource"}, - }, - }, - Dependencies: []string{ - "github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1.StarsResource"}, - } -} diff --git a/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi_violation_exceptions.list b/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi_violation_exceptions.list index 80e3e004de7..efec2bc2b3e 100644 --- a/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi_violation_exceptions.list +++ b/apps/preferences/pkg/apis/preferences/v1alpha1/zz_generated.openapi_violation_exceptions.list @@ -1,4 +1,2 @@ API rule violation: list_type_missing,github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1,PreferencesNavbarPreference,BookmarkUrls -API rule violation: list_type_missing,github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1,StarsSpec,Resource API rule violation: streaming_list_type_json_tags,github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1,PreferencesList,ListMeta -API rule violation: streaming_list_type_json_tags,github.com/grafana/grafana/apps/preferences/pkg/apis/preferences/v1alpha1,StarsList,ListMeta diff --git a/apps/preferences/pkg/apis/preferences_manifest.go b/apps/preferences/pkg/apis/preferences_manifest.go index dbbbc8d4ab0..d67141364d1 100644 --- a/apps/preferences/pkg/apis/preferences_manifest.go +++ b/apps/preferences/pkg/apis/preferences_manifest.go @@ -23,9 +23,6 @@ var ( rawSchemaPreferencesv1alpha1 = []byte(`{"CookiePreferences":{"additionalProperties":false,"properties":{"analytics":{"additionalProperties":{},"type":"object"},"functional":{"additionalProperties":{},"type":"object"},"performance":{"additionalProperties":{},"type":"object"}},"type":"object"},"NavbarPreference":{"additionalProperties":false,"properties":{"bookmarkUrls":{"items":{"type":"string"},"type":"array"}},"required":["bookmarkUrls"],"type":"object"},"Preferences":{"properties":{"spec":{"$ref":"#/components/schemas/spec"}},"required":["spec"]},"QueryHistoryPreference":{"additionalProperties":false,"properties":{"homeTab":{"description":"one of: '' | 'query' | 'starred';","type":"string"}},"type":"object"},"spec":{"additionalProperties":false,"properties":{"cookiePreferences":{"$ref":"#/components/schemas/CookiePreferences","description":"Cookie preferences"},"homeDashboardUID":{"description":"UID for the home dashboard","type":"string"},"language":{"description":"Selected language (beta)","type":"string"},"navbar":{"$ref":"#/components/schemas/NavbarPreference","description":"Navigation preferences"},"queryHistory":{"$ref":"#/components/schemas/QueryHistoryPreference","description":"Explore query history preferences"},"regionalFormat":{"description":"Selected locale (beta)","type":"string"},"theme":{"description":"light, dark, empty is default","type":"string"},"timezone":{"description":"The timezone selection\nTODO: this should use the timezone defined in common","type":"string"},"weekStart":{"description":"day of the week (sunday, monday, etc)","type":"string"}},"type":"object"}}`) versionSchemaPreferencesv1alpha1 app.VersionSchema _ = json.Unmarshal(rawSchemaPreferencesv1alpha1, &versionSchemaPreferencesv1alpha1) - rawSchemaStarsv1alpha1 = []byte(`{"Resource":{"additionalProperties":false,"properties":{"group":{"type":"string"},"kind":{"type":"string"},"names":{"description":"The set of resources\n+listType=set","items":{"type":"string"},"type":"array"}},"required":["group","kind","names"],"type":"object"},"Stars":{"properties":{"spec":{"$ref":"#/components/schemas/spec"}},"required":["spec"]},"spec":{"additionalProperties":false,"properties":{"resource":{"items":{"$ref":"#/components/schemas/Resource"},"type":"array"}},"required":["resource"],"type":"object"}}`) - versionSchemaStarsv1alpha1 app.VersionSchema - _ = json.Unmarshal(rawSchemaStarsv1alpha1, &versionSchemaStarsv1alpha1) ) var appManifestData = app.ManifestData{ @@ -52,22 +49,6 @@ var appManifestData = app.ManifestData{ }, Schema: &versionSchemaPreferencesv1alpha1, }, - - { - Kind: "Stars", - Plural: "Stars", - Scope: "Namespaced", - Conversion: false, - Admission: &app.AdmissionCapabilities{ - Validation: &app.ValidationCapability{ - Operations: []app.AdmissionOperation{ - app.AdmissionOperationCreate, - app.AdmissionOperationUpdate, - }, - }, - }, - Schema: &versionSchemaStarsv1alpha1, - }, }, Routes: app.ManifestVersionRoutes{ Namespaced: map[string]spec3.PathProps{}, @@ -88,7 +69,6 @@ func RemoteManifest() app.Manifest { var kindVersionToGoType = map[string]resource.Kind{ "Preferences/v1alpha1": v1alpha1.PreferencesKind(), - "Stars/v1alpha1": v1alpha1.StarsKind(), } // ManifestGoTypeAssociator returns the associated resource.Kind instance for a given Kind and Version, if one exists. diff --git a/apps/provisioning/go.mod b/apps/provisioning/go.mod index 848f82951c4..a72aa77fe68 100644 --- a/apps/provisioning/go.mod +++ b/apps/provisioning/go.mod @@ -10,10 +10,10 @@ require ( github.com/grafana/grafana-app-sdk/logging v0.48.1 github.com/grafana/grafana/apps/secret v0.0.0-20250902093454-b56b7add012f github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250804150913-990f1c69ecc2 - github.com/grafana/nanogit v0.0.0-20251106115617-c622d3e0fc4b + github.com/grafana/nanogit v0.3.0 github.com/migueleliasweb/go-github-mock v1.1.0 github.com/stretchr/testify v1.11.1 - golang.org/x/oauth2 v0.32.0 + golang.org/x/oauth2 v0.33.0 k8s.io/apimachinery v0.34.2 k8s.io/apiserver v0.34.2 k8s.io/client-go v0.34.2 @@ -42,7 +42,7 @@ require ( github.com/google/go-github/v64 v64.0.0 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 // indirect + github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 // indirect github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 // indirect github.com/grafana/grafana-app-sdk v0.48.2 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -57,7 +57,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/stretchr/objx v0.5.2 // indirect diff --git a/apps/provisioning/go.sum b/apps/provisioning/go.sum index 822b6aa7330..92a4d53c282 100644 --- a/apps/provisioning/go.sum +++ b/apps/provisioning/go.sum @@ -58,8 +58,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f h1:Cbm6OKkOcJ+7CSZsGsEJzktC/SIa5bxVeYKQLuYK86o= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f/go.mod h1:axY0cdOg3q0TZHwpHnIz5x16xZ8ZBxJHShsSHHXcHQg= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 h1:qEwZ+7MbPjzRvTi31iT9w7NBhKIpKwZrFbYmOZLqkwA= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 h1:Muoy+FMGrHj3GdFbvsMzUT7eusgii9PKf9L1ZaXDDbY= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 h1:jSojuc7njleS3UOz223WDlXOinmuLAIPI0z2vtq8EgI= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4/go.mod h1:VahT+GtfQIM+o8ht2StR6J9g+Ef+C2Vokh5uuSmOD/4= github.com/grafana/grafana-app-sdk v0.48.2 h1:CQQDhwo1fWaXQVKvxxOcK6azbuY3E2TgJHNAZlYYn7U= @@ -70,8 +70,8 @@ github.com/grafana/grafana/apps/secret v0.0.0-20250902093454-b56b7add012f h1:f+Z github.com/grafana/grafana/apps/secret v0.0.0-20250902093454-b56b7add012f/go.mod h1:RA8mP8KVIwKXBx3Ssqa/uEBABib5LvUWYPVMxrNvnP0= github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250804150913-990f1c69ecc2 h1:X0cnaFdR+iz+sDSuoZmkryFSjOirchHe2MdKSRwBWgM= github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250804150913-990f1c69ecc2/go.mod h1:RRvSjHH12/PnQaXraMO65jUhVu8n59mzvhfIMBETnV4= -github.com/grafana/nanogit v0.0.0-20251106115617-c622d3e0fc4b h1:rFjoqJFb2KxJ29K9ltuWRSsdA46SbN0GCxoQc36h5kg= -github.com/grafana/nanogit v0.0.0-20251106115617-c622d3e0fc4b/go.mod h1:ToqLjIdvV3AZQa3K6e5m9hy/nsGaUByc2dWQlctB9iA= +github.com/grafana/nanogit v0.3.0 h1:XNEef+4Vi+465ZITJs/g/xgnDRJbWhhJ7iQrAnWZ0oQ= +github.com/grafana/nanogit v0.3.0/go.mod h1:6s6CCTpyMOHPpcUZaLGI+rgBEKdmxVbhqSGgCK13j7Y= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -113,8 +113,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -172,8 +172,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/provisioning/pkg/repository/git/repository.go b/apps/provisioning/pkg/repository/git/repository.go index 4d002e4f831..82d5ca6bd1d 100644 --- a/apps/provisioning/pkg/repository/git/repository.go +++ b/apps/provisioning/pkg/repository/git/repository.go @@ -25,6 +25,7 @@ import ( "github.com/grafana/nanogit/options" "github.com/grafana/nanogit/protocol" "github.com/grafana/nanogit/protocol/hash" + "github.com/grafana/nanogit/retry" ) type RepositoryConfig struct { @@ -144,7 +145,7 @@ func isValidGitURL(gitURL string) bool { // Test implements provisioning.Repository. func (r *gitRepository) Test(ctx context.Context) (*provisioning.TestResults, error) { - ctx, _ = r.logger(ctx, "") + ctx, _ = r.withGitContext(ctx, "") t := string(r.config.Spec.Type) @@ -219,7 +220,7 @@ func (r *gitRepository) Test(ctx context.Context) (*provisioning.TestResults, er // Read implements provisioning.Repository. func (r *gitRepository) Read(ctx context.Context, filePath, ref string) (*repository.FileInfo, error) { - ctx, _ = r.logger(ctx, ref) + ctx, _ = r.withGitContext(ctx, ref) finalPath := safepath.Join(r.gitConfig.Path, filePath) // Resolve ref to commit hash @@ -271,7 +272,7 @@ func (r *gitRepository) Read(ctx context.Context, filePath, ref string) (*reposi } func (r *gitRepository) ReadTree(ctx context.Context, ref string) ([]repository.FileTreeEntry, error) { - ctx, _ = r.logger(ctx, ref) + ctx, _ = r.withGitContext(ctx, ref) // Resolve ref to commit hash refHash, err := r.resolveRefToHash(ctx, ref) @@ -319,7 +320,7 @@ func (r *gitRepository) Create(ctx context.Context, path, ref string, data []byt if ref == "" { ref = r.gitConfig.Branch } - ctx, _ = r.logger(ctx, ref) + ctx, _ = r.withGitContext(ctx, ref) branchRef, err := r.ensureBranchExists(ctx, ref) if err != nil { return err @@ -364,7 +365,7 @@ func (r *gitRepository) Update(ctx context.Context, path, ref string, data []byt if ref == "" { ref = r.gitConfig.Branch } - ctx, _ = r.logger(ctx, ref) + ctx, _ = r.withGitContext(ctx, ref) // Check if trying to update a directory if safepath.IsDir(path) { @@ -411,7 +412,7 @@ func (r *gitRepository) Write(ctx context.Context, path string, ref string, data ref = r.gitConfig.Branch } - ctx, _ = r.logger(ctx, ref) + ctx, _ = r.withGitContext(ctx, ref) info, err := r.Read(ctx, path, ref) if err != nil && !(errors.Is(err, repository.ErrFileNotFound)) { return fmt.Errorf("check if file exists before writing: %w", err) @@ -431,7 +432,7 @@ func (r *gitRepository) Delete(ctx context.Context, path, ref, comment string) e if ref == "" { ref = r.gitConfig.Branch } - ctx, _ = r.logger(ctx, ref) + ctx, _ = r.withGitContext(ctx, ref) branchRef, err := r.ensureBranchExists(ctx, ref) if err != nil { @@ -454,7 +455,7 @@ func (r *gitRepository) Move(ctx context.Context, oldPath, newPath, ref, comment if ref == "" { ref = r.gitConfig.Branch } - ctx, _ = r.logger(ctx, ref) + ctx, _ = r.withGitContext(ctx, ref) branchRef, err := r.ensureBranchExists(ctx, ref) if err != nil { @@ -545,6 +546,7 @@ func (r *gitRepository) History(_ context.Context, _ string, _ string) ([]provis } func (r *gitRepository) ListRefs(ctx context.Context) ([]provisioning.RefItem, error) { + ctx, _ = r.withGitContext(ctx, "") refs, err := r.client.ListRefs(ctx) if err != nil { return nil, fmt.Errorf("list refs: %w", err) @@ -566,7 +568,7 @@ func (r *gitRepository) ListRefs(ctx context.Context) ([]provisioning.RefItem, e } func (r *gitRepository) LatestRef(ctx context.Context) (string, error) { - ctx, _ = r.logger(ctx, "") + ctx, _ = r.withGitContext(ctx, "") branchRef, err := r.client.GetRef(ctx, fmt.Sprintf("refs/heads/%s", r.gitConfig.Branch)) if err != nil { return "", fmt.Errorf("get branch ref: %w", err) @@ -583,7 +585,7 @@ func (r *gitRepository) CompareFiles(ctx context.Context, base, ref string) ([]r return nil, fmt.Errorf("ref cannot be empty") } - ctx, logger := r.logger(ctx, ref) + ctx, logger := r.withGitContext(ctx, ref) // Resolve base ref to hash var baseHash hash.Hash @@ -671,11 +673,15 @@ func (r *gitRepository) CompareFiles(ctx context.Context, base, ref string) ([]r } func (r *gitRepository) Stage(ctx context.Context, opts repository.StageOptions) (repository.StagedRepository, error) { + ctx = ensureRetryContext(ctx) + ctx, _ = r.withGitContext(ctx, "") return NewStagedGitRepository(ctx, r, opts) } // resolveRefToHash resolves a ref (branch name or commit hash) to a commit hash func (r *gitRepository) resolveRefToHash(ctx context.Context, ref string) (hash.Hash, error) { + ctx, _ = r.withGitContext(ctx, ref) + // Use default branch if ref is empty if ref == "" { ref = r.gitConfig.Branch @@ -706,6 +712,8 @@ func (r *gitRepository) resolveRefToHash(ctx context.Context, ref string) (hash. // ensureBranchExists checks if a branch exists and creates it if it doesn't, // returning the branch reference to avoid duplicate GetRef calls func (r *gitRepository) ensureBranchExists(ctx context.Context, branchName string) (nanogit.Ref, error) { + ctx, _ = r.withGitContext(ctx, branchName) + if !IsValidGitBranchName(branchName) { return nanogit.Ref{}, &apierrors.StatusError{ ErrStatus: metav1.Status{ @@ -802,7 +810,57 @@ func (r *gitRepository) commitAndPush(ctx context.Context, writer nanogit.Staged return nil } -func (r *gitRepository) logger(ctx context.Context, ref string) (context.Context, logging.Logger) { +// defaultGitRetrier returns a default retrier configuration for Git operations. +// +// Retry attempts will happen when: +// - Network errors occur: connection timeouts, temporary network failures, or connection errors +// - HTTP 5xx server errors: For GET and DELETE operations (idempotent) +// - HTTP 429 Too Many Requests: For all operations (rate limiting is temporary) +// +// The retry behavior: +// - Total attempts: 8 (1 initial attempt + 7 retries) +// - Initial delay: 100ms before the first retry +// - Exponential backoff: delay doubles after each failed attempt (100ms → 200ms → 400ms → 800ms → 1.6s → 3.2s → 5s) +// - Maximum delay: capped at 5 seconds +// - Jitter: enabled to prevent thundering herd problems +// - Total retry window: approximately 10 seconds from first attempt to last retry +// +// All attempts will fail when: +// - The Git server is completely unavailable or unreachable +// - Network connectivity issues persist beyond the retry window (~10 seconds) +// - The server returns transient errors consistently for the entire retry duration +// - Context cancellation occurs before retries complete +// +// Non-transient errors (e.g., 4xx client errors except 429, authentication failures) are not retried and returned immediately. +func defaultGitRetrier() *retry.ExponentialBackoffRetrier { + return retry.NewExponentialBackoffRetrier(). + WithMaxAttempts(8). // 1 initial + 7 retries = 8 total attempts (~10s total retry window) + WithInitialDelay(100 * time.Millisecond). + WithMaxDelay(5 * time.Second). + WithMultiplier(2.0). + WithJitter() +} + +// ensureRetryContext ensures that retry logic is configured in the context. +// This function should be called at the beginning of all methods that make client calls +// to guarantee retry logic is always present, regardless of context state. +func ensureRetryContext(ctx context.Context) context.Context { + // Only add retrier if one doesn't already exist in the context + if retry.FromContext(ctx).MaxAttempts() <= 1 { + ctx = retry.ToContext(ctx, defaultGitRetrier()) + } + return ctx +} + +// withGitContext sets up the context with logging, git repository metadata, and retry logic. +// This function should be called at the beginning of all public methods to ensure: +// - Proper logging context with git repository details +// - Retry logic is configured for all Git operations +// - Context is properly prepared for nanogit client calls +func (r *gitRepository) withGitContext(ctx context.Context, ref string) (context.Context, logging.Logger) { + // Ensure retry logic is configured first, before any early returns + ctx = ensureRetryContext(ctx) + logger := logging.FromContext(ctx) type containsGit int diff --git a/apps/provisioning/pkg/repository/git/repository_test.go b/apps/provisioning/pkg/repository/git/repository_test.go index d3946b7b6d4..4958ab372ab 100644 --- a/apps/provisioning/pkg/repository/git/repository_test.go +++ b/apps/provisioning/pkg/repository/git/repository_test.go @@ -2163,7 +2163,7 @@ func TestGitRepository_commitAndPush(t *testing.T) { } } -func TestGitRepository_logger(t *testing.T) { +func TestGitRepository_withGitContext(t *testing.T) { gitRepo := &gitRepository{ config: &provisioning.Repository{ Spec: provisioning.RepositorySpec{ @@ -2179,7 +2179,7 @@ func TestGitRepository_logger(t *testing.T) { t.Run("creates new logger context", func(t *testing.T) { ctx := context.Background() - newCtx, logger := gitRepo.logger(ctx, "feature-branch") + newCtx, logger := gitRepo.withGitContext(ctx, "feature-branch") require.NotNil(t, newCtx) require.NotNil(t, logger) @@ -2188,7 +2188,7 @@ func TestGitRepository_logger(t *testing.T) { t.Run("uses default branch when ref is empty", func(t *testing.T) { ctx := context.Background() - newCtx, logger := gitRepo.logger(ctx, "") + newCtx, logger := gitRepo.withGitContext(ctx, "") require.NotNil(t, newCtx) require.NotNil(t, logger) @@ -2198,10 +2198,10 @@ func TestGitRepository_logger(t *testing.T) { ctx := context.Background() // First call creates the logger context - ctx1, logger1 := gitRepo.logger(ctx, "branch1") + ctx1, logger1 := gitRepo.withGitContext(ctx, "branch1") // Second call should return the existing logger context - ctx2, logger2 := gitRepo.logger(ctx1, "branch2") + ctx2, logger2 := gitRepo.withGitContext(ctx1, "branch2") // When logger context already exists, it should return the same context require.Equal(t, ctx1, ctx2) diff --git a/apps/scope/pkg/apis/scope/v0alpha1/types.go b/apps/scope/pkg/apis/scope/v0alpha1/types.go index b0f58fdfd44..0c323d8d14b 100644 --- a/apps/scope/pkg/apis/scope/v0alpha1/types.go +++ b/apps/scope/pkg/apis/scope/v0alpha1/types.go @@ -209,6 +209,8 @@ type FindScopeNavigationsResults struct { type ScopeNavigationSpec struct { URL string `json:"url"` Scope string `json:"scope"` + // Used to navigate to a sub-scope of the main scope. URL will not be used if this is set. + SubScope string `json:"subScope,omitempty"` } // Type of the item. diff --git a/apps/scope/pkg/apis/scope/v0alpha1/zz_generated.openapi.go b/apps/scope/pkg/apis/scope/v0alpha1/zz_generated.openapi.go index a0b0e90b557..50015307139 100644 --- a/apps/scope/pkg/apis/scope/v0alpha1/zz_generated.openapi.go +++ b/apps/scope/pkg/apis/scope/v0alpha1/zz_generated.openapi.go @@ -635,6 +635,13 @@ func schema_pkg_apis_scope_v0alpha1_ScopeNavigationSpec(ref common.ReferenceCall Format: "", }, }, + "subScope": { + SchemaProps: spec.SchemaProps{ + Description: "Used to navigate to a sub-scope of the main scope. URL will not be used if this is set.", + Type: []string{"string"}, + Format: "", + }, + }, }, Required: []string{"url", "scope"}, }, diff --git a/apps/secret/go.mod b/apps/secret/go.mod index b939cbdc85c..2ac03ea3f8b 100644 --- a/apps/secret/go.mod +++ b/apps/secret/go.mod @@ -6,9 +6,9 @@ require ( github.com/grafana/grafana-app-sdk v0.48.2 github.com/grafana/grafana/pkg/apimachinery v0.0.0-20250710134100-1f3dc0533caf github.com/stretchr/testify v1.11.1 + go.yaml.in/yaml/v3 v3.0.4 google.golang.org/grpc v1.76.0 google.golang.org/protobuf v1.36.10 - gopkg.in/yaml.v3 v3.0.1 k8s.io/apimachinery v0.34.2 k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 @@ -45,7 +45,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/woodsbury/decimal128 v1.3.0 // indirect @@ -54,15 +54,15 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect - go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect golang.org/x/text v0.31.0 // indirect golang.org/x/time v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20251002232023-7c0ddcbb5797 // indirect gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/client-go v0.34.2 // indirect k8s.io/klog/v2 v2.130.1 // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect diff --git a/apps/secret/go.sum b/apps/secret/go.sum index c7babeffcb8..74024f8df34 100644 --- a/apps/secret/go.sum +++ b/apps/secret/go.sum @@ -89,8 +89,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -140,8 +140,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value.go b/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value.go index a8738c3093a..0a3d230f50a 100644 --- a/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value.go +++ b/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value.go @@ -9,7 +9,7 @@ import ( "fmt" "strconv" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const redacted = "[REDACTED]" diff --git a/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value_test.go b/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value_test.go index 90d53bdf7ae..d9bede562f8 100644 --- a/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value_test.go +++ b/apps/secret/pkg/apis/secret/v1beta1/exposed_secure_value_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestExposedSecureValue(t *testing.T) { diff --git a/apps/shorturl/go.mod b/apps/shorturl/go.mod index 2c4ccd17852..382cf8dd051 100644 --- a/apps/shorturl/go.mod +++ b/apps/shorturl/go.mod @@ -35,7 +35,7 @@ require ( github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f // indirect - github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 // indirect + github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 // indirect github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -56,7 +56,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.67.1 // indirect + github.com/prometheus/common v0.67.3 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/puzpuzpuz/xsync/v2 v2.5.1 // indirect github.com/spf13/pflag v1.0.10 // indirect @@ -75,7 +75,7 @@ require ( go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.44.0 // indirect golang.org/x/net v0.47.0 // indirect - golang.org/x/oauth2 v0.32.0 // indirect + golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.18.0 // indirect golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.37.0 // indirect diff --git a/apps/shorturl/go.sum b/apps/shorturl/go.sum index 82606eb4015..e31288da121 100644 --- a/apps/shorturl/go.sum +++ b/apps/shorturl/go.sum @@ -52,8 +52,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f h1:Cbm6OKkOcJ+7CSZsGsEJzktC/SIa5bxVeYKQLuYK86o= github.com/grafana/authlib v0.0.0-20250930082137-a40e2c2b094f/go.mod h1:axY0cdOg3q0TZHwpHnIz5x16xZ8ZBxJHShsSHHXcHQg= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37 h1:qEwZ+7MbPjzRvTi31iT9w7NBhKIpKwZrFbYmOZLqkwA= -github.com/grafana/authlib/types v0.0.0-20250926065801-df98203cff37/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4 h1:Muoy+FMGrHj3GdFbvsMzUT7eusgii9PKf9L1ZaXDDbY= +github.com/grafana/authlib/types v0.0.0-20251119142549-be091cf2f4d4/go.mod h1:qeWYbnWzaYGl88JlL9+DsP1GT2Cudm58rLtx13fKZdw= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4 h1:jSojuc7njleS3UOz223WDlXOinmuLAIPI0z2vtq8EgI= github.com/grafana/dskit v0.0.0-20250908063411-6b6da59b5cc4/go.mod h1:VahT+GtfQIM+o8ht2StR6J9g+Ef+C2Vokh5uuSmOD/4= github.com/grafana/grafana-app-sdk v0.48.2 h1:CQQDhwo1fWaXQVKvxxOcK6azbuY3E2TgJHNAZlYYn7U= @@ -116,8 +116,8 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI= -github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= @@ -179,8 +179,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY= -golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +golang.org/x/oauth2 v0.33.0 h1:4Q+qn+E5z8gPRJfmRy7C2gGG3T4jIprK6aSYgTXGRpo= +golang.org/x/oauth2 v0.33.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/conf/defaults.ini b/conf/defaults.ini index bdde8c7d254..125c748326c 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -218,6 +218,12 @@ delete_auto_gen_ids = false # Improves startup performance for instances with large numbers of annotations who do not plan to downgrade Grafana. skip_dashboard_uid_migration_on_startup = false +# Set to true to skip all database migrations on startup. Should be used in conjunction with "ensure_default_org_and_user". +skip_migrations = false + +# Set to false to skip ensuring the default organization and user on startup. +ensure_default_org_and_user = true + #################################### Cache server ############################# [remote_cache] # Either "redis", "memcached" or "database" default is "database" @@ -575,10 +581,6 @@ external_manage_info = # Viewers can edit/inspect dashboard settings in the browser. But not save the dashboard. viewers_can_edit = false -# Deprecated: Assign your editors to admins. -# Editors can administrate dashboard, folders and teams they create -editors_can_admin = false - # The duration in time a user invitation remains valid before expiring. This setting should be expressed as a duration. Examples: 6h (hours), 2d (days), 1w (week). Default is 24h (24 hours). The minimum supported duration is 15m (15 minutes). user_invite_max_lifetime_duration = 24h @@ -1957,6 +1959,10 @@ max_connections = 100 # The limit can be disabled by setting it to -1. message_size_limit = 8388608 +# client_queue_max_size is the maximum size in bytes of the client queue +# for Live connections. Defaults to 4MB. +client_queue_max_size = 4194304 + # allowed_origins is a comma-separated list of origins that can establish connection with Grafana Live. # If not set then origin will be matched over root_url. Supports wildcard symbol "*". allowed_origins = diff --git a/conf/sample.ini b/conf/sample.ini index 6d41d750b8a..3944ea20940 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -568,10 +568,6 @@ # Viewers can edit/inspect dashboard settings in the browser. But not save the dashboard. ;viewers_can_edit = false -# Deprecated: Assign your editors to admins. -# Editors can administrate dashboard, folders and teams they create -;editors_can_admin = false - # The duration in time a user invitation remains valid before expiring. This setting should be expressed as a duration. Examples: 6h (hours), 2d (days), 1w (week). Default is 24h (24 hours). The minimum supported duration is 15m (15 minutes). ;user_invite_max_lifetime_duration = 24h @@ -1907,6 +1903,10 @@ default_datasource_uid = # ha_prefix is a prefix for keys in the HA engine. It's used to separate keys for different Grafana instances. ;ha_prefix = +# client_queue_max_size is the maximum size in bytes of the client queue +# for Live connections. Defaults to 4MB. +;client_queue_max_size = + #################################### Grafana Image Renderer Plugin ########################## [plugin.grafana-image-renderer] # Instruct headless browser instance to use a default timezone when not provided by Grafana, e.g. when rendering panel image of alert. diff --git a/contribute/feature-toggles.md b/contribute/feature-toggles.md index 1e6b1b1b885..aa74b2d7fc2 100644 --- a/contribute/feature-toggles.md +++ b/contribute/feature-toggles.md @@ -2,6 +2,8 @@ This guide helps you to add your feature behind a _feature flag_, code that lets you enable or disable a feature without redeploying Grafana. +Exhaustive documentation on OpenFeature can be found at [OpenFeature.dev](https://openfeature.dev/) + ## Steps to adding a feature toggle 1. Define the feature toggle in [registry.go](../pkg/services/featuremgmt/registry.go). To see what each feature stage means, look at the [related comments](../pkg/services/featuremgmt/features.go). If you are a community member, use the [CODEOWNERS](../.github/CODEOWNERS) file to determine which team owns the package you are updating. @@ -13,7 +15,68 @@ Once your feature toggle is defined, you can then wrap your feature around a che Examples: -- [Backend](https://github.com/grafana/grafana/blob/feb2b5878b3e3ec551d64872c35edec2a0187812/pkg/services/authn/clients/session.go#L57): Use the `IsEnabled` function and pass in your feature toggle. +### Backend + +Use the OpenFeature client for all new backend feature flags. + +#### Key points: + +- OpenFeature SDK relies on the global state. +- OpenFeature Provider configuration happens in the `commands` module before initialization of other modules. +- It is safe to create an instance of the OpenFeature client directly in a function. +- Flag evaluation is context-aware -- you can pass metadata such as org name, grafana version, or environment to the evaluation context. +- Always perform flag evaluation at runtime, not during service startup, to ensure correct and up-to-date flag values. +- Do not cache or store flag values globally -- evaluate flags when needed, especially in request or handler logic. + +#### In Grafana code: + +```go +import "github.com/open-feature/go-sdk/openfeature" + +client := openfeature.NewDefaultClient() + +if client.Boolean(ctx, MyTestFlag, false, openfeature.TransactionContext(ctx)) { + ... +} +``` + +#### In Tests: + +```go +import ( + "github.com/open-feature/go-sdk/openfeature" + "github.com/open-feature/go-sdk/openfeature/testing" +) + +var ( + // Since openfeature relies on global state, + // TestProvider should be a global instance shared between tests + // Under the hood it uses a custom _goroutine local_ storage to manage state on a per-test basis + provider = testing.NewTestProvider() +) + +func TestMain(m *testing.M) { + fmt.Println("Setting up test environment...") + + if err := openfeature.SetProvider(provider); err != nil { + ... + } + + exitCode := m.Run() + os.Exit(exitCode) +} + +func TestFoo(t *testing.T) { + t.Parallel() + + testFlags := map[string]memprovider.InMemoryFlag{ + ... + } + + provider.UsingFlags(t, testFlags) + ... +} +``` ### Frontend diff --git a/devenv/frontend-service/docker-compose.yaml b/devenv/frontend-service/docker-compose.yaml index e46f54fd8a0..606067f9629 100644 --- a/devenv/frontend-service/docker-compose.yaml +++ b/devenv/frontend-service/docker-compose.yaml @@ -65,6 +65,8 @@ services: - 'alloy.logs=true' environment: OTEL_BSP_SCHEDULE_DELAY: 500 + GF_DATABASE_SKIP_MIGRATIONS: true + GF_DATABASE_ENSURE_DEFAULT_ORG_AND_USER: false GF_DEFAULT_APP_MODE: development GF_DEFAULT_TARGET: frontend-server GF_SECURITY_CONTENT_SECURITY_POLICY: false diff --git a/devenv/scopes/scopes-config.yaml b/devenv/scopes/scopes-config.yaml index 46592742bbd..54842e5818e 100644 --- a/devenv/scopes/scopes-config.yaml +++ b/devenv/scopes/scopes-config.yaml @@ -1,29 +1,58 @@ scopes: - app1: - title: Application 1 + shoe-org: + title: Shoe organization + filters: + - key: organization + operator: equals + value: shoe + + shoes: + title: Shoes + filters: + - key: product + operator: equals + value: shoes + + apparel: + title: Apparel + filters: + - key: product + operator: equals + value: apparel + + frontend: + title: Frontend + filters: + - key: team + operator: equals + value: frontend + + database: + title: Database + filters: + - key: team + operator: equals + value: database + + main-app: + title: Main App filters: - key: app operator: equals - value: app1 + value: main - app2: - title: Application 2 + kids-app: + title: Kids App filters: - key: app operator: equals - value: app2 - - cluster1: - title: Cluster 1 - filters: - - key: cluster - operator: equals - value: cluster1 + value: kids tree: gdev-scopes: title: gdev-scopes nodeType: container + disableMultiSelect: true children: production: title: Production @@ -54,7 +83,6 @@ tree: nodeType: leaf linkId: test-case-2 linkType: scope - clusters: title: Clusters nodeType: container @@ -66,19 +94,139 @@ tree: nodeType: leaf linkId: cluster1 linkType: scope + shoe-org-root: + title: Shoe organization + subTitle: Nested scopes navigation + nodeType: leaf + linkId: shoe-org + linkType: scope -navigations: - # Example: Link to a dashboard - app1-nav: - url: /d/86Js1xRmk - scope: app1 +navigationTree: + - name: global-overview + title: Global overview + url: /d/TkZXxlNG3 + scope: shoe-org - # Example: Link to a dashboard with full URL (already has /d/) - app2-nav: - url: /d/GlAqcPgmz - scope: app2 + - name: reliability-placeholder + title: Reliability + url: /d/dcb9f5e9-8066-4397-889e-864b99555dbb + scope: shoe-org + groups: + - Reliability - # Example: Custom URL path - custom-nav: - url: /explore - scope: app1 + - name: shoes + title: Shoes + url: /d/_5rDmaQiz + scope: shoe-org + subScope: shoes + children: + - name: shoes-overview + title: Overview + url: /d/5SdHCadmz + scope: shoes + + - name: shoes-team-overview + title: Team Overview + url: /d/EJ8_d9jZk + scope: shoes + + - name: shoes-frontend + title: Frontend + url: /d/edediimbjhdz4b + scope: shoes + subScope: frontend + children: + - name: frontend-api + title: API Metrics + url: /d/5Y0jv6pVz + scope: frontend + + - name: frontend-ui + title: UI Performance + url: /d/2xuwrgV7z + scope: frontend + - name: frontend-shoes + title: Nested shoes + url: /d/5SdHCadmz + scope: frontend + subScope: shoes # This should be filtered out since 'shoes' is already in the path + + - name: shoes-database + title: Database + url: /d/lVE-2YFMz + scope: shoes + subScope: database + children: + - name: database-connections + title: Database Connections + url: /d/mIJjFy8Kz + scope: database + + - name: database-replication + title: Database Replication + url: /d/fdn48fmz8f94wc + scope: database + + - name: shoes-main-app + title: Main App + url: /d/WZ7AhQiVz + scope: shoes + subScope: main-app + children: + - name: main-app-users + title: User Analytics + url: /d/a6801696-cc53-4196-b1f9-2403e3909185 + scope: main-app + + - name: main-app-revenue + title: Revenue Metrics + url: /d/imQX6j-Gz + scope: main-app + + - name: shoes-kids-app + title: Kids App + url: /d/bds35fot3cv7kb + scope: shoes + subScope: kids-app + children: + - name: kids-app-features + title: Feature Usage + url: /d/16f11TZWk + scope: kids-app + + - name: kids-app-engagement + title: User Engagement + url: /d/c01bf42b-b783-4447-a304-8554cee1843b + scope: kids-app + + - name: apparel + title: Apparel + url: /d/UTv--wqMk + scope: shoe-org + subScope: apparel + children: + - name: apparel-product-overview + title: Product Overview + url: /d/Kp9Z0hTik + scope: apparel + + - name: all-teams-placeholder + title: All Teams + url: /d/b36b5576-2e3d-4b0c-8dce-e79514d99345 + scope: shoe-org + groups: + - Discovered dashboards + children: + - name: others-placeholder + title: Others + url: /d/xtY_uCAiz + scope: shoe-org + groups: + - All Teams + children: + - name: latency-and-errors + title: Latency and Errors + url: /d/ZqZnVvFZz + scope: shoe-org + groups: + - Others diff --git a/devenv/scopes/scopes.go b/devenv/scopes/scopes.go index 0480ee221e7..1f8a698ccda 100644 --- a/devenv/scopes/scopes.go +++ b/devenv/scopes/scopes.go @@ -13,7 +13,7 @@ import ( "os" "strings" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/grafana/grafana/apps/scope/pkg/apis/scope/v0alpha1" @@ -43,9 +43,10 @@ func getEnv(key, defaultValue string) string { } type Config struct { - Scopes map[string]ScopeConfig `yaml:"scopes"` - Tree map[string]TreeNode `yaml:"tree"` - Navigations map[string]NavigationConfig `yaml:"navigations"` + Scopes map[string]ScopeConfig `yaml:"scopes"` + Tree map[string]TreeNode `yaml:"tree"` + Navigations map[string]NavigationConfig `yaml:"navigations"` + NavigationTree []NavigationTreeNode `yaml:"navigationTree"` } // ScopeConfig is used for YAML parsing - converts to v0alpha1.ScopeSpec @@ -64,16 +65,32 @@ type ScopeFilterConfig struct { // TreeNode is used for YAML parsing - converts to v0alpha1.ScopeNodeSpec type TreeNode struct { - Title string `yaml:"title"` - NodeType string `yaml:"nodeType"` - LinkID string `yaml:"linkId,omitempty"` - LinkType string `yaml:"linkType,omitempty"` - Children map[string]TreeNode `yaml:"children,omitempty"` + Title string `yaml:"title"` + SubTitle string `yaml:"subTitle,omitempty"` + NodeType string `yaml:"nodeType"` + LinkID string `yaml:"linkId,omitempty"` + LinkType string `yaml:"linkType,omitempty"` + DisableMultiSelect bool `yaml:"disableMultiSelect,omitempty"` + Children map[string]TreeNode `yaml:"children,omitempty"` } type NavigationConfig struct { - URL string `yaml:"url"` // URL path (e.g., /d/abc123 or /explore) - Scope string `yaml:"scope"` + URL string `yaml:"url"` // URL path (e.g., /d/abc123 or /explore) + Scope string `yaml:"scope"` // Required scope + SubScope string `yaml:"subScope"` // Optional subScope for hierarchical navigation + Title string `yaml:"title"` // Display title + Groups []string `yaml:"groups"` // Optional groups for categorization +} + +// NavigationTreeNode represents a node in the navigation tree structure +type NavigationTreeNode struct { + Name string `yaml:"name"` + Title string `yaml:"title"` + URL string `yaml:"url"` + Scope string `yaml:"scope"` + SubScope string `yaml:"subScope,omitempty"` + Groups []string `yaml:"groups,omitempty"` + Children []NavigationTreeNode `yaml:"children,omitempty"` } // Helper function to convert ScopeFilterConfig to v0alpha1.ScopeFilter @@ -156,6 +173,41 @@ func (c *Client) makeRequest(method, endpoint string, body []byte) error { return nil } +func (c *Client) getScopeNavigation(name string) (*v0alpha1.ScopeNavigation, error) { + url := fmt.Sprintf("%s/apis/%s/namespaces/%s/scopenavigations/%s", c.baseURL, apiVersion, c.namespace, name) + + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return nil, fmt.Errorf("failed to create request: %w", err) + } + + req.Header.Set("Content-Type", "application/json") + req.SetBasicAuth(strings.Split(c.auth, ":")[0], strings.Split(c.auth, ":")[1]) + + resp, err := c.httpClient.Do(req) + if err != nil { + return nil, fmt.Errorf("request failed: %w", err) + } + defer resp.Body.Close() + + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + bodyBytes, _ := io.ReadAll(resp.Body) + return nil, fmt.Errorf("API request failed: HTTP %d - %s", resp.StatusCode, string(bodyBytes)) + } + + bodyBytes, err := io.ReadAll(resp.Body) + if err != nil { + return nil, fmt.Errorf("failed to read response: %w", err) + } + + var navigation v0alpha1.ScopeNavigation + if err := json.Unmarshal(bodyBytes, &navigation); err != nil { + return nil, fmt.Errorf("failed to unmarshal response: %w", err) + } + + return &navigation, nil +} + func (c *Client) createScope(name string, cfg ScopeConfig) error { prefixedName := prefix + "-" + name @@ -206,8 +258,9 @@ func (c *Client) createScopeNode(name string, node TreeNode, parentName string) spec := v0alpha1.ScopeNodeSpec{ Title: node.Title, + SubTitle: node.SubTitle, NodeType: nodeType, - DisableMultiSelect: false, + DisableMultiSelect: node.DisableMultiSelect, } if prefixedParent != "" { @@ -241,17 +294,34 @@ func (c *Client) createScopeNode(name string, node TreeNode, parentName string) func (c *Client) createScopeNavigation(name string, nav NavigationConfig) error { prefixedName := prefix + "-" + name - prefixedScope := prefix + "-" + nav.Scope if nav.URL == "" { return fmt.Errorf("navigation %s must have 'url' specified", name) } + if nav.Scope == "" { + return fmt.Errorf("navigation %s must have 'scope' specified", name) + } + + prefixedScope := prefix + "-" + nav.Scope + spec := v0alpha1.ScopeNavigationSpec{ URL: nav.URL, Scope: prefixedScope, } + if nav.SubScope != "" { + prefixedSubScope := prefix + "-" + nav.SubScope + spec.SubScope = prefixedSubScope + } + + status := v0alpha1.ScopeNavigationStatus{ + Title: nav.Title, + } + if len(nav.Groups) > 0 { + status.Groups = nav.Groups + } + resource := v0alpha1.ScopeNavigation{ TypeMeta: metav1.TypeMeta{ APIVersion: apiVersion, @@ -269,7 +339,99 @@ func (c *Client) createScopeNavigation(name string, nav NavigationConfig) error } fmt.Printf("✓ Creating scope navigation: %s\n", prefixedName) - return c.makeRequest("POST", "/scopenavigations", body) + if err := c.makeRequest("POST", "/scopenavigations", body); err != nil { + return err + } + + // Update status in a second request (status is a subresource) + if nav.Title != "" || len(nav.Groups) > 0 { + // Get the created resource to retrieve its resourceVersion and existing spec + createdNav, err := c.getScopeNavigation(prefixedName) + if err != nil { + return fmt.Errorf("failed to get created navigation: %w", err) + } + + statusResource := v0alpha1.ScopeNavigation{ + TypeMeta: metav1.TypeMeta{ + APIVersion: apiVersion, + Kind: "ScopeNavigation", + }, + ObjectMeta: metav1.ObjectMeta{ + Name: prefixedName, + ResourceVersion: createdNav.ObjectMeta.ResourceVersion, + }, + Spec: createdNav.Spec, // Include existing spec to prevent it from being cleared + Status: status, + } + + statusBody, err := json.Marshal(statusResource) + if err != nil { + return fmt.Errorf("failed to marshal scope navigation status: %w", err) + } + + fmt.Printf(" Updating status for: %s\n", prefixedName) + return c.makeRequest("PUT", fmt.Sprintf("/scopenavigations/%s/status", prefixedName), statusBody) + } + + return nil +} + +// NavigationWithName pairs a navigation config with its name and title +type NavigationWithName struct { + Name string + Title string + Nav NavigationConfig +} + +// Convert navigation tree to flat navigations (similar to mock's treeToNavigations) +func treeToNavigations(node NavigationTreeNode, parentPath []string, dashboardCounter *int) []NavigationWithName { + navigations := []NavigationWithName{} + currentPath := append(parentPath, node.Name) + + // Generate URL if not provided (cycle through dash-1, dash-2, etc.) + url := node.URL + if url == "" { + *dashboardCounter++ + url = fmt.Sprintf("/d/dash-%d", *dashboardCounter) + } + + // Create navigation for this node + nav := NavigationConfig{ + URL: url, + Scope: node.Scope, + Title: node.Title, + } + if node.SubScope != "" { + nav.SubScope = node.SubScope + } + if len(node.Groups) > 0 { + nav.Groups = node.Groups + } + navigations = append(navigations, NavigationWithName{ + Name: node.Name, + Title: node.Title, + Nav: nav, + }) + + // Process children - they inherit the parent's subScope as their scope, or use parent's scope if no subScope + if len(node.Children) > 0 { + for _, child := range node.Children { + // Children inherit the parent's subScope as their scope, or use parent's scope if no subScope + childScope := node.SubScope + if childScope == "" { + childScope = node.Scope + } + // Override with child's scope if explicitly set + if child.Scope != "" { + childScope = child.Scope + } else { + child.Scope = childScope + } + navigations = append(navigations, treeToNavigations(child, currentPath, dashboardCounter)...) + } + } + + return navigations } func (c *Client) createTreeNodes(children map[string]TreeNode, parentName string) error { @@ -418,6 +580,27 @@ func main() { } // Create scope navigations + // First, process navigation tree if provided + if len(config.NavigationTree) > 0 { + fmt.Println("Creating scope navigations from tree...") + dashboardCounter := 0 + for _, rootNode := range config.NavigationTree { + flatNavigations := treeToNavigations(rootNode, []string{}, &dashboardCounter) + for _, navWithName := range flatNavigations { + // Use the title from navWithName if Nav.Title is empty + if navWithName.Nav.Title == "" && navWithName.Title != "" { + navWithName.Nav.Title = navWithName.Title + } + if err := client.createScopeNavigation(navWithName.Name, navWithName.Nav); err != nil { + fmt.Fprintf(os.Stderr, "Error creating scope navigation %s: %v\n", navWithName.Name, err) + os.Exit(1) + } + } + } + fmt.Println() + } + + // Also support flat navigations format for backward compatibility if len(config.Navigations) > 0 { fmt.Println("Creating scope navigations...") for name, nav := range config.Navigations { diff --git a/docs/sources/administration/provisioning/index.md b/docs/sources/administration/provisioning/index.md index fadb936e5a0..15215275b53 100644 --- a/docs/sources/administration/provisioning/index.md +++ b/docs/sources/administration/provisioning/index.md @@ -254,6 +254,7 @@ Common settings in the [built-in core data sources](../../datasources/#built-in- | `incrementalQuerying` | string | Prometheus | Experimental: Turn on incremental querying to enhance dashboard reload performance with slow data sources | | `incrementalQueryOverlapWindow` | string | Prometheus | Experimental: Configure incremental query overlap window. Requires a valid duration string, for example, `180s` or `15m` Default value is `10m` (10 minutes). | | `disableRecordingRules` | boolean | Prometheus | Experimental: Turn off Prometheus recording rules | +| `seriesEndpoint` | boolean | Prometheus | Using Prometheus `/api/v1/series` endpoint | | `implementation` | string | Alertmanager | The implementation of the Alertmanager data source, such as `prometheus`, `cortex` or `mimir` | | `handleGrafanaManagedAlerts` | boolean | Alertmanager | When enabled, Grafana-managed alerts are sent to this Alertmanager | diff --git a/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md b/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md index 466e0aa99b7..92f6c6fe5e2 100644 --- a/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md +++ b/docs/sources/administration/roles-and-permissions/access-control/custom-role-actions-scopes/index.md @@ -138,6 +138,10 @@ The following list contains role-based access control actions. | `roles:read` | | List roles and read a specific role with its permissions. | | `roles:write` |