Skip to content

Commit 34f9e43

Browse files
authored
Merge branch 'main' into main
2 parents a06345e + 32190d7 commit 34f9e43

File tree

41 files changed

+767
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+767
-134
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# Changelog
22

3+
## [6.86.0](https://github.com/googleapis/java-spanner/compare/v6.85.0...v6.86.0) (2025-01-31)
4+
5+
6+
### Features
7+
8+
* Add sample for asymmetric autoscaling instances ([#3562](https://github.com/googleapis/java-spanner/issues/3562)) ([3584b81](https://github.com/googleapis/java-spanner/commit/3584b81a27bfcdd071fbf7e0d40dfa840ea88151))
9+
* Support graph and pipe queries in Connection API ([#3586](https://github.com/googleapis/java-spanner/issues/3586)) ([71c3063](https://github.com/googleapis/java-spanner/commit/71c306346d5b3805f55d5698cf8867d5f4ae519e))
10+
11+
12+
### Bug Fixes
13+
14+
* Always add instance-id for built-in metrics ([#3612](https://github.com/googleapis/java-spanner/issues/3612)) ([705b627](https://github.com/googleapis/java-spanner/commit/705b627646f1679b7d1c4c1f86a853872cf8bfd5))
15+
* **deps:** Update the Java code generator (gapic-generator-java) to 2.51.1 ([3e27251](https://github.com/googleapis/java-spanner/commit/3e272510970d1951b74c4ec9425f1a890790ddb3))
16+
* **deps:** Update the Java code generator (gapic-generator-java) to 2.52.0 ([bf69673](https://github.com/googleapis/java-spanner/commit/bf69673886dbe040292214ed6e64997a230441f6))
17+
* **spanner:** Moved mTLSContext configurator from builder to construtor ([#3605](https://github.com/googleapis/java-spanner/issues/3605)) ([ac7c30b](https://github.com/googleapis/java-spanner/commit/ac7c30bfb14bdafc11675c2a120effde4a71c922))
18+
19+
20+
### Dependencies
21+
22+
* Update dependency com.google.cloud:sdk-platform-java-config to v3.42.0 ([#3616](https://github.com/googleapis/java-spanner/issues/3616)) ([2ea59f0](https://github.com/googleapis/java-spanner/commit/2ea59f05225f2dba2effb503e6abddcfdb6fe6ee))
23+
* Update dependency io.opentelemetry:opentelemetry-bom to v1.46.0 ([#3530](https://github.com/googleapis/java-spanner/issues/3530)) ([d505850](https://github.com/googleapis/java-spanner/commit/d5058504b94501cabd75ad5e7030404b63c3f8b4))
24+
25+
26+
### Documentation
27+
28+
* Clarify how async updates can overtake each other ([#3581](https://github.com/googleapis/java-spanner/issues/3581)) ([1be250f](https://github.com/googleapis/java-spanner/commit/1be250fea686f3a41739c9c8aa474ed956b130e4))
29+
* Fix typo timzeone -> timezone ([bf69673](https://github.com/googleapis/java-spanner/commit/bf69673886dbe040292214ed6e64997a230441f6))
30+
* Fixed parameter arguments for AbstractResultSet's Listener's on TransactionMetadata doc ([#3602](https://github.com/googleapis/java-spanner/issues/3602)) ([1f143a4](https://github.com/googleapis/java-spanner/commit/1f143a4b7b899aec8cf58546f7540a41d1c73731))
31+
* **samples:** Add samples and tests for change streams transaction exclusion ([#3098](https://github.com/googleapis/java-spanner/issues/3098)) ([1f81600](https://github.com/googleapis/java-spanner/commit/1f816009abdbfb32bb26686d8fdb2a771216004e))
32+
333
## [6.85.0](https://github.com/googleapis/java-spanner/compare/v6.84.0...v6.85.0) (2025-01-10)
434

535

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-spanner'
5656
If you are using Gradle without BOM, add this to your dependencies:
5757

5858
```Groovy
59-
implementation 'com.google.cloud:google-cloud-spanner:6.85.0'
59+
implementation 'com.google.cloud:google-cloud-spanner:6.86.0'
6060
```
6161

6262
If you are using SBT, add this to your dependencies:
6363

6464
```Scala
65-
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.85.0"
65+
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.86.0"
6666
```
6767

6868
## Authentication
@@ -727,7 +727,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
727727
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html
728728
[stability-image]: https://img.shields.io/badge/stability-stable-green
729729
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg
730-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.85.0
730+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.86.0
731731
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
732732
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
733733
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

benchmarks/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>com.google.cloud</groupId>
2626
<artifactId>google-cloud-spanner-parent</artifactId>
27-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
27+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
2828
</parent>
2929

3030
<properties>

google-cloud-spanner-bom/pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-spanner-bom</artifactId>
6-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
6+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
77
<packaging>pom</packaging>
88
<parent>
99
<groupId>com.google.cloud</groupId>
@@ -53,43 +53,43 @@
5353
<dependency>
5454
<groupId>com.google.cloud</groupId>
5555
<artifactId>google-cloud-spanner</artifactId>
56-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
56+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
5757
</dependency>
5858
<dependency>
5959
<groupId>com.google.cloud</groupId>
6060
<artifactId>google-cloud-spanner</artifactId>
6161
<type>test-jar</type>
62-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
62+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
6363
</dependency>
6464
<dependency>
6565
<groupId>com.google.api.grpc</groupId>
6666
<artifactId>grpc-google-cloud-spanner-v1</artifactId>
67-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-v1:current} -->
67+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-v1:current} -->
6868
</dependency>
6969
<dependency>
7070
<groupId>com.google.api.grpc</groupId>
7171
<artifactId>grpc-google-cloud-spanner-admin-instance-v1</artifactId>
72-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-instance-v1:current} -->
72+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-instance-v1:current} -->
7373
</dependency>
7474
<dependency>
7575
<groupId>com.google.api.grpc</groupId>
7676
<artifactId>grpc-google-cloud-spanner-admin-database-v1</artifactId>
77-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-database-v1:current} -->
77+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-database-v1:current} -->
7878
</dependency>
7979
<dependency>
8080
<groupId>com.google.api.grpc</groupId>
8181
<artifactId>proto-google-cloud-spanner-admin-instance-v1</artifactId>
82-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-instance-v1:current} -->
82+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-instance-v1:current} -->
8383
</dependency>
8484
<dependency>
8585
<groupId>com.google.api.grpc</groupId>
8686
<artifactId>proto-google-cloud-spanner-v1</artifactId>
87-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-v1:current} -->
87+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-v1:current} -->
8888
</dependency>
8989
<dependency>
9090
<groupId>com.google.api.grpc</groupId>
9191
<artifactId>proto-google-cloud-spanner-admin-database-v1</artifactId>
92-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-database-v1:current} -->
92+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-database-v1:current} -->
9393
</dependency>
9494
</dependencies>
9595
</dependencyManagement>

google-cloud-spanner-executor/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>com.google.cloud</groupId>
77
<artifactId>google-cloud-spanner-executor</artifactId>
8-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner-executor:current} -->
8+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner-executor:current} -->
99
<packaging>jar</packaging>
1010
<name>Google Cloud Spanner Executor</name>
1111

1212
<parent>
1313
<groupId>com.google.cloud</groupId>
1414
<artifactId>google-cloud-spanner-parent</artifactId>
15-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
15+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
1616
</parent>
1717

1818
<properties>

google-cloud-spanner/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-spanner</artifactId>
6-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
6+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
77
<packaging>jar</packaging>
88
<name>Google Cloud Spanner</name>
99
<url>https://github.com/googleapis/java-spanner</url>
1010
<description>Java idiomatic client for Google Cloud Spanner.</description>
1111
<parent>
1212
<groupId>com.google.cloud</groupId>
1313
<artifactId>google-cloud-spanner-parent</artifactId>
14-
<version>6.85.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
14+
<version>6.86.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
1515
</parent>
1616
<properties>
1717
<site.installationModule>google-cloud-spanner</site.installationModule>
@@ -371,7 +371,7 @@
371371
<artifactId>junit</artifactId>
372372
<scope>test</scope>
373373
</dependency>
374-
374+
375375
<!-- Executor tests - The 'provided' scope is overwritten to compile time scope for the profile 'executor-tests' -->
376376
<dependency>
377377
<groupId>com.google.api.grpc</groupId>

google-cloud-spanner/src/main/java/com/google/cloud/spanner/BuiltInMetricsConstant.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
public class BuiltInMetricsConstant {
3535

3636
public static final String METER_NAME = "spanner.googleapis.com/internal/client";
37-
3837
public static final String GAX_METER_NAME = OpenTelemetryMetricsRecorder.GAX_METER_NAME;
39-
38+
static final String SPANNER_METER_NAME = "spanner-java";
39+
static final String GFE_LATENCIES_NAME = "gfe_latencies";
4040
static final String OPERATION_LATENCIES_NAME = "operation_latencies";
4141
static final String ATTEMPT_LATENCIES_NAME = "attempt_latencies";
4242
static final String OPERATION_LATENCY_NAME = "operation_latency";
@@ -49,7 +49,8 @@ public class BuiltInMetricsConstant {
4949
OPERATION_LATENCIES_NAME,
5050
ATTEMPT_LATENCIES_NAME,
5151
OPERATION_COUNT_NAME,
52-
ATTEMPT_COUNT_NAME)
52+
ATTEMPT_COUNT_NAME,
53+
GFE_LATENCIES_NAME)
5354
.stream()
5455
.map(m -> METER_NAME + '/' + m)
5556
.collect(Collectors.toSet());
@@ -114,27 +115,39 @@ static Map<InstrumentSelector, View> getAllViews() {
114115
ImmutableMap.Builder<InstrumentSelector, View> views = ImmutableMap.builder();
115116
defineView(
116117
views,
118+
BuiltInMetricsConstant.GAX_METER_NAME,
117119
BuiltInMetricsConstant.OPERATION_LATENCY_NAME,
118120
BuiltInMetricsConstant.OPERATION_LATENCIES_NAME,
119121
BuiltInMetricsConstant.AGGREGATION_WITH_MILLIS_HISTOGRAM,
120122
InstrumentType.HISTOGRAM,
121123
"ms");
122124
defineView(
123125
views,
126+
BuiltInMetricsConstant.GAX_METER_NAME,
124127
BuiltInMetricsConstant.ATTEMPT_LATENCY_NAME,
125128
BuiltInMetricsConstant.ATTEMPT_LATENCIES_NAME,
126129
BuiltInMetricsConstant.AGGREGATION_WITH_MILLIS_HISTOGRAM,
127130
InstrumentType.HISTOGRAM,
128131
"ms");
129132
defineView(
130133
views,
134+
BuiltInMetricsConstant.SPANNER_METER_NAME,
135+
BuiltInMetricsConstant.GFE_LATENCIES_NAME,
136+
BuiltInMetricsConstant.GFE_LATENCIES_NAME,
137+
BuiltInMetricsConstant.AGGREGATION_WITH_MILLIS_HISTOGRAM,
138+
InstrumentType.HISTOGRAM,
139+
"ms");
140+
defineView(
141+
views,
142+
BuiltInMetricsConstant.GAX_METER_NAME,
131143
BuiltInMetricsConstant.OPERATION_COUNT_NAME,
132144
BuiltInMetricsConstant.OPERATION_COUNT_NAME,
133145
Aggregation.sum(),
134146
InstrumentType.COUNTER,
135147
"1");
136148
defineView(
137149
views,
150+
BuiltInMetricsConstant.GAX_METER_NAME,
138151
BuiltInMetricsConstant.ATTEMPT_COUNT_NAME,
139152
BuiltInMetricsConstant.ATTEMPT_COUNT_NAME,
140153
Aggregation.sum(),
@@ -145,6 +158,7 @@ static Map<InstrumentSelector, View> getAllViews() {
145158

146159
private static void defineView(
147160
ImmutableMap.Builder<InstrumentSelector, View> viewMap,
161+
String meterName,
148162
String metricName,
149163
String metricViewName,
150164
Aggregation aggregation,
@@ -153,7 +167,7 @@ private static void defineView(
153167
InstrumentSelector selector =
154168
InstrumentSelector.builder()
155169
.setName(BuiltInMetricsConstant.METER_NAME + '/' + metricName)
156-
.setMeterName(BuiltInMetricsConstant.GAX_METER_NAME)
170+
.setMeterName(meterName)
157171
.setType(type)
158172
.setUnit(unit)
159173
.build();
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,24 @@
4646
import java.util.logging.Logger;
4747
import javax.annotation.Nullable;
4848

49-
final class BuiltInOpenTelemetryMetricsProvider {
49+
final class BuiltInMetricsProvider {
5050

51-
static BuiltInOpenTelemetryMetricsProvider INSTANCE = new BuiltInOpenTelemetryMetricsProvider();
51+
static BuiltInMetricsProvider INSTANCE = new BuiltInMetricsProvider();
5252

53-
private static final Logger logger =
54-
Logger.getLogger(BuiltInOpenTelemetryMetricsProvider.class.getName());
53+
private static final Logger logger = Logger.getLogger(BuiltInMetricsProvider.class.getName());
5554

5655
private static String taskId;
5756

5857
private OpenTelemetry openTelemetry;
5958

60-
private BuiltInOpenTelemetryMetricsProvider() {}
59+
private BuiltInMetricsProvider() {}
6160

6261
OpenTelemetry getOrCreateOpenTelemetry(
6362
String projectId, @Nullable Credentials credentials, @Nullable String monitoringHost) {
6463
try {
6564
if (this.openTelemetry == null) {
6665
SdkMeterProviderBuilder sdkMeterProviderBuilder = SdkMeterProvider.builder();
67-
BuiltInOpenTelemetryMetricsView.registerBuiltinMetrics(
66+
BuiltInMetricsView.registerBuiltinMetrics(
6867
SpannerCloudMonitoringExporter.create(projectId, credentials, monitoringHost),
6968
sdkMeterProviderBuilder);
7069
SdkMeterProvider sdkMeterProvider = sdkMeterProviderBuilder.build();
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.spanner;
18+
19+
import com.google.api.gax.core.GaxProperties;
20+
import com.google.api.gax.tracing.OpenTelemetryMetricsRecorder;
21+
import com.google.common.base.Preconditions;
22+
import io.opentelemetry.api.OpenTelemetry;
23+
import io.opentelemetry.api.common.Attributes;
24+
import io.opentelemetry.api.common.AttributesBuilder;
25+
import io.opentelemetry.api.metrics.DoubleHistogram;
26+
import io.opentelemetry.api.metrics.Meter;
27+
import java.util.Map;
28+
29+
/**
30+
* Implementation for recording built in metrics.
31+
*
32+
* <p>This class extends the {@link OpenTelemetryMetricsRecorder} which implements the *
33+
* measurements related to the lifecyle of an RPC.
34+
*/
35+
class BuiltInMetricsRecorder extends OpenTelemetryMetricsRecorder {
36+
37+
private final DoubleHistogram gfeLatencyRecorder;
38+
39+
/**
40+
* Creates the following instruments for the following metrics:
41+
*
42+
* <ul>
43+
* <li>GFE Latency: Histogram
44+
* </ul>
45+
*
46+
* @param openTelemetry OpenTelemetry instance
47+
* @param serviceName Service Name
48+
*/
49+
BuiltInMetricsRecorder(OpenTelemetry openTelemetry, String serviceName) {
50+
super(openTelemetry, serviceName);
51+
Meter meter =
52+
openTelemetry
53+
.meterBuilder(BuiltInMetricsConstant.SPANNER_METER_NAME)
54+
.setInstrumentationVersion(GaxProperties.getLibraryVersion(getClass()))
55+
.build();
56+
this.gfeLatencyRecorder =
57+
meter
58+
.histogramBuilder(serviceName + '/' + BuiltInMetricsConstant.GFE_LATENCIES_NAME)
59+
.setDescription(
60+
"Latency between Google's network receiving an RPC and reading back the first byte of the response")
61+
.setUnit("ms")
62+
.build();
63+
}
64+
65+
/**
66+
* Record the latency between Google's network receiving an RPC and reading back the first byte of
67+
* the response. Data is stored in a Histogram.
68+
*
69+
* @param gfeLatency Attempt Latency in ms
70+
* @param attributes Map of the attributes to store
71+
*/
72+
void recordGFELatency(double gfeLatency, Map<String, String> attributes) {
73+
gfeLatencyRecorder.record(gfeLatency, toOtelAttributes(attributes));
74+
}
75+
76+
Attributes toOtelAttributes(Map<String, String> attributes) {
77+
Preconditions.checkNotNull(attributes, "Attributes map cannot be null");
78+
AttributesBuilder attributesBuilder = Attributes.builder();
79+
attributes.forEach(attributesBuilder::put);
80+
return attributesBuilder.build();
81+
}
82+
}

0 commit comments

Comments
 (0)