You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "AlbumenJ (via GitHub)" <gi...@apache.org> on 2023/09/29 12:26:41 UTC
[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #13104: Add metrics version compare
AlbumenJ commented on code in PR #13104:
URL: https://github.com/apache/dubbo/pull/13104#discussion_r1341303921
##########
dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/data/BaseStatComposite.java:
##########
@@ -133,4 +133,14 @@ public ApplicationStatComposite getApplicationStatComposite() {
public RtStatComposite getRtStatComposite() {
return rtStatComposite;
}
+
+ @Override
+ public boolean calSamplesChanged() {
+ // Should ensure that all the composite's samplesChanged have been compareAndSet, and cannot flip the `or` logic
+ boolean changed = applicationStatComposite.calSamplesChanged();
+ changed = rtStatComposite.calSamplesChanged() || changed;
+ changed = serviceStatComposite.calSamplesChanged() || changed;
+ changed = methodStatComposite.calSamplesChanged() || changed;
+ return changed;
+ }
Review Comment:
`calSamplesChanged` before check `changed` can ensure that all the samples has been updated at once.
For examle, if a composite contains A and B samples and these two samples are changed. If `calSamplesChanged` before check `changed` can update all the flags both in A and B. Thus, one time `refresh` can refresh all.
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org