macksclark commented on a change in pull request #14233:
URL: https://github.com/apache/beam/pull/14233#discussion_r595526804
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java
##########
@@ -378,6 +381,29 @@ public static Deidentify deidentify(
return new Deidentify(sourceFhirStore, destinationFhirStore, deidConfig);
}
+ /**
+ * Increments success and failure counters for an LRO. To be used after the
LRO has completed.
+ * This function leverages the fact that the LRO metadata is always of the
format: "counter": {
+ * "success": "1", "failure": "1" }
+ *
+ * @param operation LRO operation object.
+ * @param successCounter the success counter for this operation.
+ * @param failureCounter the failure counter for this operation.
+ */
+ private static void incrementLroCounters(
+ Operation operation, Counter successCounter, Counter failureCounter) {
+ Map<String, Object> opMetadata = operation.getMetadata();
+ if (opMetadata.containsKey(LRO_COUNTER_KEY)) {
+ Map<String, String> counters = (Map<String, String>)
opMetadata.get(LRO_COUNTER_KEY);
Review comment:
We are technically guaranteed that this will be a map since the
GetOperation method is in GA with a 2 year deprecation period (if it's ever
decided to deprecate or change it) - but I put it all in a try catch block
anyways.
----------------------------------------------------------------
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]