Skip to content

Fix for missing logs when triggering without a trigger-version #1331

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

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ function NoLogsView({ run, resizable }: LoaderData) {
min={resizableSettings.parent.inspector.min}
isStaticAtRest
>
{" "}
<SpanView runParam={run.friendlyId} spanId={run.spanId} />
</ResizablePanel>
</ResizablePanelGroup>
Expand Down
8 changes: 7 additions & 1 deletion apps/webapp/app/routes/api.v1.tasks.$taskId.batch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
"idempotency-key": idempotencyKey,
"trigger-version": triggerVersion,
"x-trigger-span-parent-as-link": spanParentAsLink,
"x-trigger-worker": isFromWorker,
traceparent,
tracestate,
} = headers.data;
Expand Down Expand Up @@ -86,11 +87,16 @@ export async function action({ request, params }: ActionFunctionArgs) {

const service = new BatchTriggerTaskService();

const traceContext =
traceparent ?? isFromWorker // If the request is from a worker, we should pass the trace context
? { traceparent, tracestate }
: undefined;

try {
const result = await service.call(taskId, authenticationResult.environment, body.data, {
idempotencyKey: idempotencyKey ?? undefined,
triggerVersion: triggerVersion ?? undefined,
traceContext: traceparent ? { traceparent, tracestate } : undefined,
traceContext,
spanParentAsLink: spanParentAsLink === 1,
});

Expand Down
9 changes: 3 additions & 6 deletions apps/webapp/app/routes/api.v1.tasks.$taskId.trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,10 @@ export async function action({ request, params }: ActionFunctionArgs) {
const service = new TriggerTaskService();

try {
const traceContext = traceparent
? !triggerVersion // If the trigger version is NOT set, we are in an older version of the SDK
const traceContext =
traceparent ?? isFromWorker /// If the request is from a worker, we should pass the trace context
? { traceparent, tracestate }
: isFromWorker // If the trigger version is set, and the request is from a worker, we should pass the trace context
? { traceparent, tracestate }
: undefined
: undefined;
: undefined;

logger.debug("Triggering task", {
taskId,
Expand Down
Loading