Skip to content

Commit 47cd42b

Browse files
Merge branch 'main' into common-workflow-compile-upload-1
2 parents 9532643 + f04b59e commit 47cd42b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

observability-lib/grafana/panels.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ type LegendOptions struct {
5555
Placement common.LegendPlacement
5656
DisplayMode common.LegendDisplayMode
5757
Calcs []string
58+
SortBy string // Sort legend by this field (e.g., "Last *", "Max", "Mean")
59+
SortDesc bool // Sort in descending order
5860
}
5961

6062
func newLegend(options *LegendOptions) *common.VizLegendOptionsBuilder {
@@ -77,6 +79,13 @@ func newLegend(options *LegendOptions) *common.VizLegendOptionsBuilder {
7779

7880
builder.DisplayMode(options.DisplayMode)
7981

82+
if options.SortBy != "" {
83+
builder.SortBy(options.SortBy)
84+
if options.SortDesc {
85+
builder.SortDesc(true)
86+
}
87+
}
88+
8089
return builder
8190
}
8291

0 commit comments

Comments
 (0)