[ENHANCEMENT] Improve table migration: handle column overrides and fix Value column naming#654
Merged
Merged
Conversation
Signed-off-by: Akshay Iyyadurai Balasundaram <akshay.iyyadurai.balasundaram@sap.com>
9de10c3 to
7625d5f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Improves the Grafana-to-Perses table migration CUE script to handle previously-unsupported field override properties and fixes the
Value #X→value #Ncolumn naming mismatch.Fixes perses/perses#4063
Problem
When migrating a Grafana table panel with multiple queries and column overrides, several issues occurred:
Value #A,Value #B), but Perses uses 1-based query index (value #1,value #2). The migrated column settings didn't match actual rendered column names, making them ineffective.unit,mappings, andnoValuewere completely ignored during migration, resulting in:0→"False",1→"True")Changes
1. Fix Value column naming (refId → index)
Builds a mapping from the
targetsarray to convert Grafana's refId-based naming to Perses's index-based naming automatically:Value #A→value #1(first query)Value #B→value #2(second query)2. Handle
unitoverride → per-columnformatGrafana field overrides with
"id": "unit"are now converted toformat: {unit: "..."}on the corresponding column setting. Only units recognized by Perses are emitted (e.g.,percent,bytes,seconds). Unrecognized Grafana-specific units (e.g.,decgbytes,dectbytes) are skipped.3. Handle
mappingsoverride → per-columncellSettingsGrafana field overrides with
"id": "mappings"(value-type) are now converted to column-levelcellSettingsentries withValueconditions.4. Handle
noValueoverride → per-columncellSettingsGrafana field overrides with
"id": "noValue"are now converted to acellSettingsentry with aMisccondition for"null", displaying the specified fallback text when a cell has no value.I have added couple of tests for these changes. All the existing 23 tests are passing as well.
Limitations
decgbytes,dectbytes,kbytes,mbytes,gbytes,tbytes) are not migrated. These columns are left unformatted. A future Perses enhancement could add support for these scaled byte units.JoinByColumnValuetransform cannot be inferred automatically from Grafana'smergetransformation (which works implicitly). Users may need to add this manually after migration for multi-query tables.Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes