MiguelAnzoWizeline commented on a change in pull request #15183:
URL: https://github.com/apache/beam/pull/15183#discussion_r686325565
##########
File path:
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1.java
##########
@@ -901,12 +907,28 @@ private RunQueryResponse
runQueryWithRetries(RunQueryRequest request) throws Exc
Sleeper sleeper = Sleeper.DEFAULT;
BackOff backoff = RUNQUERY_BACKOFF.backoff();
while (true) {
+ HashMap<String, String> baseLabels = new HashMap<>();
+ baseLabels.put(MonitoringInfoConstants.Labels.PTRANSFORM, "TODO");
+ baseLabels.put(MonitoringInfoConstants.Labels.SERVICE, "Datastore");
+ baseLabels.put(MonitoringInfoConstants.Labels.METHOD,
"runQueryWithRetries");
+ baseLabels.put(MonitoringInfoConstants.Labels.RESOURCE, "TODO");
+ baseLabels.put(
+ MonitoringInfoConstants.Labels.BIGQUERY_PROJECT_ID,
request.getProjectId());
+ ServiceCallMetric serviceCallMetric =
+ new
ServiceCallMetric(MonitoringInfoConstants.Urns.API_REQUEST_COUNT, baseLabels);
try {
RunQueryResponse response = datastore.runQuery(request);
+ serviceCallMetric.call("ok");
rpcSuccesses.inc();
return response;
} catch (DatastoreException exception) {
rpcErrors.inc();
+ GoogleJsonError.ErrorInfo errorInfo = getErrorInfo(exception);
+ if (errorInfo == null) {
+
serviceCallMetric.call(ServiceCallMetric.CANONICAL_STATUS_UNKNOWN);
+ throw exception;
+ }
+ serviceCallMetric.call(errorInfo.getReason());
Review comment:
Hi @ajamato I followed up on the dev list thread mentioning that my
problem right now is that I don't have access to the GCP project to test it,
I'm currently asking for access.
Meanwhile, I have a question about injecting an error, you mentioned that
passing a non existing entity could be a way to do it, but passing a non
existing entity would throw an exception before we attempt a read since
[parsing](https://github.com/apache/beam/blob/ce406c69d2d06e5c5b659fa259253d5cc64249e7/sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/datastore/DataStoreReadWriteIT.java#L105)
the query throws a ParseException beforehand. I’m trying to think on another
way to cause an error but I haven’t yet thought of another possible way, most
likely the DatastoreException would be thrown in cases of connection issues?
--
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]