Skip to content

Commit 3cfcff9

Browse files
committed
Revert "Add tracing infrastructure for bindings"
This reverts commit f617216.
1 parent 1423c77 commit 3cfcff9

26 files changed

+40
-1480
lines changed

src/cloudflare/internal/d1-api.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
33
// https://opensource.org/licenses/Apache-2.0
44

5-
import { withSpan } from 'cloudflare-internal:tracing-helpers';
6-
75
interface Fetcher {
86
fetch: typeof fetch;
97
}
@@ -85,10 +83,7 @@ class D1Database {
8583
}
8684

8785
prepare(query: string): D1PreparedStatement {
88-
return withSpan('prepare', (span) => {
89-
span.setAttribute('query', query);
90-
return new D1PreparedStatement(this.alwaysPrimarySession, query);
91-
});
86+
return new D1PreparedStatement(this.alwaysPrimarySession, query);
9287
}
9388

9489
async batch<T = unknown>(
@@ -98,10 +93,7 @@ class D1Database {
9893
}
9994

10095
async exec(query: string): Promise<D1ExecResult> {
101-
return withSpan('exec', async (span) => {
102-
span.setAttribute('query', query);
103-
return this.alwaysPrimarySession.exec(query);
104-
});
96+
return this.alwaysPrimarySession.exec(query);
10597
}
10698

10799
withSession(
@@ -163,10 +155,7 @@ class D1DatabaseSession {
163155
}
164156

165157
prepare(sql: string): D1PreparedStatement {
166-
return withSpan('prepare', (span) => {
167-
span.setAttribute('sql', sql);
168-
return new D1PreparedStatement(this, sql);
169-
});
158+
return new D1PreparedStatement(this, sql);
170159
}
171160

172161
async batch<T = unknown>(

src/cloudflare/internal/images-api.ts

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
createBase64DecoderTransformStream,
77
createBase64EncoderTransformStream,
88
} from 'cloudflare-internal:streaming-base64';
9-
import { withSpan } from 'cloudflare-internal:tracing-helpers';
109

1110
type Fetcher = {
1211
fetch: typeof fetch;
@@ -234,49 +233,40 @@ class ImagesBindingImpl implements ImagesBinding {
234233
stream: ReadableStream<Uint8Array>,
235234
options?: ImageInputOptions
236235
): Promise<ImageInfoResponse> {
237-
return await withSpan('images_info', async (span) => {
238-
const body = new StreamableFormData();
239-
240-
const decodedStream =
241-
options?.encoding === 'base64'
242-
? stream.pipeThrough(createBase64DecoderTransformStream())
243-
: stream;
244-
245-
span.setAttribute('cloudflare.images.info.encoding', options?.encoding);
246-
247-
body.append('image', decodedStream, { type: 'file' });
248-
249-
const response = await this.#fetcher.fetch(
250-
'https://js.images.cloudflare.com/info',
251-
{
252-
method: 'POST',
253-
headers: {
254-
'content-type': body.contentType(),
255-
},
256-
body: body.stream(),
257-
}
258-
);
259-
260-
await throwErrorIfErrorResponse('INFO', response);
236+
const body = new StreamableFormData();
261237

262-
const r = (await response.json()) as RawInfoResponse;
238+
const decodedStream =
239+
options?.encoding === 'base64'
240+
? stream.pipeThrough(createBase64DecoderTransformStream())
241+
: stream;
263242

264-
span.setAttribute('cloudflare.images.info.format', r.format);
243+
body.append('image', decodedStream, { type: 'file' });
265244

266-
if ('file_size' in r) {
267-
span.setAttribute('cloudflare.images.info.file_size', r.file_size);
268-
span.setAttribute('cloudflare.images.info.width', r.width);
269-
span.setAttribute('cloudflare.images.info.height', r.height);
270-
return {
271-
fileSize: r.file_size,
272-
width: r.width,
273-
height: r.height,
274-
format: r.format,
275-
};
245+
const response = await this.#fetcher.fetch(
246+
'https://js.images.cloudflare.com/info',
247+
{
248+
method: 'POST',
249+
headers: {
250+
'content-type': body.contentType(),
251+
},
252+
body: body.stream(),
276253
}
254+
);
277255

278-
return r;
279-
});
256+
await throwErrorIfErrorResponse('INFO', response);
257+
258+
const r = (await response.json()) as RawInfoResponse;
259+
260+
if ('file_size' in r) {
261+
return {
262+
fileSize: r.file_size,
263+
width: r.width,
264+
height: r.height,
265+
format: r.format,
266+
};
267+
}
268+
269+
return r;
280270
}
281271

282272
input(

src/cloudflare/internal/test-tracing-wrapper.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/cloudflare/internal/test/BUILD.bazel

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/cloudflare/internal/test/d1/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ wd_test(
77
data = glob(
88
["*.js"],
99
exclude = ["d1-api-test-with-sessions.js"],
10-
) + ["//src/cloudflare/internal/test:instrumentation-test-helper.js"],
10+
),
1111
)
1212

1313
wd_test(

0 commit comments

Comments
 (0)