Skip to content

Commit 685911c

Browse files
committed
simplify trace headers?
1 parent 2b2e140 commit 685911c

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

packages/bundler-plugin-core/src/build-plugin-manager.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import SentryCli from "@sentry/cli";
22
import {
33
closeSession,
44
DEFAULT_ENVIRONMENT,
5-
getDynamicSamplingContextFromSpan,
5+
getTraceData,
66
makeSession,
77
setMeasurement,
8-
spanToTraceHeader,
98
startSpan,
109
} from "@sentry/core";
1110
import * as dotenv from "dotenv";
@@ -23,7 +22,6 @@ import { Options, SentrySDKBuildFlags } from "./types";
2322
import { arrayify, getTurborepoEnvPassthroughWarning, stripQueryAndHashFromPath } from "./utils";
2423
import { glob } from "glob";
2524
import { defaultRewriteSourcesHook, prepareBundleForDebugIdUpload } from "./debug-id-upload";
26-
import { dynamicSamplingContextToSentryBaggageHeader } from "@sentry/utils";
2725

2826
export type SentryBuildPluginManager = {
2927
/**
@@ -89,10 +87,7 @@ export type SentryBuildPluginManager = {
8987
createDependencyOnBuildArtifacts: () => () => void;
9088
};
9189

92-
function createCliInstance(
93-
options: NormalizedOptions,
94-
additionalHeaders: Record<string, string> = {}
95-
): SentryCli {
90+
function createCliInstance(options: NormalizedOptions): SentryCli {
9691
return new SentryCli(null, {
9792
authToken: options.authToken,
9893
org: options.org,
@@ -101,8 +96,7 @@ function createCliInstance(
10196
url: options.url,
10297
vcsRemote: options.release.vcsRemote,
10398
headers: {
104-
...options.headers,
105-
...additionalHeaders,
99+
...getTraceData(),
106100
},
107101
});
108102
}
@@ -666,14 +660,8 @@ export function createSentryBuildPluginManager(
666660
setMeasurement("files", files.length, "none", prepBundlesSpan);
667661
setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
668662

669-
await startSpan({ name: "upload", scope: sentryScope }, async (uploadSpan) => {
670-
const cliInstance = createCliInstance(options, {
671-
"sentry-trace": spanToTraceHeader(uploadSpan),
672-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
673-
baggage: dynamicSamplingContextToSentryBaggageHeader(
674-
getDynamicSamplingContextFromSpan(uploadSpan)
675-
)!,
676-
});
663+
await startSpan({ name: "upload", scope: sentryScope }, async () => {
664+
const cliInstance = createCliInstance(options);
677665

678666
await cliInstance.releases.uploadSourceMaps(
679667
options.release.name ?? "undefined", // unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow

0 commit comments

Comments
 (0)