Skip to content

Commit c9f5e00

Browse files
committed
chore: fix lint issues
1 parent 8fbc1c6 commit c9f5e00

4 files changed

Lines changed: 27 additions & 11 deletions

File tree

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/DatastoreImpl.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ public T call() throws DatastoreException {
254254
private void recordAttempt(String status) {
255255
Map<String, String> attributes =
256256
TelemetryUtils.buildMetricAttributes(
257-
TelemetryConstants.METHOD_TRANSACTION_COMMIT, status, datastore.getOptions().getDatabaseId());
257+
TelemetryConstants.METHOD_TRANSACTION_COMMIT,
258+
status,
259+
datastore.getOptions().getDatabaseId());
258260
metricsRecorder.recordTransactionAttemptCount(1, attributes);
259261
}
260262
}
@@ -292,7 +294,8 @@ public <T> T runInTransaction(
292294
} finally {
293295
long latencyMs = stopwatch.elapsed(TimeUnit.MILLISECONDS);
294296
Map<String, String> attributes =
295-
TelemetryUtils.buildMetricAttributes(TelemetryConstants.METHOD_TRANSACTION_RUN, status, getOptions().getDatabaseId());
297+
TelemetryUtils.buildMetricAttributes(
298+
TelemetryConstants.METHOD_TRANSACTION_RUN, status, getOptions().getDatabaseId());
296299
metricsRecorder.recordTransactionLatency(latencyMs, attributes);
297300
span.end();
298301
}
@@ -801,7 +804,8 @@ private <T> T runWithObservability(
801804

802805
DatastoreOptions options = getOptions();
803806
Callable<T> attemptCallable =
804-
TelemetryUtils.attemptMetricsCallable(callable, metricsRecorder, methodName, options.getDatabaseId());
807+
TelemetryUtils.attemptMetricsCallable(
808+
callable, metricsRecorder, methodName, options.getDatabaseId());
805809
try (TraceUtil.Scope ignored = span.makeCurrent()) {
806810
return RetryHelper.runWithRetries(
807811
attemptCallable, retrySettings, exceptionHandler, options.getClock());
@@ -811,7 +815,11 @@ private <T> T runWithObservability(
811815
throw DatastoreException.translateAndThrow(e);
812816
} finally {
813817
TelemetryUtils.recordOperationMetrics(
814-
metricsRecorder, operationStopwatch, methodName, operationStatus, options.getDatabaseId());
818+
metricsRecorder,
819+
operationStopwatch,
820+
methodName,
821+
operationStatus,
822+
options.getDatabaseId());
815823
span.end();
816824
}
817825
}

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/RetryAndTraceDatastoreRpcDecorator.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ <O> O invokeRpc(Callable<O> block, String startSpan, String methodName) {
205205
String operationStatus = StatusCode.Code.UNKNOWN.toString();
206206
try (TraceUtil.Scope ignored = span.makeCurrent()) {
207207
Callable<O> callable =
208-
TelemetryUtils.attemptMetricsCallable(block, metricsRecorder, methodName, datastoreOptions.getDatabaseId());
208+
TelemetryUtils.attemptMetricsCallable(
209+
block, metricsRecorder, methodName, datastoreOptions.getDatabaseId());
209210
O result =
210211
RetryHelper.runWithRetries(
211212
callable, this.retrySettings, EXCEPTION_HANDLER, this.datastoreOptions.getClock());
@@ -217,7 +218,11 @@ <O> O invokeRpc(Callable<O> block, String startSpan, String methodName) {
217218
throw DatastoreException.translateAndThrow(e);
218219
} finally {
219220
TelemetryUtils.recordOperationMetrics(
220-
metricsRecorder, stopwatch, methodName, operationStatus, datastoreOptions.getDatabaseId());
221+
metricsRecorder,
222+
stopwatch,
223+
methodName,
224+
operationStatus,
225+
datastoreOptions.getDatabaseId());
221226
span.end();
222227
}
223228
}

java-datastore/google-cloud-datastore/src/main/java/com/google/cloud/datastore/telemetry/TelemetryUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ private TelemetryUtils() {}
4242
* @param status The status of the operation or attempt.
4343
* @return The map of attributes.
4444
*/
45-
public static Map<String, String> buildMetricAttributes(String methodName, String status, String databaseId) {
45+
public static Map<String, String> buildMetricAttributes(
46+
String methodName, String status, String databaseId) {
4647
Map<String, String> attributes = new HashMap<>();
4748
attributes.put(TelemetryConstants.ATTRIBUTES_KEY_METHOD, methodName);
4849
attributes.put(TelemetryConstants.ATTRIBUTES_KEY_STATUS, status);
@@ -91,7 +92,10 @@ public static void recordOperationMetrics(
9192
* @return A wrapped callable that includes attempt-level metrics recording.
9293
*/
9394
public static <T> Callable<T> attemptMetricsCallable(
94-
Callable<T> callable, DatastoreMetricsRecorder metricsRecorder, String methodName, String databaseId) {
95+
Callable<T> callable,
96+
DatastoreMetricsRecorder metricsRecorder,
97+
String methodName,
98+
String databaseId) {
9599
return () -> {
96100
Stopwatch stopwatch = Stopwatch.createStarted();
97101
String status = StatusCode.Code.UNKNOWN.toString();

java-datastore/google-cloud-datastore/src/test/java/com/google/cloud/datastore/ITDatastoreBuiltInAndCustomMetrics.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,8 @@ public void bothBackendsActive_recorderIsComposite() {
182182
*/
183183
@Test
184184
public void builtInMetricsExport_isDisabledByDefault() {
185-
DatastoreOptions defaultOptions = DatastoreOptions.newBuilder()
186-
.setProjectId(PROJECT_ID)
187-
.build();
185+
DatastoreOptions defaultOptions =
186+
DatastoreOptions.newBuilder().setProjectId(PROJECT_ID).build();
188187
assertThat(
189188
defaultOptions
190189
.getOpenTelemetryOptions()

0 commit comments

Comments
 (0)