Skip to content

Commit dec2c9e

Browse files
authored
Switch logging logs to DEBUG. Add Kube labels to workers. (#5909)
1 parent a1dd956 commit dec2c9e

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

airbyte-config/models/src/main/java/io/airbyte/config/helpers/LogClientSingleton.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,20 @@ public static void deleteLogs(Configs configs, String logPath) {
143143

144144
public static void setJobMdc(Path path) {
145145
if (shouldUseLocalLogs(new EnvConfigs())) {
146-
LOGGER.info("Setting docker job mdc");
146+
LOGGER.debug("Setting docker job mdc");
147147
MDC.put(LogClientSingleton.JOB_LOG_PATH_MDC_KEY, path.resolve(LogClientSingleton.LOG_FILENAME).toString());
148148
} else {
149-
LOGGER.info("Setting kube job mdc");
149+
LOGGER.debug("Setting kube job mdc");
150150
MDC.put(LogClientSingleton.CLOUD_JOB_LOG_PATH_MDC_KEY, path.resolve(LogClientSingleton.LOG_FILENAME).toString());
151151
}
152152
}
153153

154154
public static void setWorkspaceMdc(Path path) {
155155
if (shouldUseLocalLogs(new EnvConfigs())) {
156-
LOGGER.info("Setting docker workspace mdc");
156+
LOGGER.debug("Setting docker workspace mdc");
157157
MDC.put(LogClientSingleton.WORKSPACE_MDC_KEY, path.toString());
158158
} else {
159-
LOGGER.info("Setting kube workspace mdc");
159+
LOGGER.debug("Setting kube workspace mdc");
160160
MDC.put(LogClientSingleton.CLOUD_WORKSPACE_MDC_KEY, path.toString());
161161
}
162162
}

airbyte-workers/src/main/java/io/airbyte/workers/process/KubePodProcess.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ public class KubePodProcess extends Process {
123123
// 143 is the typical SIGTERM exit code.
124124
private static final int KILLED_EXIT_CODE = 143;
125125
private static final int STDIN_REMOTE_PORT = 9001;
126-
private static final Map<String, String> AIRBYTE_POD_LABELS = Map.of("airbyte", "worker-pod");
127126

128127
private final KubernetesClient fabricClient;
129128
private final Pod podDefinition;
@@ -273,6 +272,7 @@ public KubePodProcess(String processRunnerHost,
273272
final String entrypointOverride,
274273
ResourceRequirements resourceRequirements,
275274
List<WorkerPodToleration> tolerations,
275+
Map<String, String> labels,
276276
final String... args)
277277
throws IOException, InterruptedException {
278278
this.fabricClient = fabricClient;
@@ -374,7 +374,7 @@ public KubePodProcess(String processRunnerHost,
374374
.withApiVersion("v1")
375375
.withNewMetadata()
376376
.withName(podName)
377-
.withLabels(AIRBYTE_POD_LABELS)
377+
.withLabels(labels)
378378
.endMetadata()
379379
.withNewSpec()
380380
.withTolerations(buildPodTolerations(tolerations))

airbyte-workers/src/main/java/io/airbyte/workers/process/KubeProcessFactory.java

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class KubeProcessFactory implements ProcessFactory {
4545
private static final Logger LOGGER = LoggerFactory.getLogger(KubeProcessFactory.class);
4646

4747
private static final Pattern ALPHABETIC = Pattern.compile("[a-zA-Z]+");;
48+
private static final String JOB_LABEL_KEY = "job_id";
49+
private static final String ATTEMPT_LABEL_KEY = "attempt_id";
50+
private static final String WORKER_POD_LABEL_KEY = "airbyte";
51+
private static final String WORKER_POD_LABEL_VALUE = "worker-pod";
4852

4953
private final String namespace;
5054
private final ApiClient officialClient;
@@ -121,6 +125,9 @@ public Process create(String jobId,
121125
entrypoint,
122126
resourceRequirements,
123127
WorkerUtils.DEFAULT_WORKER_POD_TOLERATIONS,
128+
Map.of(JOB_LABEL_KEY, jobId,
129+
ATTEMPT_LABEL_KEY, String.valueOf(attempt),
130+
WORKER_POD_LABEL_KEY, WORKER_POD_LABEL_VALUE),
124131
args);
125132
} catch (Exception e) {
126133
throw new WorkerException(e.getMessage(), e);

0 commit comments

Comments
 (0)