diff --git a/CHANGELOG.md b/CHANGELOG.md index d434921c4..706a60fe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +* Query: allowed null operation name in SessionRetryContext, retry metrics are reported without `operation.name` attribute +* Table: allowed null operation name in SessionRetryContext, retry metrics are reported without `operation.name` attribute + ## 2.5.1 ## * Core: added opt-in PRIMARY/PROMOTED Bridge pile preference with synchronized-pile fallback * Core: added Meter histograms with explicit bucket boundaries, OpenTelemetryMeter uses OpenTelemetry database latency boundaries by default diff --git a/query/src/main/java/tech/ydb/query/tools/SessionRetryContext.java b/query/src/main/java/tech/ydb/query/tools/SessionRetryContext.java index e90f052f7..755410c12 100644 --- a/query/src/main/java/tech/ydb/query/tools/SessionRetryContext.java +++ b/query/src/main/java/tech/ydb/query/tools/SessionRetryContext.java @@ -79,14 +79,15 @@ public CompletableFuture> supplyResult(Function type of the result value * @return future with the result of the last attempt */ - public CompletableFuture> supplyResult(String operationName, + public CompletableFuture> supplyResult(@Nullable String operationName, Function>> fn) { - return execute(new RetryableResultTask<>(Objects.requireNonNull(operationName, "operationName is null"), fn)); + return execute(new RetryableResultTask<>(operationName, fn)); } public CompletableFuture supplyStatus(Function> fn) { @@ -97,13 +98,14 @@ public CompletableFuture supplyStatus(Function supplyStatus(String operationName, + public CompletableFuture supplyStatus(@Nullable String operationName, Function> fn) { - return execute(new RetryableStatusTask(Objects.requireNonNull(operationName, "operationName is null"), fn)); + return execute(new RetryableStatusTask(operationName, fn)); } private static CompletableFuture execute(BaseRetryableTask task) { diff --git a/table/src/main/java/tech/ydb/table/SessionRetryContext.java b/table/src/main/java/tech/ydb/table/SessionRetryContext.java index 926e7d8d3..f4373680a 100644 --- a/table/src/main/java/tech/ydb/table/SessionRetryContext.java +++ b/table/src/main/java/tech/ydb/table/SessionRetryContext.java @@ -92,12 +92,13 @@ public CompletableFuture supplyStatus(SessionRetryHandler h, * Executes the function with retries as one logical operation. * * @param operationName name of the logical operation, used as the retry span name and reported as the - * {@code operation.name} attribute of {@code ydb.client.retry.*} metrics + * {@code operation.name} attribute of {@code ydb.client.retry.*} metrics; if {@code null}, the attribute is not + * reported * @param fn function to execute * @param type of the result value * @return future with the result of the last attempt */ - public CompletableFuture> supplyResult(String operationName, + public CompletableFuture> supplyResult(@Nullable String operationName, Function>> fn) { return supplyResult(operationName, SessionRetryHandler.DEFAULT, fn); } @@ -106,24 +107,23 @@ public CompletableFuture> supplyResult(String operationName, * Executes the function with retries as one logical operation. * * @param operationName name of the logical operation, used as the retry span name and reported as the - * {@code operation.name} attribute of {@code ydb.client.retry.*} metrics + * {@code operation.name} attribute of {@code ydb.client.retry.*} metrics; if {@code null}, the attribute is not + * reported * @param fn function to execute * @return future with the status of the last attempt */ - public CompletableFuture supplyStatus(String operationName, + public CompletableFuture supplyStatus(@Nullable String operationName, Function> fn) { return supplyStatus(operationName, SessionRetryHandler.DEFAULT, fn); } - public CompletableFuture> supplyResult(String operationName, SessionRetryHandler h, + public CompletableFuture> supplyResult(@Nullable String operationName, SessionRetryHandler h, Function>> fn) { - Objects.requireNonNull(operationName, "operationName is null"); return execute(new RetryableResultTask<>(operationName, h, fn)); } - public CompletableFuture supplyStatus(String operationName, SessionRetryHandler h, + public CompletableFuture supplyStatus(@Nullable String operationName, SessionRetryHandler h, Function> fn) { - Objects.requireNonNull(operationName, "operationName is null"); return execute(new RetryableStatusTask(operationName, h, fn)); }