diff --git a/app/vmselect/netstorage/netstorage.go b/app/vmselect/netstorage/netstorage.go index 97d159b8d..2bcf5cf88 100644 --- a/app/vmselect/netstorage/netstorage.go +++ b/app/vmselect/netstorage/netstorage.go @@ -1979,18 +1979,6 @@ func (sn *storageNode) getTSDBStatusOnConn(bc *handshake.BufferedConn, requestDa } func readTSDBStatus(bc *handshake.BufferedConn) (*storage.TSDBStatus, error) { - seriesCountByMetricName, err := readTopHeapEntries(bc) - if err != nil { - return nil, fmt.Errorf("cannot read seriesCountByMetricName: %w", err) - } - labelValueCountByLabelName, err := readTopHeapEntries(bc) - if err != nil { - return nil, fmt.Errorf("cannot read labelValueCountByLabelName: %w", err) - } - seriesCountByLabelValuePair, err := readTopHeapEntries(bc) - if err != nil { - return nil, fmt.Errorf("cannot read seriesCountByLabelValuePair: %w", err) - } totalSeries, err := readUint64(bc) if err != nil { return nil, fmt.Errorf("cannot read totalSeries: %w", err) @@ -1999,12 +1987,34 @@ func readTSDBStatus(bc *handshake.BufferedConn) (*storage.TSDBStatus, error) { if err != nil { return nil, fmt.Errorf("cannot read totalLabelValuePairs: %w", err) } + seriesCountByMetricName, err := readTopHeapEntries(bc) + if err != nil { + return nil, fmt.Errorf("cannot read seriesCountByMetricName: %w", err) + } + seriesCountByLabelName, err := readTopHeapEntries(bc) + if err != nil { + return nil, fmt.Errorf("cannot read seriesCountByLabelName: %w", err) + } + seriesCountByFocusLabelValue, err := readTopHeapEntries(bc) + if err != nil { + return nil, fmt.Errorf("cannot read seriesCountByFocusLabelValue: %w", err) + } + seriesCountByLabelValuePair, err := readTopHeapEntries(bc) + if err != nil { + return nil, fmt.Errorf("cannot read seriesCountByLabelValuePair: %w", err) + } + labelValueCountByLabelName, err := readTopHeapEntries(bc) + if err != nil { + return nil, fmt.Errorf("cannot read labelValueCountByLabelName: %w", err) + } status := &storage.TSDBStatus{ - SeriesCountByMetricName: seriesCountByMetricName, - LabelValueCountByLabelName: labelValueCountByLabelName, - SeriesCountByLabelValuePair: seriesCountByLabelValuePair, - TotalSeries: totalSeries, - TotalLabelValuePairs: totalLabelValuePairs, + TotalSeries: totalSeries, + TotalLabelValuePairs: totalLabelValuePairs, + SeriesCountByMetricName: seriesCountByMetricName, + SeriesCountByLabelName: seriesCountByLabelName, + SeriesCountByFocusLabelValue: seriesCountByFocusLabelValue, + SeriesCountByLabelValuePair: seriesCountByLabelValuePair, + LabelValueCountByLabelName: labelValueCountByLabelName, } return status, nil } diff --git a/app/vmstorage/transport/server.go b/app/vmstorage/transport/server.go index 657f20d3c..494f76d9c 100644 --- a/app/vmstorage/transport/server.go +++ b/app/vmstorage/transport/server.go @@ -862,21 +862,27 @@ func (s *Server) processVMSelectTSDBStatus(ctx *vmselectRequestCtx) error { } func writeTSDBStatus(ctx *vmselectRequestCtx, status *storage.TSDBStatus) error { - if err := writeTopHeapEntries(ctx, status.SeriesCountByMetricName); err != nil { - return fmt.Errorf("cannot write seriesCountByMetricName to vmselect: %w", err) - } - if err := writeTopHeapEntries(ctx, status.LabelValueCountByLabelName); err != nil { - return fmt.Errorf("cannot write labelValueCountByLabelName to vmselect: %w", err) - } - if err := writeTopHeapEntries(ctx, status.SeriesCountByLabelValuePair); err != nil { - return fmt.Errorf("cannot write seriesCountByLabelValuePair to vmselect: %w", err) - } if err := ctx.writeUint64(status.TotalSeries); err != nil { return fmt.Errorf("cannot write totalSeries to vmselect: %w", err) } if err := ctx.writeUint64(status.TotalLabelValuePairs); err != nil { return fmt.Errorf("cannot write totalLabelValuePairs to vmselect: %w", err) } + if err := writeTopHeapEntries(ctx, status.SeriesCountByMetricName); err != nil { + return fmt.Errorf("cannot write seriesCountByMetricName to vmselect: %w", err) + } + if err := writeTopHeapEntries(ctx, status.SeriesCountByLabelName); err != nil { + return fmt.Errorf("cannot write seriesCountByLabelName to vmselect: %w", err) + } + if err := writeTopHeapEntries(ctx, status.SeriesCountByFocusLabelValue); err != nil { + return fmt.Errorf("cannot write seriesCountByFocusLabelValue to vmselect: %w", err) + } + if err := writeTopHeapEntries(ctx, status.SeriesCountByLabelValuePair); err != nil { + return fmt.Errorf("cannot write seriesCountByLabelValuePair to vmselect: %w", err) + } + if err := writeTopHeapEntries(ctx, status.LabelValueCountByLabelName); err != nil { + return fmt.Errorf("cannot write labelValueCountByLabelName to vmselect: %w", err) + } return nil }