[FEATURE] Add panel-level annotations to the data model - #61
Merged
nicolastakashi merged 1 commit intoJul 31, 2026
Merged
Conversation
nicolastakashi
force-pushed
the
draft/panel-level-annotations-model
branch
from
July 30, 2026 10:43
9852027 to
a52f6e1
Compare
nicolastakashi
marked this pull request as ready for review
July 30, 2026 10:43
Gladorme
reviewed
Jul 30, 2026
Gladorme
left a comment
Member
There was a problem hiding this comment.
Did we not say we are dropping enabled? And PanelSpec now has annotations []AnnotationSpec directly?
| // Enabled toggles the display of dashboard-level annotations on this panel. | ||
| // A nil value is treated as enabled, matching the "on by default" behavior of the | ||
| // two-level annotation design. | ||
| enabled?: null | bool @go(Enabled,*bool) |
Member
There was a problem hiding this comment.
We said we are dropping this enabled, no?
As there is "hide" in display
| // Enabled toggles the display of dashboard-level annotations on this panel. | ||
| // A nil value is treated as enabled, matching the "on by default" behavior of the | ||
| // two-level annotation design. | ||
| Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` |
|
|
||
| export interface PanelAnnotations { | ||
| // Toggles the display of dashboard-level annotations on this panel. Undefined is treated as enabled. | ||
| enabled?: boolean; |
| plugin: plugin_9.#Plugin @go(Plugin) | ||
| queries?: [...#Query] @go(Queries,[]Query) | ||
| links?: [...#Link] @go(Links,[]Link) | ||
| annotations?: null | #PanelAnnotations @go(Annotations,*PanelAnnotations) |
Member
There was a problem hiding this comment.
Suggested change
| annotations?: null | #PanelAnnotations @go(Annotations,*PanelAnnotations) | |
| annotations?: null | [...#AnnotationSpec] @go(Definitions,[]AnnotationSpec) |
nicolastakashi
force-pushed
the
draft/panel-level-annotations-model
branch
from
July 31, 2026 10:34
a52f6e1 to
038c137
Compare
Add an optional annotations list to PanelSpec so annotations can be configured per panel, following the two-level annotation design discussed in perses/perses#3001. Panel-local annotations reuse the existing AnnotationSpec type and mirror the dashboard-level Spec.Annotations shape. They apply only to their own panel, on top of the dashboard-level annotations that apply to every panel. Per-annotation visibility is handled by AnnotationSpec.Display.Hidden, so no panel-level toggle is needed. Regenerate the CUE mirror and update the TypeScript and Java mirrors to match. Signed-off-by: Nicolas Takashi <nicolas.takashi@dash0.com>
nicolastakashi
force-pushed
the
draft/panel-level-annotations-model
branch
from
July 31, 2026 10:36
038c137 to
bfa1d48
Compare
nicolastakashi
added a commit
to nicolastakashi/perses
that referenced
this pull request
Jul 31, 2026
Extend ValidatePanels so that panel-local annotation definitions (PanelSpec.Annotations.Definitions) are schema-validated through the existing ValidateAnnotations path, exactly like dashboard-level annotations. No new plugin kind is introduced; KindAnnotation already exists. Add annotation schema and sample fixtures plus a TestValidatePanelsWithAnnotations covering a valid definition, an unknown annotation kind, the toggle-only case, and a panel with no annotations block. Depends on the panel-level annotations data model in perses/spec#61. Signed-off-by: Nicolas Takashi <nicolas.takashi@dash0.com>
Merged
nicolastakashi
added a commit
to nicolastakashi/perses
that referenced
this pull request
Aug 4, 2026
Extend ValidatePanels so that panel-local annotation definitions (PanelSpec.Annotations.Definitions) are schema-validated through the existing ValidateAnnotations path, exactly like dashboard-level annotations. No new plugin kind is introduced; KindAnnotation already exists. Add annotation schema and sample fixtures plus a TestValidatePanelsWithAnnotations covering a valid definition, an unknown annotation kind, the toggle-only case, and a panel with no annotations block. Depends on the panel-level annotations data model in perses/spec#61. Signed-off-by: Nicolas Takashi <nicolas.takashi@dash0.com>
nicolastakashi
added a commit
to nicolastakashi/perses
that referenced
this pull request
Aug 4, 2026
Extend ValidatePanels so that panel-local annotation definitions (PanelSpec.Annotations.Definitions) are schema-validated through the existing ValidateAnnotations path, exactly like dashboard-level annotations. No new plugin kind is introduced; KindAnnotation already exists. Add annotation schema and sample fixtures plus a TestValidatePanelsWithAnnotations covering a valid definition, an unknown annotation kind, the toggle-only case, and a panel with no annotations block. Depends on the panel-level annotations data model in perses/spec#61. Signed-off-by: Nicolas Takashi <nicolas.takashi@dash0.com>
nicolastakashi
added a commit
to nicolastakashi/perses
that referenced
this pull request
Aug 4, 2026
Extend ValidatePanels so that panel-local annotation definitions (PanelSpec.Annotations.Definitions) are schema-validated through the existing ValidateAnnotations path, exactly like dashboard-level annotations. No new plugin kind is introduced; KindAnnotation already exists. Add annotation schema and sample fixtures plus a TestValidatePanelsWithAnnotations covering a valid definition, an unknown annotation kind, the toggle-only case, and a panel with no annotations block. Depends on the panel-level annotations data model in perses/spec#61. Signed-off-by: Nicolas Takashi <nicolas.takashi@dash0.com>
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.
What this does
This adds an optional
annotationsblock toPanelSpecso annotations can be set per panel. It follows the two-level annotation design being discussed in perses/perses#3001. The dashboard-level half of that design already shipped, and this PR is the data model for the panel-level half.Enabledis a pointer so an omitted value means "on", which is the default-on behavior from the design.Definitionsreuses the existingAnnotationSpectype instead of a new parallel shape.Scope
This is the data model only. It does not touch backend validation, the frontend consumer hook, the panel editor, or Grafana migration, which I will send as separate follow-ups to keep this one small. I opened it as a draft because the shape is still under discussion on #3001, and I would rather agree on that before building the layers on top of it.
Mirrors
The Go types are the source of truth. I regenerated the CUE mirror with
make cue-gen(not hand-edited) and updated the TypeScript (ts/src/dashboard/panel.ts) and Java (.../dashboard/panel/PanelSpec.javaplus a newPanelAnnotations.java) mirrors by hand.Validation
Panel-local definitions get validated without any extra code.
AnnotationSpec.UnmarshalJSONalready callsvalidate(), which requires a non-empty name, and that runs when a definition is unmarshaled inside aPanelSpec. So I did not add validation toPanelSpecitself.Testing
go/dashboard/panel_test.gocovers JSON and YAML round-trips, the default-on case when the block is omitted, and rejection of a definition with an empty name.make cue-gen cue-eval: cleango test ./go/...: all passgofmt -l go/: clean