From 11cf858166ec8511d86c1bf24185bddc23eb5b97 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 10 Nov 2025 17:55:30 +0000 Subject: [PATCH] Small refactor: use clearer name formatSeriesSetLabelsToJSON Signed-off-by: Bryan Boreham --- cmd/promtool/main.go | 2 +- cmd/promtool/tsdb.go | 2 +- cmd/promtool/tsdb_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/promtool/main.go b/cmd/promtool/main.go index 1b36d518ee..ea4e066586 100644 --- a/cmd/promtool/main.go +++ b/cmd/promtool/main.go @@ -421,7 +421,7 @@ func main() { case tsdbDumpCmd.FullCommand(): if *dumpFormat == "seriesjson" { - os.Exit(checkErr(dumpTSDBData(ctx, *dumpPath, *dumpSandboxDirRoot, *dumpMinTime, *dumpMaxTime, *dumpMatch, formatSeriesSetToJSON))) + os.Exit(checkErr(dumpTSDBData(ctx, *dumpPath, *dumpSandboxDirRoot, *dumpMinTime, *dumpMaxTime, *dumpMatch, formatSeriesSetLabelsToJSON))) } else { os.Exit(checkErr(dumpTSDBData(ctx, *dumpPath, *dumpSandboxDirRoot, *dumpMinTime, *dumpMaxTime, *dumpMatch, formatSeriesSet))) } diff --git a/cmd/promtool/tsdb.go b/cmd/promtool/tsdb.go index ab822f2e7e..14ec051df2 100644 --- a/cmd/promtool/tsdb.go +++ b/cmd/promtool/tsdb.go @@ -799,7 +799,7 @@ func CondensedString(ls labels.Labels) string { return b.String() } -func formatSeriesSetToJSON(ss storage.SeriesSet) error { +func formatSeriesSetLabelsToJSON(ss storage.SeriesSet) error { seriesCache := make(map[string]struct{}) for ss.Next() { series := ss.At() diff --git a/cmd/promtool/tsdb_test.go b/cmd/promtool/tsdb_test.go index ea2f28083d..286456fee3 100644 --- a/cmd/promtool/tsdb_test.go +++ b/cmd/promtool/tsdb_test.go @@ -175,7 +175,7 @@ func TestTSDBDump(t *testing.T) { // Sort both, because Prometheus does not guarantee the output order. require.Equal(t, sortLines(string(expectedMetrics)), sortLines(dumpedMetrics)) - dumpedSeries := getDumpedSamples(t, storage.Dir(), tt.sandboxDirRoot, tt.mint, tt.maxt, tt.match, formatSeriesSetToJSON) + dumpedSeries := getDumpedSamples(t, storage.Dir(), tt.sandboxDirRoot, tt.mint, tt.maxt, tt.match, formatSeriesSetLabelsToJSON) expectedSeries, err := os.ReadFile(tt.expectedSeries) require.NoError(t, err) expectedSeries = normalizeNewLine(expectedSeries)