Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update retry settings #201

Merged
merged 3 commits into from Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -15,7 +15,7 @@
*/

/**
* A client to Stackdriver Logging API.
* A client to Cloud Logging API.
*
* <p>The interfaces provided are listed below, along with usage samples.
*
Expand Down
Expand Up @@ -49,7 +49,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Base stub class for Stackdriver Logging API.
* Base stub class for Cloud Logging API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
Expand Down
Expand Up @@ -501,18 +501,15 @@ public static class Builder extends StubSettings.Builder<ConfigServiceV2StubSett
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
ImmutableMap.builder();
definitions.put(
"idempotent",
"no_retry_2_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put(
"retry_policy_3_codes",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED,
StatusCode.Code.INTERNAL,
StatusCode.Code.UNAVAILABLE)));
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put(
"idempotent2",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}

Expand All @@ -526,12 +523,22 @@ public static class Builder extends StubSettings.Builder<ConfigServiceV2StubSett
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(20000L))
.setInitialRpcTimeout(Duration.ofMillis(60000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(60000L))
.setTotalTimeout(Duration.ofMillis(60000L))
.build();
definitions.put("retry_policy_3_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRpcTimeout(Duration.ofMillis(120000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(20000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.setMaxRpcTimeout(Duration.ofMillis(120000L))
.setTotalTimeout(Duration.ofMillis(120000L))
.build();
definitions.put("default", settings);
definitions.put("no_retry_2_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}

Expand Down Expand Up @@ -606,78 +613,78 @@ private static Builder initDefaults(Builder builder) {

builder
.deleteSinkSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));

builder
.updateSinkSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));

builder
.deleteExclusionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));

builder
.listBucketsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.getBucketSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.updateBucketSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.listSinksSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));

builder
.getSinkSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));

builder
.createSinkSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));

builder
.listExclusionsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));

builder
.getExclusionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_3_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_3_params"));

builder
.createExclusionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));

builder
.updateExclusionSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params"));

builder
.getCmekSettingsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

builder
.updateCmekSettingsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params"));

return builder;
}
Expand Down
Expand Up @@ -36,7 +36,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC callable factory implementation for Stackdriver Logging API.
* gRPC callable factory implementation for Cloud Logging API.
*
* <p>This class is for advanced usage.
*/
Expand Down
Expand Up @@ -60,7 +60,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC stub implementation for Stackdriver Logging API.
* gRPC stub implementation for Cloud Logging API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
Expand Down
Expand Up @@ -36,7 +36,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC callable factory implementation for Stackdriver Logging API.
* gRPC callable factory implementation for Cloud Logging API.
*
* <p>This class is for advanced usage.
*/
Expand Down
Expand Up @@ -47,7 +47,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC stub implementation for Stackdriver Logging API.
* gRPC stub implementation for Cloud Logging API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
Expand Down
Expand Up @@ -36,7 +36,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC callable factory implementation for Stackdriver Logging API.
* gRPC callable factory implementation for Cloud Logging API.
*
* <p>This class is for advanced usage.
*/
Expand Down
Expand Up @@ -43,7 +43,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* gRPC stub implementation for Stackdriver Logging API.
* gRPC stub implementation for Cloud Logging API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
Expand Down
Expand Up @@ -36,7 +36,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Base stub class for Stackdriver Logging API.
* Base stub class for Cloud Logging API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
Expand Down
Expand Up @@ -514,18 +514,20 @@ public static class Builder extends StubSettings.Builder<LoggingServiceV2StubSet
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
ImmutableMap.builder();
definitions.put(
"idempotent",
"retry_policy_1_codes",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED,
StatusCode.Code.INTERNAL,
StatusCode.Code.UNAVAILABLE)));
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put(
"idempotent2",
"retry_policy_2_codes",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
StatusCode.Code.DEADLINE_EXCEEDED,
StatusCode.Code.INTERNAL,
StatusCode.Code.UNAVAILABLE)));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}

Expand All @@ -539,12 +541,25 @@ public static class Builder extends StubSettings.Builder<LoggingServiceV2StubSet
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(20000L))
.setInitialRpcTimeout(Duration.ofMillis(60000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(60000L))
.setTotalTimeout(Duration.ofMillis(60000L))
.build();
definitions.put("retry_policy_1_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(3600000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(20000L))
.setTotalTimeout(Duration.ofMillis(600000L))
.setMaxRpcTimeout(Duration.ofMillis(3600000L))
.setTotalTimeout(Duration.ofMillis(3600000L))
.build();
definitions.put("default", settings);
definitions.put("retry_policy_2_params", settings);
settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build();
definitions.put("no_retry_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}

Expand Down Expand Up @@ -592,13 +607,13 @@ private static Builder initDefaults(Builder builder) {

builder
.deleteLogSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.listLogEntriesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.writeLogEntriesSettings()
Expand All @@ -616,18 +631,18 @@ private static Builder initDefaults(Builder builder) {
.build());
builder
.writeLogEntriesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.listMonitoredResourceDescriptorsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

builder
.listLogsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent2"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));

return builder;
}
Expand Down
Expand Up @@ -32,7 +32,7 @@

// AUTO-GENERATED DOCUMENTATION AND CLASS
/**
* Base stub class for Stackdriver Logging API.
* Base stub class for Cloud Logging API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
Expand Down