-
Notifications
You must be signed in to change notification settings - Fork 126
Add support for tag cloud panels #1667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for tag cloud panels in Kibana dashboards, allowing users to visualize word frequency data. The implementation follows the same pattern as existing XY chart panels.
Changes:
- Adds a new
tagcloud_configpanel configuration type alongside existingmarkdown_configandxy_chart_config - Implements schema definitions, model converters, and API mappers for tagcloud panels
- Includes comprehensive test coverage with basic and filtered tagcloud scenarios
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/kibana/dashboard/schema.go | Adds tagcloud schema definitions with JSON field defaults, updates panel schema to include tagcloud_config with mutual exclusivity validators |
| internal/kibana/dashboard/models_tagcloud_panel.go | Implements tagcloud panel converter with fromAPI/toAPI transformations |
| internal/kibana/dashboard/models_tagcloud_panel_test.go | Adds unit tests for tagcloud config conversions and JSON field validation |
| internal/kibana/dashboard/models_panels.go | Registers tagcloud converter in the panel converters list |
| internal/kibana/dashboard/models_filter_simple.go | Extracts shared filter simple model to separate file for reuse |
| internal/kibana/dashboard/models_filter_simple_test.go | Moves filter simple tests to new file |
| internal/kibana/dashboard/models_search_filter.go | Extracts shared search filter model to separate file for reuse |
| internal/kibana/dashboard/models_search_filter_test.go | Moves search filter tests to new file |
| internal/kibana/dashboard/models_xy_chart_panel.go | Removes filter models now extracted to separate files |
| internal/kibana/dashboard/models_xy_chart_panel_test.go | Removes filter model tests now in separate files |
| internal/kibana/dashboard/acc_test.go | Adds acceptance tests for basic and filtered tagcloud panels |
| internal/kibana/dashboard/testdata/.../basic/main.tf | Provides basic tagcloud panel test configuration |
| internal/kibana/dashboard/testdata/.../with_filters/main.tf | Provides filtered tagcloud panel test configuration |
| }, | ||
| }, | ||
| "metric": schema.StringAttribute{ | ||
| MarkdownDescription: "Metric configuration as JSON. Can be a field metric operation (count, unique count, min/max/avg/median/std dev, sum, last value, percentile, percentile ranks), a pipeline operation (differences, moving average, cumulative sum, counter rate), or a formula operation.", |
Copilot
AI
Feb 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The markdown description for the metric attribute lists operation types inconsistently. It should use consistent separators (either commas or slashes throughout, not both) and maintain parallel structure. Consider: "Can be a field metric operation (count, unique count, min, max, avg, median, std dev, sum, last value, percentile, percentile ranks), a pipeline operation (differences, moving average, cumulative sum, counter rate), or a formula operation."
| MarkdownDescription: "Metric configuration as JSON. Can be a field metric operation (count, unique count, min/max/avg/median/std dev, sum, last value, percentile, percentile ranks), a pipeline operation (differences, moving average, cumulative sum, counter rate), or a formula operation.", | |
| MarkdownDescription: "Metric configuration as JSON. Can be a field metric operation (count, unique count, min, max, avg, median, std dev, sum, last value, percentile, percentile ranks), a pipeline operation (differences, moving average, cumulative sum, counter rate), or a formula operation.", |
| return diags | ||
| } | ||
|
|
||
| // Create the nested Config1 structure |
Copilot
AI
Feb 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment refers to "Config1" but this is an implementation detail of the generated API types. Consider making this comment more descriptive about what this structure represents, e.g., "Create the nested config structure for the tagcloud panel attributes".
| // Create the nested Config1 structure | |
| // Create the nested dashboard panel config structure for the tagcloud attributes |
| MarkdownDescription: "Configuration for a tagcloud chart panel. Mutually exclusive with `markdown_config`, `xy_chart_config`, and `config_json`. Tag clouds visualize word frequency.", | ||
| Optional: true, | ||
| Attributes: getTagcloudSchema(), | ||
| Validators: []validator.Object{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to require at least one of markdown_config, xy_chart_config, tagcloud_config or config_json?
Is this TF config is valid?
panels = [{
type = "lens"
grid = { x = 0, y = 0, w = 24, h = 15 }
# No markdown_config, xy_chart_config, tagcloud_config, or config_json
}]
| func newTagcloudPanelConfigConverter() tagcloudPanelConfigConverter { | ||
| return tagcloudPanelConfigConverter{ | ||
| lensPanelConfigConverter: lensPanelConfigConverter{ | ||
| visualizationType: "tagcloud", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use enum here as we do it for XY already?
| visualizationType: "tagcloud", | |
| visualizationType: string(kbapi.TagcloudNoESQLTypeTagcloud), |
| var api kbapi.TagcloudNoESQL | ||
|
|
||
| // Set type to "tagcloud" | ||
| api.Type = "tagcloud" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| api.Type = "tagcloud" | |
| api.Type = kbapi.TagcloudNoESQLTypeTagcloud |
| assert.Equal(t, "tagcloud", converter.visualizationType) | ||
| } | ||
|
|
||
| func Test_tagcloudConfigModel_fromAPI_toAPI(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't cover filters array.
Related to #650