mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/{vmselect,vmstorage}: properly pass seriesCountByLabelName and seriesCountByFocusLabelValue entries from vmstorage to vmselect
This commit is contained in:
parent
b4e75a0b89
commit
da1d1e83df
2 changed files with 42 additions and 26 deletions
|
@ -1979,18 +1979,6 @@ func (sn *storageNode) getTSDBStatusOnConn(bc *handshake.BufferedConn, requestDa
|
||||||
}
|
}
|
||||||
|
|
||||||
func readTSDBStatus(bc *handshake.BufferedConn) (*storage.TSDBStatus, error) {
|
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)
|
totalSeries, err := readUint64(bc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot read totalSeries: %w", err)
|
return nil, fmt.Errorf("cannot read totalSeries: %w", err)
|
||||||
|
@ -1999,12 +1987,34 @@ func readTSDBStatus(bc *handshake.BufferedConn) (*storage.TSDBStatus, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot read totalLabelValuePairs: %w", err)
|
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{
|
status := &storage.TSDBStatus{
|
||||||
SeriesCountByMetricName: seriesCountByMetricName,
|
|
||||||
LabelValueCountByLabelName: labelValueCountByLabelName,
|
|
||||||
SeriesCountByLabelValuePair: seriesCountByLabelValuePair,
|
|
||||||
TotalSeries: totalSeries,
|
TotalSeries: totalSeries,
|
||||||
TotalLabelValuePairs: totalLabelValuePairs,
|
TotalLabelValuePairs: totalLabelValuePairs,
|
||||||
|
SeriesCountByMetricName: seriesCountByMetricName,
|
||||||
|
SeriesCountByLabelName: seriesCountByLabelName,
|
||||||
|
SeriesCountByFocusLabelValue: seriesCountByFocusLabelValue,
|
||||||
|
SeriesCountByLabelValuePair: seriesCountByLabelValuePair,
|
||||||
|
LabelValueCountByLabelName: labelValueCountByLabelName,
|
||||||
}
|
}
|
||||||
return status, nil
|
return status, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -862,21 +862,27 @@ func (s *Server) processVMSelectTSDBStatus(ctx *vmselectRequestCtx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeTSDBStatus(ctx *vmselectRequestCtx, status *storage.TSDBStatus) 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 {
|
if err := ctx.writeUint64(status.TotalSeries); err != nil {
|
||||||
return fmt.Errorf("cannot write totalSeries to vmselect: %w", err)
|
return fmt.Errorf("cannot write totalSeries to vmselect: %w", err)
|
||||||
}
|
}
|
||||||
if err := ctx.writeUint64(status.TotalLabelValuePairs); err != nil {
|
if err := ctx.writeUint64(status.TotalLabelValuePairs); err != nil {
|
||||||
return fmt.Errorf("cannot write totalLabelValuePairs to vmselect: %w", err)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue