Skip to content

Commit ad4f9a6

Browse files
committed
fix: address review comments
- Fix comment examples to match actual Grafana format ("Last *", "Max") - Only set SortDesc when true to avoid unnecessary explicit false values
1 parent 1ff9717 commit ad4f9a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

observability-lib/grafana/panels.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ 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")
58+
SortBy string // Sort legend by this field (e.g., "Last *", "Max", "Mean")
5959
SortDesc bool // Sort in descending order
6060
}
6161

@@ -81,7 +81,9 @@ func newLegend(options *LegendOptions) *common.VizLegendOptionsBuilder {
8181

8282
if options.SortBy != "" {
8383
builder.SortBy(options.SortBy)
84-
builder.SortDesc(options.SortDesc)
84+
if options.SortDesc {
85+
builder.SortDesc(true)
86+
}
8587
}
8688

8789
return builder

0 commit comments

Comments
 (0)