Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit f88dc1f

Browse files
chore: merge main into generate-libraries-main
2 parents 566b063 + 95ac7a7 commit f88dc1f

5 files changed

Lines changed: 98 additions & 33 deletions

File tree

.github/release-please.yml

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,30 @@ releaseType: java-yoshi
22
bumpMinorPreMajor: true
33
handleGHRelease: true
44
branches:
5-
- branch: 3.3.x
6-
- branch: 4.0.x
7-
- branch: 5.2.x
8-
- branch: 6.4.4-sp
9-
releaseType: java-lts
10-
- branch: 6.14.x
11-
releaseType: java-backport
12-
- branch: 6.23.x
13-
- branch: 6.33.x
14-
- branch: 6.55.x
15-
releaseType: java-backport
16-
- branch: 6.67.x
17-
releaseType: java-backport
18-
- branch: 6.66.x
19-
releaseType: java-backport
20-
- branch: 6.88.x
21-
releaseType: java-backport
22-
- branch: 6.96.x
23-
releaseType: java-backport
24-
- branch: 6.95.x
25-
releaseType: java-backport
26-
- branch: protobuf-4.x-rc
27-
manifest: true
5+
- branch: 3.3.x
6+
- branch: 4.0.x
7+
- branch: 5.2.x
8+
- branch: 6.4.4-sp
9+
releaseType: java-lts
10+
- branch: 6.14.x
11+
releaseType: java-backport
12+
- branch: 6.23.x
13+
- branch: 6.33.x
14+
- branch: 6.55.x
15+
releaseType: java-backport
16+
- branch: 6.67.x
17+
releaseType: java-backport
18+
- branch: 6.66.x
19+
releaseType: java-backport
20+
- branch: 6.88.x
21+
releaseType: java-backport
22+
- branch: 6.96.x
23+
releaseType: java-backport
24+
- branch: 6.95.x
25+
releaseType: java-backport
26+
- branch: protobuf-4.x-rc
27+
manifest: true
28+
- releaseType: java-backport
29+
bumpMinorPreMajor: true
30+
handleGHRelease: true
31+
branch: 6.109.x

.github/sync-repo-settings.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,24 @@ branchProtectionRules:
217217
- units-with-multiplexed-session (11)
218218
- unmanaged_dependency_check
219219
- library_generation
220+
- pattern: 6.109.x
221+
isAdminEnforced: true
222+
requiredApprovingReviewCount: 1
223+
requiresCodeOwnerReviews: true
224+
requiresStrictStatusChecks: false
225+
requiredStatusCheckContexts:
226+
- dependencies (17)
227+
- lint
228+
- javadoc
229+
- units (8)
230+
- units (11)
231+
- 'Kokoro - Test: Integration'
232+
- cla/google
233+
- checkstyle
234+
- compile (8)
235+
- compile (11)
236+
- unmanaged_dependency_check
237+
- library_generation
220238
permissionRules:
221239
- team: yoshi-admins
222240
permission: admin

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

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,49 @@ public class BuiltInMetricsConstant {
6868
.map(m -> METER_NAME + '/' + m)
6969
.collect(Collectors.toSet());
7070

71+
// The following attributes are optional and need to be enabled explicitly.
72+
public static final String GRPC_LB_BACKEND_SERVICE_ATTRIBUTE = "grpc.lb.backend_service";
73+
public static final String GRPC_LB_LOCALITY_ATTRIBUTE = "grpc.lb.locality";
74+
public static final String GRPC_DISCONNECT_ERROR_ATTRIBUTE = "grpc.disconnect_error";
75+
76+
static final Set<String> GRPC_LB_RLS_ATTRIBUTES =
77+
ImmutableSet.of("grpc.lb.rls.data_plane_target", "grpc.lb.pick_result");
78+
static final Set<String> GRPC_CLIENT_ATTEMPT_STARTED_ATTRIBUTES =
79+
ImmutableSet.of("grpc.method", "grpc.target");
80+
static final Set<String> GRPC_SUBCHANNEL_DEFAULT_ATTRIBUTES =
81+
ImmutableSet.of("grpc.target", GRPC_LB_BACKEND_SERVICE_ATTRIBUTE, GRPC_LB_LOCALITY_ATTRIBUTE);
82+
static final Set<String> GRPC_SUBCHANNEL_DISCONNECTION_ATTRIBUTES =
83+
ImmutableSet.of(
84+
"grpc.target",
85+
GRPC_LB_BACKEND_SERVICE_ATTRIBUTE,
86+
GRPC_LB_LOCALITY_ATTRIBUTE,
87+
GRPC_DISCONNECT_ERROR_ATTRIBUTE);
88+
static final Set<String> GRPC_XDS_CLIENT_RESOURCE_UPDATE_ATTRIBUTES =
89+
ImmutableSet.of("grpc.xds.resource_type");
90+
91+
// Additional gRPC attributes to enable.
92+
static final Map<String, Set<String>> GRPC_METRIC_ADDITIONAL_ATTRIBUTES =
93+
ImmutableMap.<String, Set<String>>builder()
94+
.put("grpc.client.attempt.started", GRPC_CLIENT_ATTEMPT_STARTED_ATTRIBUTES)
95+
.put("grpc.subchannel.open_connections", GRPC_SUBCHANNEL_DEFAULT_ATTRIBUTES)
96+
.put("grpc.subchannel.disconnections", GRPC_SUBCHANNEL_DISCONNECTION_ATTRIBUTES)
97+
.put("grpc.subchannel.connection_attempts_succeeded", GRPC_SUBCHANNEL_DEFAULT_ATTRIBUTES)
98+
.put("grpc.subchannel.connection_attempts_failed", GRPC_SUBCHANNEL_DEFAULT_ATTRIBUTES)
99+
.put("grpc.lb.rls.default_target_picks", GRPC_LB_RLS_ATTRIBUTES)
100+
.put("grpc.lb.rls.target_picks", GRPC_LB_RLS_ATTRIBUTES)
101+
.put(
102+
"grpc.xds_client.resource_updates_invalid",
103+
GRPC_XDS_CLIENT_RESOURCE_UPDATE_ATTRIBUTES)
104+
.put("grpc.xds_client.resource_updates_valid", GRPC_XDS_CLIENT_RESOURCE_UPDATE_ATTRIBUTES)
105+
.build();
106+
71107
static final Collection<String> GRPC_METRICS_TO_ENABLE =
72108
ImmutableList.of(
109+
"grpc.client.attempt.started",
110+
"grpc.subchannel.open_connections",
111+
"grpc.subchannel.disconnections",
112+
"grpc.subchannel.connection_attempts_succeeded",
113+
"grpc.subchannel.connection_attempts_failed",
73114
"grpc.lb.rls.default_target_picks",
74115
"grpc.lb.rls.target_picks",
75116
"grpc.xds_client.server_failure",
@@ -100,8 +141,6 @@ public class BuiltInMetricsConstant {
100141
AttributeKey.stringKey("directpath_used");
101142
public static final AttributeKey<String> REQUEST_ID_KEY =
102143
AttributeKey.stringKey(REQUEST_ID_HEADER_NAME);
103-
public static final AttributeKey<String> GRPC_XDS_RESOURCE_TYPE_KEY =
104-
AttributeKey.stringKey("grpc.xds.resource_type");
105144
public static Set<String> ALLOWED_EXEMPLARS_ATTRIBUTES =
106145
new HashSet<>(Arrays.asList(REQUEST_ID_HEADER_NAME));
107146

@@ -124,9 +163,6 @@ public class BuiltInMetricsConstant {
124163
DIRECT_PATH_ENABLED_KEY,
125164
DIRECT_PATH_USED_KEY);
126165

127-
static final Set<String> GRPC_LB_RLS_ATTRIBUTES =
128-
ImmutableSet.of("grpc.lb.rls.data_plane_target", "grpc.lb.pick_result");
129-
130166
static List<Double> BUCKET_BOUNDARIES =
131167
ImmutableList.of(
132168
0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0,
@@ -140,7 +176,6 @@ public class BuiltInMetricsConstant {
140176
ImmutableList.of(
141177
"grpc.client.attempt.sent_total_compressed_message_size",
142178
"grpc.client.attempt.rcvd_total_compressed_message_size",
143-
"grpc.client.attempt.started",
144179
"grpc.client.attempt.duration",
145180
"grpc.client.call.duration");
146181

@@ -235,8 +270,8 @@ private static void defineGRPCView(ImmutableMap.Builder<InstrumentSelector, View
235270
BuiltInMetricsConstant.COMMON_ATTRIBUTES.stream()
236271
.map(AttributeKey::getKey)
237272
.collect(Collectors.toSet());
238-
attributesFilter.addAll(BuiltInMetricsConstant.GRPC_LB_RLS_ATTRIBUTES);
239-
attributesFilter.add(BuiltInMetricsConstant.GRPC_XDS_RESOURCE_TYPE_KEY.getKey());
273+
attributesFilter.addAll(
274+
GRPC_METRIC_ADDITIONAL_ATTRIBUTES.getOrDefault(metric, ImmutableSet.of()));
240275

241276
View view =
242277
View.builder()

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ void enableGrpcMetrics(
150150
.enableMetrics(BuiltInMetricsConstant.GRPC_METRICS_TO_ENABLE)
151151
// Disable gRPCs default metrics as they are not needed for Spanner.
152152
.disableMetrics(BuiltInMetricsConstant.GRPC_METRICS_ENABLED_BY_DEFAULT)
153+
.addOptionalLabel(BuiltInMetricsConstant.GRPC_LB_BACKEND_SERVICE_ATTRIBUTE)
154+
.addOptionalLabel(BuiltInMetricsConstant.GRPC_LB_LOCALITY_ATTRIBUTE)
155+
.addOptionalLabel(BuiltInMetricsConstant.GRPC_DISCONNECT_ERROR_ATTRIBUTE)
153156
.build();
154157
ApiFunction<ManagedChannelBuilder, ManagedChannelBuilder> channelConfigurator =
155158
channelProviderBuilder.getChannelConfigurator();

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ private static TimeSeries convertPointToSpannerTimeSeries(
116116
PointData pointData,
117117
MonitoredResource.Builder monitoredResourceBuilder,
118118
String projectId) {
119+
MetricKind metricKind = convertMetricKind(metricData);
119120
TimeSeries.Builder builder =
120121
TimeSeries.newBuilder()
121-
.setMetricKind(convertMetricKind(metricData))
122+
.setMetricKind(metricKind)
122123
.setValueType(convertValueType(metricData.getType()));
123124
Metric.Builder metricBuilder = Metric.newBuilder().setType(metricData.getName());
124125

@@ -143,7 +144,11 @@ private static TimeSeries convertPointToSpannerTimeSeries(
143144

144145
TimeInterval timeInterval =
145146
TimeInterval.newBuilder()
146-
.setStartTime(Timestamps.fromNanos(pointData.getStartEpochNanos()))
147+
.setStartTime(
148+
// For gauge metrics, the start and end time should be the same.
149+
metricKind == MetricKind.GAUGE
150+
? Timestamps.fromNanos(pointData.getEpochNanos())
151+
: Timestamps.fromNanos(pointData.getStartEpochNanos()))
147152
.setEndTime(Timestamps.fromNanos(pointData.getEpochNanos()))
148153
.build();
149154

0 commit comments

Comments
 (0)