Skip to content

Commit

Permalink
Update temporal retention TTL from 7 to 30 days (#10635)
Browse files Browse the repository at this point in the history
Increase the temporal retention to 30 days instead of 7. It will help with on call investigation.
  • Loading branch information
benmoriceau committed Mar 1, 2022
1 parent c78b510 commit a60aa5f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Expand Up @@ -178,6 +178,11 @@ public interface Configs {
*/
String getTemporalHost();

/**
* Define the number of retention days for the temporal history
*/
int getTemporalRetentionInDays();

/**
* Define the url where the Airbyte Server is hosted at. Airbyte services use this information.
* Manipulates the `INTERNAL_API_HOST` variable.
Expand Down
Expand Up @@ -73,6 +73,7 @@ public class EnvConfigs implements Configs {
public static final String MAX_SYNC_WORKERS = "MAX_SYNC_WORKERS";
private static final String TEMPORAL_HOST = "TEMPORAL_HOST";
private static final String TEMPORAL_WORKER_PORTS = "TEMPORAL_WORKER_PORTS";
private static final String TEMPORAL_HISTORY_RETENTION_IN_DAYS = "TEMPORAL_HISTORY_RETENTION_IN_DAYS";
public static final String JOB_KUBE_NAMESPACE = "JOB_KUBE_NAMESPACE";
private static final String SUBMITTER_NUM_THREADS = "SUBMITTER_NUM_THREADS";
public static final String JOB_MAIN_CONTAINER_CPU_REQUEST = "JOB_MAIN_CONTAINER_CPU_REQUEST";
Expand Down Expand Up @@ -166,6 +167,8 @@ public class EnvConfigs implements Configs {

public static final String DEFAULT_NETWORK = "host";

public static final int DEFAULT_TEMPORAL_HISTORY_RETENTION_IN_DAYS = 30;

private final Function<String, String> getEnv;
private final Supplier<Set<String>> getAllEnvKeys;
private final LogConfigs logConfigs;
Expand Down Expand Up @@ -385,6 +388,11 @@ public String getTemporalHost() {
return getEnvOrDefault(TEMPORAL_HOST, "airbyte-temporal:7233");
}

@Override
public int getTemporalRetentionInDays() {
return getEnvOrDefault(TEMPORAL_HISTORY_RETENTION_IN_DAYS, DEFAULT_TEMPORAL_HISTORY_RETENTION_IN_DAYS);
}

@Override
public String getAirbyteApiHost() {
return getEnsureEnv(INTERNAL_API_HOST).split(":")[0];
Expand Down Expand Up @@ -815,6 +823,10 @@ public long getEnvOrDefault(final String key, final long defaultValue) {
return getEnvOrDefault(key, defaultValue, Long::parseLong, false);
}

public int getEnvOrDefault(final String key, final int defaultValue) {
return getEnvOrDefault(key, defaultValue, Integer::parseInt, false);
}

public boolean getEnvOrDefault(final String key, final boolean defaultValue) {
return getEnvOrDefault(key, defaultValue, Boolean::parseBoolean);
}
Expand Down
Expand Up @@ -71,7 +71,7 @@ public static WorkflowServiceStubs createTemporalService(final String temporalHo

public static final String DEFAULT_NAMESPACE = "default";

private static final Duration WORKFLOW_EXECUTION_TTL = Duration.ofDays(7);
private static final Duration WORKFLOW_EXECUTION_TTL = Duration.ofDays(configs.getTemporalRetentionInDays());
private static final String HUMAN_READABLE_WORKFLOW_EXECUTION_TTL =
DurationFormatUtils.formatDurationWords(WORKFLOW_EXECUTION_TTL.toMillis(), true, true);

Expand Down

0 comments on commit a60aa5f

Please sign in to comment.