Alanxtl commented on code in PR #3605:
URL: https://github.com/apache/dubbo-go/pull/3605#discussion_r3757273738
##########
metadata/report_instance.go:
##########
@@ -160,15 +160,40 @@ func (d *DelegateMetadataReport)
GetAppMetadata(application, revision string) (*
}
func (d *DelegateMetadataReport) GetServiceAppMapping(application string,
group string, listener mapping.MappingListener) (*gxset.HashSet, error) {
- return d.instance.GetServiceAppMapping(application, group, listener)
+ event :=
metadataMetrics.NewMetadataMetricTimeEvent(metadataMetrics.MetadataMappingGet)
+ event.Attachment[constant.InterfaceKey] = application
+ event.Attachment[constant.GroupKey] = group
+ if listener != nil {
+ event.Name = metadataMetrics.MetadataMappingListen
+ }
+ set, err := d.instance.GetServiceAppMapping(application, group,
listener)
+ event.Succ = err == nil
+ event.End = time.Now()
+ metrics.Publish(event)
+ return set, err
Review Comment:
listen 操作在多 metadata report 下会被误计为 get
在 metadata/report_instance.go:162 里,事件类型靠 `listener != nil` 判断。但
service_name_mapping.go:144 对一次 `Get(..., listener)` 只把 listener 传给 primary
report,其余 report 传 `nil`。所以多 report 场景下一次业务上的 listen 会产生 `1` 个 listen 指标和 `N-1`
个 get 指标,`dubbo_metadata_mapping_get_*` 会被 listen 流量污染。建议在上层按业务操作类型打点,或显式把
operation 传入 delegate/指标事件,而不是从底层 listener 参数反推。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]