Skip to content

Commit 0625ad5

Browse files
committed
Removed tracing that breaks tests
1 parent 094bcac commit 0625ad5

File tree

2 files changed

+57
-83
lines changed

2 files changed

+57
-83
lines changed
Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { IOPacket, packetRequiresOffloading, tryCatch } from "@trigger.dev/core/v3";
1+
import { type IOPacket, packetRequiresOffloading, tryCatch } from "@trigger.dev/core/v3";
22
import type { AuthenticatedEnvironment } from "~/services/apiAuth.server";
33
import { env } from "~/env.server";
44
import { uploadPacketToObjectStore } from "~/v3/objectStore.server";
55
import { ServiceValidationError } from "~/v3/services/common.server";
6-
import { startActiveSpan } from "~/v3/tracer.server";
76

87
function packetExtensionForDataType(dataType: string): string {
98
switch (dataType) {
@@ -28,42 +27,37 @@ export async function processWaitpointCompletionPacket(
2827
environment: AuthenticatedEnvironment,
2928
pathPrefix: string
3029
): Promise<IOPacket> {
31-
return await startActiveSpan("processWaitpointCompletionPacket()", async (span) => {
32-
if (!packet.data) {
33-
return packet;
34-
}
35-
36-
const { needsOffloading, size } = packetRequiresOffloading(
37-
packet,
38-
env.TASK_PAYLOAD_OFFLOAD_THRESHOLD
39-
);
30+
if (!packet.data) {
31+
return packet;
32+
}
4033

41-
span.setAttribute("needsOffloading", needsOffloading);
42-
span.setAttribute("size", size);
34+
const { needsOffloading, size } = packetRequiresOffloading(
35+
packet,
36+
env.TASK_PAYLOAD_OFFLOAD_THRESHOLD
37+
);
4338

44-
if (!needsOffloading) {
45-
return packet;
46-
}
39+
if (!needsOffloading) {
40+
return packet;
41+
}
4742

48-
const filename = `${pathPrefix}.${packetExtensionForDataType(packet.dataType)}`;
43+
const filename = `${pathPrefix}.${packetExtensionForDataType(packet.dataType)}`;
4944

50-
const [uploadError, uploadedFilename] = await tryCatch(
51-
uploadPacketToObjectStore(
52-
filename,
53-
packet.data,
54-
packet.dataType,
55-
environment,
56-
env.OBJECT_STORE_DEFAULT_PROTOCOL
57-
)
58-
);
45+
const [uploadError, uploadedFilename] = await tryCatch(
46+
uploadPacketToObjectStore(
47+
filename,
48+
packet.data,
49+
packet.dataType,
50+
environment,
51+
env.OBJECT_STORE_DEFAULT_PROTOCOL
52+
)
53+
);
5954

60-
if (uploadError) {
61-
throw new ServiceValidationError("Failed to upload large waitpoint to object store", 500);
62-
}
55+
if (uploadError) {
56+
throw new ServiceValidationError("Failed to upload large waitpoint to object store", 500);
57+
}
6358

64-
return {
65-
data: uploadedFilename!,
66-
dataType: "application/store",
67-
};
68-
});
59+
return {
60+
data: uploadedFilename!,
61+
dataType: "application/store",
62+
};
6963
}

apps/webapp/app/v3/objectStore.server.ts

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
import { type IOPacket } from "@trigger.dev/core/v3";
12
import { env } from "~/env.server";
2-
import { AuthenticatedEnvironment } from "~/services/apiAuth.server";
3+
import { type AuthenticatedEnvironment } from "~/services/apiAuth.server";
34
import { logger } from "~/services/logger.server";
45
import { singleton } from "~/utils/singleton";
5-
import { tracer } from "~/v3/tracer.server";
6-
import { startSpan } from "~/v3/tracing.server";
7-
import { IOPacket } from "@trigger.dev/core/v3";
86
import { ObjectStoreClient, type ObjectStoreClientConfig } from "./objectStoreClient.server";
97

108
/**
@@ -129,30 +127,21 @@ export async function uploadPacketToObjectStore(
129127
environment: AuthenticatedEnvironment,
130128
storageProtocol?: string
131129
): Promise<string> {
132-
return await startSpan(tracer, "uploadPacketToObjectStore()", async (span) => {
133-
const protocol = storageProtocol || env.OBJECT_STORE_DEFAULT_PROTOCOL;
134-
const client = getObjectStoreClient(protocol);
130+
const protocol = storageProtocol || env.OBJECT_STORE_DEFAULT_PROTOCOL;
131+
const client = getObjectStoreClient(protocol);
135132

136-
if (!client) {
137-
throw new Error(`Object store is not configured for protocol: ${protocol || "default"}`);
138-
}
139-
140-
span.setAttributes({
141-
projectRef: environment.project.externalRef,
142-
environmentSlug: environment.slug,
143-
filename,
144-
protocol: protocol || "default",
145-
});
133+
if (!client) {
134+
throw new Error(`Object store is not configured for protocol: ${protocol || "default"}`);
135+
}
146136

147-
const key = `packets/${environment.project.externalRef}/${environment.slug}/${filename}`;
137+
const key = `packets/${environment.project.externalRef}/${environment.slug}/${filename}`;
148138

149-
logger.debug("Uploading to object store", { key, protocol: protocol || "default" });
139+
logger.debug("Uploading to object store", { key, protocol: protocol || "default" });
150140

151-
await client.putObject(key, data, contentType);
141+
await client.putObject(key, data, contentType);
152142

153-
// Return filename with protocol prefix if specified
154-
return formatStorageUri(filename, protocol);
155-
});
143+
// Return filename with protocol prefix if specified
144+
return formatStorageUri(filename, protocol);
156145
}
157146

158147
export async function downloadPacketFromObjectStore(
@@ -163,38 +152,29 @@ export async function downloadPacketFromObjectStore(
163152
return packet;
164153
}
165154

166-
return await startSpan(tracer, "downloadPacketFromObjectStore()", async (span) => {
167-
// There shouldn't be an offloaded packet with undefined data…
168-
if (!packet.data) {
169-
logger.error("Object store packet has undefined data", { packet, environment });
170-
return {
171-
dataType: "application/json",
172-
data: undefined,
173-
};
174-
}
175-
176-
const { protocol, path } = parseStorageUri(packet.data);
177-
const client = getObjectStoreClient(protocol);
155+
// There shouldn't be an offloaded packet with undefined data…
156+
if (!packet.data) {
157+
logger.error("Object store packet has undefined data", { packet, environment });
158+
return {
159+
dataType: "application/json",
160+
data: undefined,
161+
};
162+
}
178163

179-
if (!client) {
180-
throw new Error(`Object store is not configured for protocol: ${protocol || "default"}`);
181-
}
164+
const { protocol, path } = parseStorageUri(packet.data);
165+
const client = getObjectStoreClient(protocol);
182166

183-
span.setAttributes({
184-
projectRef: environment.project.externalRef,
185-
environmentSlug: environment.slug,
186-
filename: packet.data,
187-
protocol: protocol || "default",
188-
});
167+
if (!client) {
168+
throw new Error(`Object store is not configured for protocol: ${protocol || "default"}`);
169+
}
189170

190-
const key = `packets/${environment.project.externalRef}/${environment.slug}/${path}`;
171+
const key = `packets/${environment.project.externalRef}/${environment.slug}/${path}`;
191172

192-
logger.debug("Downloading from object store", { key, protocol: protocol || "default" });
173+
logger.debug("Downloading from object store", { key, protocol: protocol || "default" });
193174

194-
const data = await client.getObject(key);
175+
const data = await client.getObject(key);
195176

196-
return { data, dataType: "application/json" };
197-
});
177+
return { data, dataType: "application/json" };
198178
}
199179

200180
export type GeneratePacketPresignOptions = {

0 commit comments

Comments
 (0)