Fix bug: wrong metrics name and forget to register metrics (#16714)

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/16747/head
zhenshan.cao 2022-04-29 15:35:47 +08:00 committed by GitHub
parent 93416d5524
commit 97757405de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 7 deletions

View File

@ -91,6 +91,7 @@ func (m *meta) reloadFromKV() error {
}
}
metrics.DataCoordNumStoredRows.WithLabelValues().Set(float64(numStoredRows))
metrics.DataCoordNumStoredRowsCounter.WithLabelValues().Add(float64(numStoredRows))
return nil
}
@ -224,6 +225,7 @@ func (m *meta) SetState(segmentID UniqueID, state commonpb.SegmentState) error {
metrics.DataCoordNumSegments.WithLabelValues(string(state)).Inc()
if state == commonpb.SegmentState_Flushed {
metrics.DataCoordNumStoredRows.WithLabelValues().Add(float64(curSegInfo.GetNumOfRows()))
metrics.DataCoordNumStoredRowsCounter.WithLabelValues().Add(float64(curSegInfo.GetNumOfRows()))
} else if oldState == commonpb.SegmentState_Flushed {
metrics.DataCoordNumStoredRows.WithLabelValues().Sub(float64(curSegInfo.GetNumOfRows()))
}
@ -380,6 +382,7 @@ func (m *meta) UpdateFlushSegmentsInfo(
metrics.DataCoordNumSegments.WithLabelValues(string(newSegmentState)).Inc()
if newSegmentState == commonpb.SegmentState_Flushed {
metrics.DataCoordNumStoredRows.WithLabelValues().Add(float64(clonedSegment.GetNumOfRows()))
metrics.DataCoordNumStoredRowsCounter.WithLabelValues().Add(float64(clonedSegment.GetNumOfRows()))
} else if oldSegmentState == commonpb.SegmentState_Flushed {
metrics.DataCoordNumStoredRows.WithLabelValues().Sub(float64(segment.GetNumOfRows()))
}

View File

@ -68,6 +68,14 @@ var (
Help: "number of stored rows",
}, []string{})
DataCoordNumStoredRowsCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: milvusNamespace,
Subsystem: typeutil.DataCoordRole,
Name: "stored_rows_count",
Help: "count of all stored rows ever",
}, []string{})
DataCoordSyncEpoch = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: milvusNamespace,

View File

@ -114,7 +114,7 @@ var (
prometheus.GaugeOpts{
Namespace: milvusNamespace,
Subsystem: typeutil.RootCoordRole,
Name: "msgstream_num",
Name: "msgstream_obj_num",
Help: "number of message streams",
})
@ -136,7 +136,8 @@ func RegisterRootCoord(registry *prometheus.Registry) {
registry.MustRegister(RootCoordInsertChannelTimeTick)
registry.MustRegister(RootCoordSyncTimeTickLatency)
// for DDL latency
// for DDL
registry.MustRegister(RootCoordDDLReqCounter)
registry.MustRegister(RootCoordDDLReqLatency)
// for allocator

View File

@ -2455,6 +2455,7 @@ func (node *Proxy) Search(ctx context.Context, request *milvuspb.SearchRequest)
},
}, nil
}
tr.Record("search request enqueue")
log.Debug(
rpcEnqueued(method),
@ -2500,6 +2501,9 @@ func (node *Proxy) Search(ctx context.Context, request *milvuspb.SearchRequest)
}, nil
}
span := tr.Record("wait search result")
metrics.ProxyWaitForSearchResultLatency.WithLabelValues(strconv.FormatInt(Params.ProxyCfg.GetNodeID(), 10),
metrics.SearchLabel).Observe(float64(span.Milliseconds()))
log.Debug(
rpcDone(method),
zap.String("traceID", traceID),
@ -2517,7 +2521,6 @@ func (node *Proxy) Search(ctx context.Context, request *milvuspb.SearchRequest)
metrics.ProxyDQLFunctionCall.WithLabelValues(strconv.FormatInt(Params.ProxyCfg.GetNodeID(), 10), method,
metrics.SuccessLabel).Inc()
metrics.ProxySearchVectors.WithLabelValues(strconv.FormatInt(Params.ProxyCfg.GetNodeID(), 10)).Add(float64(qt.result.GetResults().GetNumQueries()))
searchDur := tr.ElapseSpan().Milliseconds()
metrics.ProxySearchLatency.WithLabelValues(strconv.FormatInt(Params.ProxyCfg.GetNodeID(), 10),
@ -2681,6 +2684,7 @@ func (node *Proxy) Query(ctx context.Context, request *milvuspb.QueryRequest) (*
},
}, nil
}
tr.Record("query request enqueue")
log.Debug(
rpcEnqueued(method),
@ -2716,7 +2720,9 @@ func (node *Proxy) Query(ctx context.Context, request *milvuspb.QueryRequest) (*
},
}, nil
}
span := tr.Record("wait query result")
metrics.ProxyWaitForSearchResultLatency.WithLabelValues(strconv.FormatInt(Params.ProxyCfg.GetNodeID(), 10),
metrics.QueryLabel).Observe(float64(span.Milliseconds()))
log.Debug(
rpcDone(method),
zap.String("traceID", traceID),

View File

@ -252,9 +252,9 @@ func (h *historical) searchSegments(segIDs []UniqueID, searchReqs []*searchReque
searchResult, err := seg.search(plan, searchReqs, []Timestamp{searchTs})
// update metrics
metrics.QueryNodeSQSegmentLatency.WithLabelValues(metrics.SearchLabel,
metrics.SealedSegmentLabel,
fmt.Sprint(Params.QueryNodeCfg.GetNodeID())).Observe(float64(tr.ElapseSpan().Milliseconds()))
metrics.QueryNodeSQSegmentLatency.WithLabelValues(fmt.Sprint(Params.QueryNodeCfg.GetNodeID()),
metrics.SearchLabel,
metrics.SealedSegmentLabel).Observe(float64(tr.ElapseSpan().Milliseconds()))
// write back result into list
lock.Lock()