Skip to content

Commit b90251d

Browse files
committed
Suppress external instrumentations for fetch calls from ApiClient
Signed-off-by: Erin Allison <erin@eallison.us>
1 parent 5730fae commit b90251d

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

packages/core/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
"@jsonhero/path": "^1.0.21",
188188
"@opentelemetry/api": "1.9.0",
189189
"@opentelemetry/api-logs": "0.52.1",
190+
"@opentelemetry/core": "^1.30.1",
190191
"@opentelemetry/exporter-logs-otlp-http": "0.52.1",
191192
"@opentelemetry/exporter-trace-otlp-http": "0.52.1",
192193
"@opentelemetry/instrumentation": "0.52.1",

packages/core/src/v3/apiClient/core.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { calculateNextRetryDelay } from "../utils/retries.js";
55
import { ApiConnectionError, ApiError, ApiSchemaValidationError } from "./errors.js";
66

77
import { Attributes, context, propagation, Span } from "@opentelemetry/api";
8+
import {suppressTracing} from "@opentelemetry/core"
89
import { SemanticInternalAttributes } from "../semanticInternalAttributes.js";
910
import type { TriggerTracer } from "../tracer.js";
1011
import { accessoryAttributes } from "../utils/styleAttributes.js";
@@ -216,7 +217,9 @@ async function _doZodFetchWithRetries<TResponseBodySchema extends z.ZodTypeAny>(
216217
attempt = 1
217218
): Promise<ZodFetchResult<z.output<TResponseBodySchema>>> {
218219
try {
219-
const response = await fetch(url, requestInitWithCache(requestInit));
220+
const response = await context.with(suppressTracing(context.active()), () =>
221+
fetch(url, requestInitWithCache(requestInit))
222+
);
220223

221224
const responseHeaders = createResponseHeaders(response.headers);
222225

pnpm-lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)