-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trace errors in orchestrator workers #18381
Changes from 2 commits
88c84b6
9efec16
8c720ab
2f3646c
33d9cb6
e43cf3a
289ccd9
25eee84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,21 @@ | |
|
||
package io.airbyte.workers.general; | ||
|
||
import static io.airbyte.metrics.lib.ApmTraceConstants.Tags.JOB_ID_KEY; | ||
import static io.airbyte.metrics.lib.ApmTraceConstants.Tags.JOB_ROOT_KEY; | ||
import static io.airbyte.metrics.lib.ApmTraceConstants.WORKER_OPERATION_NAME; | ||
|
||
import datadog.trace.api.Trace; | ||
import io.airbyte.commons.io.LineGobbler; | ||
import io.airbyte.config.OperatorDbtInput; | ||
import io.airbyte.config.ResourceRequirements; | ||
import io.airbyte.metrics.lib.ApmTraceUtils; | ||
import io.airbyte.workers.Worker; | ||
import io.airbyte.workers.exception.WorkerException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.time.Duration; | ||
import java.util.Map; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
@@ -40,10 +47,12 @@ public DbtTransformationWorker(final String jobId, | |
this.cancelled = new AtomicBoolean(false); | ||
} | ||
|
||
@Trace(operationName = WORKER_OPERATION_NAME) | ||
@Override | ||
public Void run(final OperatorDbtInput operatorDbtInput, final Path jobRoot) throws WorkerException { | ||
final long startTime = System.currentTimeMillis(); | ||
LineGobbler.startSection("DBT TRANSFORMATION"); | ||
ApmTraceUtils.addTagsToTrace(Map.of(JOB_ID_KEY, jobId, JOB_ROOT_KEY, jobRoot)); | ||
|
||
try (dbtTransformationRunner) { | ||
LOGGER.info("Running dbt transformation."); | ||
|
@@ -59,6 +68,7 @@ public Void run(final OperatorDbtInput operatorDbtInput, final Path jobRoot) thr | |
throw new WorkerException("DBT Transformation Failed."); | ||
} | ||
} catch (final Exception e) { | ||
ApmTraceUtils.addExceptionToTrace(e); | ||
throw new WorkerException("Dbt Transformation Failed.", e); | ||
} | ||
if (cancelled.get()) { | ||
|
@@ -79,7 +89,7 @@ public void cancel() { | |
cancelled.set(true); | ||
dbtTransformationRunner.close(); | ||
} catch (final Exception e) { | ||
e.printStackTrace(); | ||
LOGGER.error("Unable to cancel Dbt Transformation runner.", e); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we missing a call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @colesnodgrass pointed out the same thing. I have added a |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this worth emitting an event in DD (instead of only logging)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I can trace the cancel call as well.