ajamato commented on a change in pull request #11184: [BEAM-4374] Update protos 
related to MonitoringInfo.
URL: https://github.com/apache/beam/pull/11184#discussion_r398795863
 
 

 ##########
 File path: 
runners/core-java/src/test/java/org/apache/beam/runners/core/metrics/MonitoringInfoMatchers.java
 ##########
 @@ -28,30 +31,17 @@
    * Matches a {@link MonitoringInfo} with that has the set fields in the 
provide MonitoringInfo.
    *
    * <p>This is useful for tests which do not want to match the specific value 
(execution times).
-   * Currently this will only check for URNs, labels, type URNs and 
int64Values.
+   * Currently this will only check for URNs, labels, type URNs and payloads.
    */
   public static TypeSafeMatcher<MonitoringInfo> matchSetFields(final 
MonitoringInfo mi) {
     return new TypeSafeMatcher<MonitoringInfo>() {
 
       @Override
       protected boolean matchesSafely(MonitoringInfo item) {
-        if (!item.getUrn().equals(mi.getUrn())) {
-          return false;
-        }
-        if (!item.getLabels().equals(mi.getLabels())) {
-          return false;
-        }
-        if (!item.getType().equals(mi.getType())) {
-          return false;
-        }
-
-        if (mi.getMetric().hasCounterData()) {
-          long valueToMatch = mi.getMetric().getCounterData().getInt64Value();
-          if (valueToMatch != 
item.getMetric().getCounterData().getInt64Value()) {
-            return false;
-          }
-        }
-        return true;
+        return (mi.getUrn().isEmpty() || mi.getUrn().equals(item.getUrn()))
 
 Review comment:
   Why did you add the isEmpty() checks, this looks like the old matcher didn't 
have this logic, and it would match if you initialized the matcher with an 
empty monitoring info

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to