diff --git a/.cloudbuild/library_generation/library_generation.Dockerfile b/.cloudbuild/library_generation/library_generation.Dockerfile
index 1af24b85e2..6242a67c12 100644
--- a/.cloudbuild/library_generation/library_generation.Dockerfile
+++ b/.cloudbuild/library_generation/library_generation.Dockerfile
@@ -67,7 +67,7 @@ ENV DOCKER_GAPIC_GENERATOR_VERSION="2.45.1-SNAPSHOT"
# {x-version-update-end}
# use Docker Buildkit caching for faster local builds
-RUN --mount=type=cache,target=/root/.m2 mvn install -T 1.5C \
+RUN --mount=type=cache,target=/root/.m2 mvn install -B -ntp -T 1.5C \
-DskipTests -Dclirr.skip -Dcheckstyle.skip -Djacoco.skip -Dmaven.test.skip \
-Dmaven.site.skikip -Dmaven.javadoc.skip -pl gapic-generator-java -am
diff --git a/.github/scripts/action.yaml b/.github/scripts/action.yaml
new file mode 100644
index 0000000000..cf6a9f6360
--- /dev/null
+++ b/.github/scripts/action.yaml
@@ -0,0 +1,60 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# GitHub action job to test core java library features on
+# downstream client libraries before they are released.
+
+# This composite action should be used in google-cloud-java and handwritten
+# libraries to generate changed libraries.
+# This composite action serves as a source of truth of scripts that run
+# library generation and create pull requests.
+name: Hermetic library generation
+description: Runs hermetic library generation to produce changed libraries
+inputs:
+ base_ref:
+ description: base branch
+ required: true
+ head_ref:
+ description: head branch
+ required: true
+ image_tag:
+ description: the tag of hermetic build image
+ required: false
+ token:
+ description: Personal Access Token
+ required: true
+
+runs:
+ using: "composite"
+ steps:
+ - name: Copy shell script
+ shell: bash
+ run: |
+ cd ${{ github.action_path }}
+ cp hermetic_library_generation.sh $GITHUB_WORKSPACE
+ - name: Generate changed libraries
+ shell: bash
+ run: |
+ set -x
+ [ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com"
+ [ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
+ cd "${GITHUB_WORKSPACE}"
+ bash hermetic_library_generation.sh \
+ --target_branch "${BASE_REF}" \
+ --current_branch "${HEAD_REF}" \
+ --image_tag "${IMAGE_TAG}"
+ env:
+ BASE_REF: ${{ inputs.base_ref }}
+ HEAD_REF: ${{ inputs.head_ref }}
+ IMAGE_TAG: ${{ inputs.image_tag }}
+ GH_TOKEN: ${{ inputs.token }}
diff --git a/.github/scripts/hermetic_library_generation.sh b/.github/scripts/hermetic_library_generation.sh
index 861f28d9bd..73f4a39426 100755
--- a/.github/scripts/hermetic_library_generation.sh
+++ b/.github/scripts/hermetic_library_generation.sh
@@ -22,7 +22,8 @@ set -e
# The parameters of this script is:
# 1. target_branch, the branch into which the pull request is merged.
# 2. current_branch, the branch with which the pull request is associated.
-# 3. [optional] generation_config, the path to the generation configuration,
+# 3. [optional] image_tag, the tag of gcr.io/cloud-devrel-public-resources/java-library-generation.
+# 4. [optional] generation_config, the path to the generation configuration,
# the default value is generation_config.yaml in the repository root.
while [[ $# -gt 0 ]]; do
key="$1"
@@ -35,6 +36,10 @@ case "${key}" in
current_branch="$2"
shift
;;
+ --image_tag)
+ image_tag="$2"
+ shift
+ ;;
--generation_config)
generation_config="$2"
shift
@@ -62,7 +67,10 @@ if [ -z "${generation_config}" ]; then
echo "Use default generation config: ${generation_config}"
fi
-image_tag=local
+if [ -z "${image_tag}" ]; then
+ image_tag=$(grep "gapic_generator_version" "${generation_config}" | cut -d ':' -f 2 | xargs)
+fi
+
workspace_name="/workspace"
baseline_generation_config="baseline_generation_config.yaml"
message="chore: generate libraries at $(date)"
@@ -73,40 +81,32 @@ git checkout "${current_branch}"
# copy generation configuration from target branch to current branch.
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"
-generator_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -pl gapic-generator-java)
-echo "Local generator version: ${generator_version}"
-
-# install generator locally since we're using a SNAPSHOT version.
-mvn -V -B -ntp clean install -DskipTests
+# get .m2 folder so it's mapped into the docker container
+m2_folder=$(dirname "$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout)")
-# build image locally since we want to include latest change.
-docker build \
- -f .cloudbuild/library_generation/library_generation.Dockerfile \
- -t gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \
- .
# run hermetic code generation docker image.
docker run \
--rm \
-u "$(id -u):$(id -g)" \
-v "$(pwd):${workspace_name}" \
- -v "$HOME"/.m2:/home/.m2 \
- -e GENERATOR_VERSION="${generator_version}" \
+ -v "${m2_folder}":/home/.m2 \
+ -e GENERATOR_VERSION="${image_tag}" \
gcr.io/cloud-devrel-public-resources/java-library-generation:"${image_tag}" \
--baseline-generation-config-path="${workspace_name}/${baseline_generation_config}" \
--current-generation-config-path="${workspace_name}/${generation_config}"
# commit the change to the pull request.
rm -rdf output googleapis "${baseline_generation_config}"
-git add --all -- ':!pr_description.txt'
+git add --all -- ':!pr_description.txt' ':!hermetic_library_generation.sh'
changed_files=$(git diff --cached --name-only)
-if [[ "${changed_files}" == "" ]]; then
- echo "There is no generated code change."
- echo "Skip committing to the pull request."
- exit 0
+if [[ "${changed_files}" != "" ]]; then
+ echo "Commit changes..."
+ git commit -m "${message}"
+ git push
+else
+ echo "There is no generated code change, skip commit."
fi
-git commit -m "${message}"
-git push
# set pr body if pr_description.txt is generated.
if [[ -f "pr_description.txt" ]]; then
pr_num=$(gh pr list -s open -H "${current_branch}" -q . --json number | jq ".[] | .number")
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 6e3a6b85d5..e35def3e21 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -330,7 +330,7 @@ jobs:
run: |
mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
- name: Validate gapic-generator-java-bom
- uses: googleapis/java-cloud-bom/tests/validate-bom@6626f91d2ea122ba19d15e33c8a6bc21aebe5177
+ uses: googleapis/java-cloud-bom/tests/validate-bom@06f632d634598a149339826143ee9533b7dbfac5
with:
bom-path: gapic-generator-java-bom/pom.xml
diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml
index 9a2cf40d03..ea29373da3 100644
--- a/.github/workflows/hermetic_library_generation.yaml
+++ b/.github/workflows/hermetic_library_generation.yaml
@@ -24,24 +24,41 @@ jobs:
library_generation:
runs-on: ubuntu-latest
steps:
+ - name: Determine whether the pull request comes from a fork
+ run: |
+ if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
+ echo "This PR comes from a fork. Skip library generation."
+ echo "SHOULD_RUN=false" >> $GITHUB_ENV
+ else
+ echo "SHOULD_RUN=true" >> $GITHUB_ENV
+ fi
- uses: actions/checkout@v4
+ if: env.SHOULD_RUN == 'true'
with:
fetch-depth: 0
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
- - name: Generate changed libraries
+ - name: Install Maven modules
+ if: env.SHOULD_RUN == 'true'
shell: bash
run: |
- set -x
- if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
- echo "This PR comes from a fork. Skip library generation."
- exit 0
- fi
- [ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com"
- [ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
- bash .github/scripts/hermetic_library_generation.sh \
- --target_branch "${base_ref}" \
- --current_branch "${head_ref}"
+ git checkout "${HEAD_REF}"
+ mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip
env:
+ HEAD_REF: ${{ github.head_ref }}
+ - name: Build image
+ if: env.SHOULD_RUN == 'true'
+ shell: bash
+ run: |
+ GENERATOR_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -pl gapic-generator-java)
+ echo "GENERATOR_VERSION=${GENERATOR_VERSION}" >> "$GITHUB_ENV"
+ docker build \
+ -f .cloudbuild/library_generation/library_generation.Dockerfile \
+ -t gcr.io/cloud-devrel-public-resources/java-library-generation:"${GENERATOR_VERSION}" \
+ .
+ - uses: ./.github/scripts
+ if: env.SHOULD_RUN == 'true'
+ with:
base_ref: ${{ github.base_ref }}
head_ref: ${{ github.head_ref }}
- GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
+ image_tag: ${{ env.GENERATOR_VERSION }}
+ token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
diff --git a/gapic-generator-java-pom-parent/pom.xml b/gapic-generator-java-pom-parent/pom.xml
index d77376f292..8cdec9b97e 100644
--- a/gapic-generator-java-pom-parent/pom.xml
+++ b/gapic-generator-java-pom-parent/pom.xml
@@ -32,9 +32,9 @@
2.11.0
33.3.0-jre
3.25.4
- 1.42.0
+ 1.42.1
8
- 2.31.0
+ 2.32.0
3.0.0
1.6.9
5.11.0
diff --git a/gax-java/dependencies.properties b/gax-java/dependencies.properties
index 129ad78a64..0a3a440fc3 100644
--- a/gax-java/dependencies.properties
+++ b/gax-java/dependencies.properties
@@ -35,11 +35,11 @@ version.io_grpc=1.66.0
# It should be constructed the following way:
# 1) Take full artifact id (including the group and classifier (if any) portions) and remove version portion.
# 2) Replace all characters which are neither alphabetic nor digits with the underscore ('_') character
-maven.com_google_api_grpc_proto_google_common_protos=com.google.api.grpc:proto-google-common-protos:2.43.0
-maven.com_google_api_grpc_grpc_google_common_protos=com.google.api.grpc:grpc-google-common-protos:2.43.0
+maven.com_google_api_grpc_proto_google_common_protos=com.google.api.grpc:proto-google-common-protos:2.44.0
+maven.com_google_api_grpc_grpc_google_common_protos=com.google.api.grpc:grpc-google-common-protos:2.44.0
maven.com_google_auth_google_auth_library_oauth2_http=com.google.auth:google-auth-library-oauth2-http:1.25.0
maven.com_google_auth_google_auth_library_credentials=com.google.auth:google-auth-library-credentials:1.25.0
-maven.io_opentelemetry_opentelemetry_api=io.opentelemetry:opentelemetry-api:1.42.0
+maven.io_opentelemetry_opentelemetry_api=io.opentelemetry:opentelemetry-api:1.42.1
maven.io_opencensus_opencensus_api=io.opencensus:opencensus-api:0.31.1
maven.io_opencensus_opencensus_contrib_grpc_metrics=io.opencensus:opencensus-contrib-grpc-metrics:0.31.1
maven.io_opencensus_opencensus_contrib_http_util=io.opencensus:opencensus-contrib-http-util:0.31.1
@@ -63,14 +63,14 @@ maven.com_google_guava_failureaccess=com.google.guava:failureaccess:1.0.2
maven.org_apache_commons_commons_lang3=org.apache.commons:commons-lang3:3.17.0
maven.com_google_android_annotations=com.google.android:annotations:4.1.1.4
maven.com_google_code_findbugs_jsr305=com.google.code.findbugs:jsr305:3.0.2
-maven.com_google_errorprone_error_prone_annotations=com.google.errorprone:error_prone_annotations:2.31.0
+maven.com_google_errorprone_error_prone_annotations=com.google.errorprone:error_prone_annotations:2.32.0
maven.com_google_j2objc_j2objc_annotations=com.google.j2objc:j2objc-annotations:2.8
maven.com_google_auto_value_auto_value=com.google.auto.value:auto-value:1.11.0
maven.com_google_auto_value_auto_value_annotations=com.google.auto.value:auto-value-annotations:1.11.0
-maven.com_google_api_api_common=com.google.api:api-common:2.35.0
+maven.com_google_api_api_common=com.google.api:api-common:2.36.0
maven.org_threeten_threetenbp=org.threeten:threetenbp:1.6.9
-maven.com_google_api_grpc_grpc_google_iam_v1=com.google.api.grpc:grpc-google-iam-v1:1.38.0
-maven.com_google_api_grpc_proto_google_iam_v1=com.google.api.grpc:proto-google-iam-v1:1.38.0
+maven.com_google_api_grpc_grpc_google_iam_v1=com.google.api.grpc:grpc-google-iam-v1:1.39.0
+maven.com_google_api_grpc_proto_google_iam_v1=com.google.api.grpc:proto-google-iam-v1:1.39.0
maven.com_google_http_client_google_http_client=com.google.http-client:google-http-client:1.45.0
maven.com_google_http_client_google_http_client_gson=com.google.http-client:google-http-client-gson:1.45.0
maven.org_codehaus_mojo_animal_sniffer_annotations=org.codehaus.mojo:animal-sniffer-annotations:1.24
diff --git a/gax-java/gax-grpc/clirr-ignored-differences.xml b/gax-java/gax-grpc/clirr-ignored-differences.xml
new file mode 100644
index 0000000000..8b595b0a85
--- /dev/null
+++ b/gax-java/gax-grpc/clirr-ignored-differences.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+ 7013
+ com/google/api/gax/grpc/GrpcTransportChannel
+ boolean isDirectPath()
+
+
diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcTransportChannel.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcTransportChannel.java
index 9e63bb2a63..2fa0908f17 100644
--- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcTransportChannel.java
+++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/GrpcTransportChannel.java
@@ -60,6 +60,8 @@ public GrpcCallContext getEmptyCallContext() {
/** The channel in use. */
abstract ManagedChannel getManagedChannel();
+ public abstract boolean isDirectPath();
+
public Channel getChannel() {
return getManagedChannel();
}
@@ -100,7 +102,7 @@ public void close() {
}
public static Builder newBuilder() {
- return new AutoValue_GrpcTransportChannel.Builder();
+ return new AutoValue_GrpcTransportChannel.Builder().setDirectPath(false);
}
public static GrpcTransportChannel create(ManagedChannel channel) {
@@ -111,6 +113,8 @@ public static GrpcTransportChannel create(ManagedChannel channel) {
public abstract static class Builder {
public abstract Builder setManagedChannel(ManagedChannel value);
+ abstract Builder setDirectPath(boolean value);
+
public abstract GrpcTransportChannel build();
}
}
diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java
index c49d5265f7..5d601e8fa6 100644
--- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java
+++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java
@@ -258,9 +258,12 @@ public TransportChannel getTransportChannel() throws IOException {
}
private TransportChannel createChannel() throws IOException {
- return GrpcTransportChannel.create(
- ChannelPool.create(
- channelPoolSettings, InstantiatingGrpcChannelProvider.this::createSingleChannel));
+ return GrpcTransportChannel.newBuilder()
+ .setManagedChannel(
+ ChannelPool.create(
+ channelPoolSettings, InstantiatingGrpcChannelProvider.this::createSingleChannel))
+ .setDirectPath(this.canUseDirectPath())
+ .build();
}
private boolean isDirectPathEnabled() {
diff --git a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/GrpcTransportChannelTest.java b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/GrpcTransportChannelTest.java
new file mode 100644
index 0000000000..337f054c42
--- /dev/null
+++ b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/GrpcTransportChannelTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google LLC nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.google.api.gax.grpc;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import io.grpc.ManagedChannel;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+class GrpcTransportChannelTest {
+
+ @Test
+ void testBuilderDefaults() {
+ ManagedChannel channel = Mockito.mock(ManagedChannel.class);
+ GrpcTransportChannel grpcTransportChannel =
+ GrpcTransportChannel.newBuilder().setManagedChannel(channel).build();
+ assertFalse(grpcTransportChannel.isDirectPath());
+ }
+}
diff --git a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java
index 4de1b8ee11..a4bcb65a1a 100644
--- a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java
+++ b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java
@@ -706,7 +706,7 @@ void testLogDirectPathMisconfigNotOnGCE() throws Exception {
}
@Test
- public void canUseDirectPath_happyPath() {
+ public void canUseDirectPath_happyPath() throws IOException {
System.setProperty("os.name", "Linux");
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
Mockito.when(
@@ -718,14 +718,20 @@ public void canUseDirectPath_happyPath() {
.setAttemptDirectPath(true)
.setCredentials(computeEngineCredentials)
.setEndpoint(DEFAULT_ENDPOINT)
- .setEnvProvider(envProvider);
+ .setEnvProvider(envProvider)
+ .setHeaderProvider(Mockito.mock(HeaderProvider.class));
InstantiatingGrpcChannelProvider provider =
new InstantiatingGrpcChannelProvider(builder, GCE_PRODUCTION_NAME_AFTER_2016);
Truth.assertThat(provider.canUseDirectPath()).isTrue();
+
+ // verify this info is passed correctly to transport channel
+ TransportChannel transportChannel = provider.getTransportChannel();
+ Truth.assertThat(((GrpcTransportChannel) transportChannel).isDirectPath()).isTrue();
+ transportChannel.shutdownNow();
}
@Test
- public void canUseDirectPath_directPathEnvVarDisabled() {
+ public void canUseDirectPath_directPathEnvVarDisabled() throws IOException {
System.setProperty("os.name", "Linux");
EnvironmentProvider envProvider = Mockito.mock(EnvironmentProvider.class);
Mockito.when(
@@ -737,10 +743,16 @@ public void canUseDirectPath_directPathEnvVarDisabled() {
.setAttemptDirectPath(true)
.setCredentials(computeEngineCredentials)
.setEndpoint(DEFAULT_ENDPOINT)
- .setEnvProvider(envProvider);
+ .setEnvProvider(envProvider)
+ .setHeaderProvider(Mockito.mock(HeaderProvider.class));
InstantiatingGrpcChannelProvider provider =
new InstantiatingGrpcChannelProvider(builder, GCE_PRODUCTION_NAME_AFTER_2016);
Truth.assertThat(provider.canUseDirectPath()).isFalse();
+
+ // verify this info is passed correctly to transport channel
+ TransportChannel transportChannel = provider.getTransportChannel();
+ Truth.assertThat(((GrpcTransportChannel) transportChannel).isDirectPath()).isFalse();
+ transportChannel.shutdownNow();
}
@Test
diff --git a/gax-java/gax/clirr-ignored-differences.xml b/gax-java/gax/clirr-ignored-differences.xml
index cbaed47eb5..af5c5f26a1 100644
--- a/gax-java/gax/clirr-ignored-differences.xml
+++ b/gax-java/gax/clirr-ignored-differences.xml
@@ -66,11 +66,6 @@
com/google/api/gax/*/*
*org.threeten.bp.Duration *()
-
- 7002
- com/google/api/gax/grpc/InstantiatingGrpcChannelProvider$Builder
- * *
-
7012
diff --git a/gax-java/gax/src/main/java/com/google/api/gax/tracing/MetricsTracer.java b/gax-java/gax/src/main/java/com/google/api/gax/tracing/MetricsTracer.java
index 3de156a562..279d375be5 100644
--- a/gax-java/gax/src/main/java/com/google/api/gax/tracing/MetricsTracer.java
+++ b/gax-java/gax/src/main/java/com/google/api/gax/tracing/MetricsTracer.java
@@ -245,6 +245,15 @@ public void addAttributes(String key, String value) {
attributes.put(key, value);
};
+ /**
+ * Add attributes that will be attached to all metrics. This is expected to be called by
+ * handwritten client teams to add additional attributes that are not supposed be collected by
+ * Gax.
+ */
+ public void addAttributes(Map attributes) {
+ this.attributes.putAll(attributes);
+ };
+
@VisibleForTesting
Map getAttributes() {
return attributes;
diff --git a/gax-java/gax/src/test/java/com/google/api/gax/tracing/MetricsTracerTest.java b/gax-java/gax/src/test/java/com/google/api/gax/tracing/MetricsTracerTest.java
index 18162f1ee9..1864eba7e1 100644
--- a/gax-java/gax/src/test/java/com/google/api/gax/tracing/MetricsTracerTest.java
+++ b/gax-java/gax/src/test/java/com/google/api/gax/tracing/MetricsTracerTest.java
@@ -43,6 +43,7 @@
import com.google.api.gax.rpc.StatusCode.Code;
import com.google.api.gax.rpc.testing.FakeStatusCode;
import com.google.common.collect.ImmutableMap;
+import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -228,6 +229,16 @@ void testAddAttributes_recordsAttributes() {
assertThat(metricsTracer.getAttributes().get("FakeTableId")).isEqualTo("12345");
}
+ @Test
+ void testAddAttributes_recordsAttributesWithMap() {
+ Map attributes = new HashMap<>();
+ attributes.put("FakeTableId", "12345");
+ attributes.put("FakeInstanceId", "67890");
+ metricsTracer.addAttributes(attributes);
+ assertThat(metricsTracer.getAttributes().get("FakeTableId")).isEqualTo("12345");
+ assertThat(metricsTracer.getAttributes().get("FakeInstanceId")).isEqualTo("67890");
+ }
+
@Test
void testExtractStatus_errorConversion_apiExceptions() {
ApiException error =
diff --git a/java-common-protos/proto-google-common-protos/clirr-ignored-differences.xml b/java-common-protos/proto-google-common-protos/clirr-ignored-differences.xml
index 7f10254a06..60d228eeef 100644
--- a/java-common-protos/proto-google-common-protos/clirr-ignored-differences.xml
+++ b/java-common-protos/proto-google-common-protos/clirr-ignored-differences.xml
@@ -139,4 +139,66 @@
com/google/type/*OrBuilder
boolean has*(*)
+
+
+
+ 7006
+ com/google/**
+ * getDefaultInstanceForType()
+ **
+
+
+ 7006
+ com/google/**
+ * addRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/**
+ * clear()
+ **
+
+
+ 7006
+ com/google/**
+ * clearField(*)
+ **
+
+
+ 7006
+ com/google/**
+ * clearOneof(*)
+ **
+
+
+ 7006
+ com/google/**
+ * clone()
+ **
+
+
+ 7006
+ com/google/**
+ * mergeUnknownFields(*)
+ **
+
+
+ 7006
+ com/google/**
+ * setField(*)
+ **
+
+
+ 7006
+ com/google/**
+ * setRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/**
+ * setUnknownFields(*)
+ **
+
diff --git a/java-iam/proto-google-iam-v1/clirr-ignored-differences.xml b/java-iam/proto-google-iam-v1/clirr-ignored-differences.xml
index ca6f8c1981..4b3ee79e76 100644
--- a/java-iam/proto-google-iam-v1/clirr-ignored-differences.xml
+++ b/java-iam/proto-google-iam-v1/clirr-ignored-differences.xml
@@ -30,4 +30,66 @@
com/google/iam/v1/logging/*OrBuilder
boolean has*(*)
+
+
+
+ 7006
+ com/google/iam/v1/**
+ * getDefaultInstanceForType()
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * addRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * clear()
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * clearField(*)
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * clearOneof(*)
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * clone()
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * mergeUnknownFields(*)
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * setField(*)
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * setRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/iam/v1/**
+ * setUnknownFields(*)
+ **
+
diff --git a/java-iam/proto-google-iam-v2/clirr-ignored-differences.xml b/java-iam/proto-google-iam-v2/clirr-ignored-differences.xml
index f9346449b7..435ec03ee5 100644
--- a/java-iam/proto-google-iam-v2/clirr-ignored-differences.xml
+++ b/java-iam/proto-google-iam-v2/clirr-ignored-differences.xml
@@ -16,4 +16,66 @@
com/google/iam/v2/*OrBuilder
boolean has*(*)
+
+
+
+ 7006
+ com/google/iam/v2/**
+ * getDefaultInstanceForType()
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * addRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * clear()
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * clearField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * clearOneof(*)
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * clone()
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * mergeUnknownFields(*)
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * setField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * setRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2/**
+ * setUnknownFields(*)
+ **
+
diff --git a/java-iam/proto-google-iam-v2beta/clirr-ignored-differences.xml b/java-iam/proto-google-iam-v2beta/clirr-ignored-differences.xml
index 136c027be8..6163ac2424 100644
--- a/java-iam/proto-google-iam-v2beta/clirr-ignored-differences.xml
+++ b/java-iam/proto-google-iam-v2beta/clirr-ignored-differences.xml
@@ -16,4 +16,66 @@
com/google/iam/v2beta/*OrBuilder
boolean has*(*)
+
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * getDefaultInstanceForType()
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * addRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * clear()
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * clearField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * clearOneof(*)
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * clone()
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * mergeUnknownFields(*)
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * setField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * setRepeatedField(*)
+ **
+
+
+ 7006
+ com/google/iam/v2beta/**
+ * setUnknownFields(*)
+ **
+
diff --git a/java-shared-dependencies/third-party-dependencies/pom.xml b/java-shared-dependencies/third-party-dependencies/pom.xml
index dbf3e4962b..bfa75ea1a0 100644
--- a/java-shared-dependencies/third-party-dependencies/pom.xml
+++ b/java-shared-dependencies/third-party-dependencies/pom.xml
@@ -28,7 +28,7 @@
0.31.1
3.0.2
2.17.2
- 2.31.0
+ 2.32.0
1.17.1
4.4.16
4.5.14
diff --git a/library_generation/owlbot/templates/clirr/clirr-ignored-differences.xml.j2 b/library_generation/owlbot/templates/clirr/clirr-ignored-differences.xml.j2
index 6528981704..3fc907802f 100644
--- a/library_generation/owlbot/templates/clirr/clirr-ignored-differences.xml.j2
+++ b/library_generation/owlbot/templates/clirr/clirr-ignored-differences.xml.j2
@@ -15,5 +15,66 @@
7012
{{proto_path}}/*OrBuilder
boolean has*(*)
+
+
+
+ 7006
+ {{proto_path}}/**
+ * getDefaultInstanceForType()
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * addRepeatedField(*)
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * clear()
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * clearField(*)
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * clearOneof(*)
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * clone()
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * mergeUnknownFields(*)
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * setField(*)
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * setRepeatedField(*)
+ **
+
+
+ 7006
+ {{proto_path}}/**
+ * setUnknownFields(*)
+ **
{% endfor %}
diff --git a/library_generation/requirements.txt b/library_generation/requirements.txt
index 005fca1347..f17dad563a 100644
--- a/library_generation/requirements.txt
+++ b/library_generation/requirements.txt
@@ -177,6 +177,7 @@ gitpython==3.1.43 \
idna==3.8 \
--hash=sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac \
--hash=sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603
+
# via requests
jinja2==3.1.4 \
--hash=sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369 \
@@ -417,9 +418,9 @@ pathspec==0.12.1 \
# via
# -r library_generation/requirements.in
# black
-platformdirs==4.3.2 \
- --hash=sha256:9e5e27a08aa095dd127b9f2e764d74254f482fef22b0970773bfba79d091ab8c \
- --hash=sha256:eb1c8582560b34ed4ba105009a4badf7f6f85768b30126f351328507b2beb617
+platformdirs==4.3.3 \
+ --hash=sha256:50a5450e2e84f44539718293cbb1da0a0885c9d14adf21b77bae4e66fc99d9b5 \
+ --hash=sha256:d4e0b7d8ec176b341fb03cb11ca12d0276faa8c485f9cd218f613840463fc2c0
# via
# black
# virtualenv
diff --git a/renovate.json b/renovate.json
index f0ad762025..e0ef6f291f 100644
--- a/renovate.json
+++ b/renovate.json
@@ -18,29 +18,6 @@
],
"datasourceTemplate": "maven"
},
- {
- "customType": "regex",
- "fileMatch": [
- "^gax-java/dependencies\\.properties$"
- ],
- "matchStrings": [
- "version\\.com_google_protobuf=(?.+?)\\n"
- ],
- "depNameTemplate": "com.google.protobuf:protobuf-java",
- "datasourceTemplate": "maven"
- },
- {
- "customType": "regex",
- "fileMatch": [
- "^\\.cloudbuild/library_generation/library_generation\\.Dockerfile$"
- ],
- "matchStrings": [
- "ARG PROTOC_VERSION=[\"']?(?.+?)[\"']?\\s+"
- ],
- "datasourceTemplate": "github-releases",
- "depNameTemplate": "protocolbuffers/protobuf",
- "extractVersionTemplate": "^v(?.*)$"
- },
{
"customType": "regex",
"fileMatch": [
@@ -95,6 +72,12 @@
],
"enabled": false
},
+ {
+ "matchPackagePatterns": [
+ "^com.google.protobuf:"
+ ],
+ "enabled": false
+ },
{
"matchPackagePatterns": [
"^com.google.guava:"
@@ -153,13 +136,6 @@
],
"groupName": "jackson dependencies"
},
- {
- "matchPackagePatterns": [
- "^com.google.protobuf",
- "^protocolbuffers/protobuf"
- ],
- "groupName": "Protobuf dependencies"
- },
{
"matchPackagePatterns": [
"^io.grpc"