Skip to content

Commit 0c2d529

Browse files
committed
simplify
1 parent a4a3986 commit 0c2d529

3 files changed

Lines changed: 19 additions & 49 deletions

File tree

.size-limit.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module.exports = [
191191
name: 'CDN Bundle (incl. Tracing)',
192192
path: createCDNPath('bundle.tracing.min.js'),
193193
gzip: true,
194-
limit: '46.5 KB',
194+
limit: '47 KB',
195195
},
196196
{
197197
name: 'CDN Bundle (incl. Logs, Metrics)',
@@ -203,7 +203,7 @@ module.exports = [
203203
name: 'CDN Bundle (incl. Tracing, Logs, Metrics)',
204204
path: createCDNPath('bundle.tracing.logs.metrics.min.js'),
205205
gzip: true,
206-
limit: '47.5 KB',
206+
limit: '48 KB',
207207
},
208208
{
209209
name: 'CDN Bundle (incl. Replay, Logs, Metrics)',
@@ -215,25 +215,25 @@ module.exports = [
215215
name: 'CDN Bundle (incl. Tracing, Replay)',
216216
path: createCDNPath('bundle.tracing.replay.min.js'),
217217
gzip: true,
218-
limit: '83.5 KB',
218+
limit: '84 KB',
219219
},
220220
{
221221
name: 'CDN Bundle (incl. Tracing, Replay, Logs, Metrics)',
222222
path: createCDNPath('bundle.tracing.replay.logs.metrics.min.js'),
223223
gzip: true,
224-
limit: '84.5 KB',
224+
limit: '85 KB',
225225
},
226226
{
227227
name: 'CDN Bundle (incl. Tracing, Replay, Feedback)',
228228
path: createCDNPath('bundle.tracing.replay.feedback.min.js'),
229229
gzip: true,
230-
limit: '89 KB',
230+
limit: '89.5 KB',
231231
},
232232
{
233233
name: 'CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics)',
234234
path: createCDNPath('bundle.tracing.replay.feedback.logs.metrics.min.js'),
235235
gzip: true,
236-
limit: '90 KB',
236+
limit: '90.5 KB',
237237
},
238238
// browser CDN bundles (non-gzipped)
239239
{
@@ -248,7 +248,7 @@ module.exports = [
248248
path: createCDNPath('bundle.tracing.min.js'),
249249
gzip: false,
250250
brotli: false,
251-
limit: '138 KB',
251+
limit: '140 KB',
252252
},
253253
{
254254
name: 'CDN Bundle (incl. Logs, Metrics) - uncompressed',
@@ -262,7 +262,7 @@ module.exports = [
262262
path: createCDNPath('bundle.tracing.logs.metrics.min.js'),
263263
gzip: false,
264264
brotli: false,
265-
limit: '141.5 KB',
265+
limit: '143 KB',
266266
},
267267
{
268268
name: 'CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed',
@@ -276,28 +276,28 @@ module.exports = [
276276
path: createCDNPath('bundle.tracing.replay.min.js'),
277277
gzip: false,
278278
brotli: false,
279-
limit: '255.5 KB',
279+
limit: '257 KB',
280280
},
281281
{
282282
name: 'CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed',
283283
path: createCDNPath('bundle.tracing.replay.logs.metrics.min.js'),
284284
gzip: false,
285285
brotli: false,
286-
limit: '259 KB',
286+
limit: '260.5 KB',
287287
},
288288
{
289289
name: 'CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed',
290290
path: createCDNPath('bundle.tracing.replay.feedback.min.js'),
291291
gzip: false,
292292
brotli: false,
293-
limit: '269 KB',
293+
limit: '270 KB',
294294
},
295295
{
296296
name: 'CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed',
297297
path: createCDNPath('bundle.tracing.replay.feedback.logs.metrics.min.js'),
298298
gzip: false,
299299
brotli: false,
300-
limit: '272 KB',
300+
limit: '273.5 KB',
301301
},
302302
// Next.js SDK (ESM)
303303
{

dev-packages/node-integration-tests/suites/tracing/http-client-spans/fetch-basic-streamed/test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { createTestServer } from '@sentry-internal/test-utils';
22
import { expect, test } from 'vitest';
33
import { createRunner } from '../../../../utils/runner';
44

5-
test('infers sentry.op, name, and source for streamed outgoing fetch spans', async () => {
6-
expect.assertions(4);
5+
test('infers sentry.op for streamed outgoing fetch spans', async () => {
6+
expect.assertions(2);
77

88
const [SERVER_URL, closeTestServer] = await createTestServer()
99
.get('/api/v0', () => {
@@ -21,8 +21,6 @@ test('infers sentry.op, name, and source for streamed outgoing fetch spans', asy
2121
);
2222

2323
expect(httpClientSpan).toBeDefined();
24-
expect(httpClientSpan?.name).toMatch(/^GET /);
25-
expect(httpClientSpan?.attributes?.['sentry.source']).toEqual({ type: 'string', value: 'url' });
2624
},
2725
})
2826
.start()

packages/core/src/tracing/spans/captureSpan.ts

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME,
66
SEMANTIC_ATTRIBUTE_SENTRY_ENVIRONMENT,
77
SEMANTIC_ATTRIBUTE_SENTRY_OP,
8-
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
98
SEMANTIC_ATTRIBUTE_SENTRY_RELEASE,
109
SEMANTIC_ATTRIBUTE_SENTRY_SDK_NAME,
1110
SEMANTIC_ATTRIBUTE_SENTRY_SDK_VERSION,
@@ -17,7 +16,6 @@ import {
1716
SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS,
1817
SEMANTIC_ATTRIBUTE_USER_USERNAME,
1918
} from '../../semanticAttributes';
20-
import { getSanitizedUrlString, parseUrl, stripUrlQueryAndFragment } from '../../utils/url';
2119
import type { SerializedStreamedSpan, Span, StreamedSpanJSON } from '../../types-hoist/span';
2220
import { getCombinedScopeData } from '../../utils/scopeData';
2321
import {
@@ -234,39 +232,13 @@ function inferHttpSpanData(
234232
return;
235233
}
236234

237-
// Infer name and source from URL attributes
235+
// Only overwrite the span name when we have an explicit http.route — it's more specific than
236+
// what OTel instrumentation sets as the span name. For all other cases (url.full, http.target),
237+
// the OTel-set name is already good enough and we'd risk producing a worse name (e.g. full URL).
238238
const httpRoute = attributes['http.route'];
239-
const httpTarget = attributes['http.target'];
240-
const httpUrl = attributes['url.full'] || attributes['http.url'];
241-
const parsedUrl = typeof httpUrl === 'string' ? parseUrl(httpUrl) : undefined;
242-
const sanitizedUrl = parsedUrl ? getSanitizedUrlString(parsedUrl) : undefined;
243-
244-
let urlPath: string | undefined;
245-
let source: string | undefined;
246-
247239
if (typeof httpRoute === 'string') {
248-
urlPath = httpRoute;
249-
source = 'route';
250-
} else if (spanKind === SPAN_KIND_SERVER && typeof httpTarget === 'string') {
251-
urlPath = stripUrlQueryAndFragment(httpTarget);
252-
source = 'url';
253-
} else if (sanitizedUrl) {
254-
urlPath = sanitizedUrl;
255-
source = 'url';
256-
} else if (typeof httpTarget === 'string') {
257-
urlPath = stripUrlQueryAndFragment(httpTarget);
258-
source = 'url';
259-
}
260-
261-
if (urlPath) {
262-
const isClientOrServer = spanKind === SPAN_KIND_CLIENT || spanKind === SPAN_KIND_SERVER;
263-
const origin = attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] || 'manual';
264-
const isAutoSpan = `${origin}`.startsWith('auto');
265-
266-
if (isClientOrServer || isAutoSpan) {
267-
spanJSON.name = `${httpMethod} ${urlPath}`;
268-
safeSetSpanJSONAttributes(spanJSON, { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source });
269-
}
240+
spanJSON.name = `${httpMethod} ${httpRoute}`;
241+
safeSetSpanJSONAttributes(spanJSON, { [SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route' });
270242
}
271243
}
272244

0 commit comments

Comments
 (0)