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

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

                Author: ASF GitHub Bot
            Created on: 18/Jan/22 17:33
            Start Date: 18/Jan/22 17:33
    Worklog Time Spent: 10m 
      Work Description: lukecwik commented on a change in pull request #16547:
URL: https://github.com/apache/beam/pull/16547#discussion_r786997483



##########
File path: 
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/BatchSpannerRead.java
##########
@@ -193,15 +193,16 @@ public void processElement(ProcessContext c) throws 
Exception {
     }
 
     private ServiceCallMetric createServiceCallMetric(
-        String projectId, String databaseId, String tableId) {
+        @Nullable String projectId, String databaseId, String tableId) {
       HashMap<String, String> baseLabels = new HashMap<>();
       baseLabels.put(MonitoringInfoConstants.Labels.PTRANSFORM, "");
       baseLabels.put(MonitoringInfoConstants.Labels.SERVICE, "Spanner");
       baseLabels.put(MonitoringInfoConstants.Labels.METHOD, "Read");
       baseLabels.put(
           MonitoringInfoConstants.Labels.RESOURCE,
           GcpResourceIdentifiers.spannerTable(projectId, databaseId, tableId));
-      baseLabels.put(MonitoringInfoConstants.Labels.SPANNER_PROJECT_ID, 
projectId);
+      baseLabels.put(
+          MonitoringInfoConstants.Labels.SPANNER_PROJECT_ID, (projectId == 
null ? "" : projectId));

Review comment:
       Is there a reason we aren't using the same project id that 
SpannerOptions relies on  
[ServiceOptions#getDefaultProjectId](https://googleapis.dev/java/google-cloud-clients/0.97.0-alpha/com/google/cloud/ServiceOptions.Builder.html#setProjectId-java.lang.String-)
 if the value provider hasn't set it?
   
   We want to make sure we keep the existing behavior of getting the default 
project id within the execution environment and not when the pipeline is being 
constructed (unless there is a strong reason for the swap).




-- 
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: 710675)
    Time Spent: 40m  (was: 0.5h)

> Spanner IO request metrics requires projectId within the config when it 
> didn't in the past
> ------------------------------------------------------------------------------------------
>
>                 Key: BEAM-13665
>                 URL: https://issues.apache.org/jira/browse/BEAM-13665
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-gcp
>    Affects Versions: 2.34.0, 2.35.0
>            Reporter: Luke Cwik
>            Assignee: Niel Markwick
>            Priority: P1
>             Fix For: 2.36.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> [https://github.com/apache/beam/pull/15493] makes the GCP projectID a 
> required parameter - which it was not before, as it could be inferred from 
> the environment - and thus breaks backward compatibility.
> Specifically: BatchSpannerRead.java:175 – the toString() is not required on 
> the valueProvider, it should just be a get(), and createServiceCallMetric() 
> in line 195 should handle the situation where projectID could be null
> Also SpannerIO.java:1683 has a similar issue with the Write transform.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to