enhance:Add upsert vector metrics(#29226) (#29674)

pr: https://github.com/milvus-io/milvus/pull/29226

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
pull/29705/head
smellthemoon 2024-01-05 15:44:47 +08:00 committed by GitHub
parent fc65f01ddd
commit fcd23e2ec2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -2480,10 +2480,15 @@ func (node *Proxy) Upsert(ctx context.Context, request *milvuspb.UpsertRequest)
setErrorIndex()
}
// UpsertCnt always equals to the number of entities in the request
it.result.UpsertCnt = int64(request.NumRows)
rateCol.Add(internalpb.RateType_DMLUpsert.String(), float64(it.upsertMsg.DeleteMsg.Size()+it.upsertMsg.DeleteMsg.Size()))
metrics.ProxyFunctionCall.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), method,
metrics.SuccessLabel).Inc()
successCnt := it.result.UpsertCnt - int64(len(it.result.ErrIndex))
metrics.ProxyUpsertVectors.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10)).Add(float64(successCnt))
metrics.ProxyMutationLatency.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), metrics.UpsertLabel).Observe(float64(tr.ElapseSpan().Milliseconds()))
metrics.ProxyCollectionMutationLatency.WithLabelValues(strconv.FormatInt(paramtable.GetNodeID(), 10), metrics.UpsertLabel, request.CollectionName).Observe(float64(tr.ElapseSpan().Milliseconds()))

View File

@ -51,6 +51,15 @@ var (
Help: "counter of vectors successfully inserted",
}, []string{nodeIDLabelName})
// ProxyUpsertVectors record the number of vectors upsert successfully.
ProxyUpsertVectors = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: milvusNamespace,
Subsystem: typeutil.ProxyRole,
Name: "upsert_vectors_count",
Help: "counter of vectors successfully upserted",
}, []string{nodeIDLabelName})
// ProxySQLatency record the latency of search successfully.
ProxySQLatency = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
@ -295,6 +304,7 @@ func RegisterProxy(registry *prometheus.Registry) {
registry.MustRegister(ProxyReceivedNQ)
registry.MustRegister(ProxySearchVectors)
registry.MustRegister(ProxyInsertVectors)
registry.MustRegister(ProxyUpsertVectors)
registry.MustRegister(ProxySQLatency)
registry.MustRegister(ProxyCollectionSQLatency)