[ 
https://issues.apache.org/jira/browse/BEAM-11983?focusedWorklogId=638427&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-638427
 ]

ASF GitHub Bot logged work on BEAM-11983:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Aug/21 22:31
            Start Date: 16/Aug/21 22:31
    Worklog Time Spent: 10m 
      Work Description: MiguelAnzoWizeline commented on a change in pull 
request #15183:
URL: https://github.com/apache/beam/pull/15183#discussion_r689901411



##########
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, I followed up in the dev list mail. I'm modifying the select query 
with non existent tables and fields, and the sql parser is throwing an 
exception before going to the Datastore reader. 
   Also the log in the previous comment was made running the integration test 
in local and manually throwing a DatastoreException after the 
[datastore.runQuery()](https://github.com/apache/beam/blob/089ca7a62be86ad7865308f2cbd676bb18d7d648/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/datastore/DatastoreV1.java#L921)
 call to go to the error path.




-- 
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 638427)
    Time Spent: 8h 20m  (was: 8h 10m)

> Java Datastore - Implement IO Request Count metrics
> ---------------------------------------------------
>
>                 Key: BEAM-11983
>                 URL: https://issues.apache.org/jira/browse/BEAM-11983
>             Project: Beam
>          Issue Type: Test
>          Components: io-java-gcp
>            Reporter: Alex Amato
>            Assignee: Miguel Anzo
>            Priority: P3
>          Time Spent: 8h 20m
>  Remaining Estimate: 0h
>
> Reference PRs (See BigQuery IO example) and detailed explanation of what's 
> needed to instrument this IO with Request Count metrics is found in this 
> handoff doc:
> [https://docs.google.com/document/d/1lrz2wE5Dl4zlUfPAenjXIQyleZvqevqoxhyE85aj4sc/edit]
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to