Socket
Socket
Sign inDemoInstall

@sentry/browser

Package Overview
Dependencies
Maintainers
11
Versions
523
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/browser - npm Package Compare versions

Comparing version 8.20.0 to 8.21.0

build/npm/types-ts3.8/integrations-bundle/index.feedback.d.ts

2

build/npm/cjs/tracing/browserTracingIntegration.js

@@ -251,3 +251,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

request.instrumentOutgoingRequests({
request.instrumentOutgoingRequests(client, {
traceFetch,

@@ -254,0 +254,0 @@ traceXHR,

@@ -10,2 +10,5 @@ Object.defineProperty(exports, '__esModule', { value: true });

const responseToSpanId = new WeakMap();
const spanIdToEndTimestamp = new Map();
const defaultRequestInstrumentationOptions = {

@@ -18,3 +21,3 @@ traceFetch: true,

/** Registers span creators for xhr and fetch requests */
function instrumentOutgoingRequests(_options) {
function instrumentOutgoingRequests(client, _options) {
const { traceFetch, traceXHR, shouldCreateSpanForRequest, enableHTTPTimings, tracePropagationTargets } = {

@@ -34,4 +37,35 @@ traceFetch: defaultRequestInstrumentationOptions.traceFetch,

if (traceFetch) {
// Keeping track of http requests, whose body payloads resolved later than the intial resolved request
// e.g. streaming using server sent events (SSE)
client.addEventProcessor(event => {
if (event.type === 'transaction' && event.spans) {
event.spans.forEach(span => {
if (span.op === 'http.client') {
const updatedTimestamp = spanIdToEndTimestamp.get(span.span_id);
if (updatedTimestamp) {
span.timestamp = updatedTimestamp / 1000;
spanIdToEndTimestamp.delete(span.span_id);
}
}
});
}
return event;
});
utils.addFetchEndInstrumentationHandler(handlerData => {
if (handlerData.response) {
const span = responseToSpanId.get(handlerData.response);
if (span && handlerData.endTimestamp) {
spanIdToEndTimestamp.set(span, handlerData.endTimestamp);
}
}
});
utils.addFetchInstrumentationHandler(handlerData => {
const createdSpan = core.instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans);
if (handlerData.response && handlerData.fetchData.__span) {
responseToSpanId.set(handlerData.response, handlerData.fetchData.__span);
}
// We cannot use `window.location` in the generic fetch instrumentation,

@@ -38,0 +72,0 @@ // but we need it for reliable `server.address` attribute.

@@ -249,3 +249,3 @@ import { startTrackingWebVitals, startTrackingINP, startTrackingLongAnimationFrames, startTrackingLongTasks, startTrackingInteractions, addHistoryInstrumentationHandler, registerInpInteractionListener, addPerformanceEntries } from '@sentry-internal/browser-utils';

instrumentOutgoingRequests({
instrumentOutgoingRequests(client, {
traceFetch,

@@ -252,0 +252,0 @@ traceXHR,

import { addXhrInstrumentationHandler, addPerformanceInstrumentationHandler, SENTRY_XHR_DATA_KEY } from '@sentry-internal/browser-utils';
import { instrumentFetchRequest, spanToJSON, hasTracingEnabled, setHttpStatus, getActiveSpan, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_OP, SentryNonRecordingSpan, getClient, getCurrentScope, getIsolationScope, spanToTraceHeader, getDynamicSamplingContextFromSpan, getDynamicSamplingContextFromClient } from '@sentry/core';
import { addFetchInstrumentationHandler, parseUrl, browserPerformanceTimeOrigin, generateSentryTraceHeader, dynamicSamplingContextToSentryBaggageHeader, BAGGAGE_HEADER_NAME, stringMatchesSomePattern } from '@sentry/utils';
import { addFetchEndInstrumentationHandler, addFetchInstrumentationHandler, parseUrl, browserPerformanceTimeOrigin, generateSentryTraceHeader, dynamicSamplingContextToSentryBaggageHeader, BAGGAGE_HEADER_NAME, stringMatchesSomePattern } from '@sentry/utils';
import { WINDOW } from '../helpers.js';

@@ -8,2 +8,5 @@

const responseToSpanId = new WeakMap();
const spanIdToEndTimestamp = new Map();
const defaultRequestInstrumentationOptions = {

@@ -16,3 +19,3 @@ traceFetch: true,

/** Registers span creators for xhr and fetch requests */
function instrumentOutgoingRequests(_options) {
function instrumentOutgoingRequests(client, _options) {
const { traceFetch, traceXHR, shouldCreateSpanForRequest, enableHTTPTimings, tracePropagationTargets } = {

@@ -32,4 +35,35 @@ traceFetch: defaultRequestInstrumentationOptions.traceFetch,

if (traceFetch) {
// Keeping track of http requests, whose body payloads resolved later than the intial resolved request
// e.g. streaming using server sent events (SSE)
client.addEventProcessor(event => {
if (event.type === 'transaction' && event.spans) {
event.spans.forEach(span => {
if (span.op === 'http.client') {
const updatedTimestamp = spanIdToEndTimestamp.get(span.span_id);
if (updatedTimestamp) {
span.timestamp = updatedTimestamp / 1000;
spanIdToEndTimestamp.delete(span.span_id);
}
}
});
}
return event;
});
addFetchEndInstrumentationHandler(handlerData => {
if (handlerData.response) {
const span = responseToSpanId.get(handlerData.response);
if (span && handlerData.endTimestamp) {
spanIdToEndTimestamp.set(span, handlerData.endTimestamp);
}
}
});
addFetchInstrumentationHandler(handlerData => {
const createdSpan = instrumentFetchRequest(handlerData, shouldCreateSpan, shouldAttachHeadersWithTargets, spans);
if (handlerData.response && handlerData.fetchData.__span) {
responseToSpanId.set(handlerData.response, handlerData.fetchData.__span);
}
// We cannot use `window.location` in the generic fetch instrumentation,

@@ -36,0 +70,0 @@ // but we need it for reliable `server.address` attribute.

@@ -1,2 +0,2 @@

import { HandlerDataXhr, Span } from '@sentry/types';
import { Client, HandlerDataXhr, Span } from '@sentry/types';
/** Options for Request Instrumentation */

@@ -60,3 +60,3 @@ export interface RequestInstrumentationOptions {

/** Registers span creators for xhr and fetch requests */
export declare function instrumentOutgoingRequests(_options?: Partial<RequestInstrumentationOptions>): void;
export declare function instrumentOutgoingRequests(client: Client, _options?: Partial<RequestInstrumentationOptions>): void;
/**

@@ -63,0 +63,0 @@ * Converts ALPN protocol ids to name and version.

@@ -1,2 +0,2 @@

import type { HandlerDataXhr, Span } from '@sentry/types';
import type { Client, HandlerDataXhr, Span } from '@sentry/types';
/** Options for Request Instrumentation */

@@ -60,3 +60,3 @@ export interface RequestInstrumentationOptions {

/** Registers span creators for xhr and fetch requests */
export declare function instrumentOutgoingRequests(_options?: Partial<RequestInstrumentationOptions>): void;
export declare function instrumentOutgoingRequests(client: Client, _options?: Partial<RequestInstrumentationOptions>): void;
/**

@@ -63,0 +63,0 @@ * Converts ALPN protocol ids to name and version.

{
"name": "@sentry/browser",
"version": "8.20.0",
"version": "8.21.0",
"description": "Official Sentry SDK for browsers",

@@ -42,12 +42,12 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",

"dependencies": {
"@sentry-internal/browser-utils": "8.20.0",
"@sentry-internal/feedback": "8.20.0",
"@sentry-internal/replay": "8.20.0",
"@sentry-internal/replay-canvas": "8.20.0",
"@sentry/core": "8.20.0",
"@sentry/types": "8.20.0",
"@sentry/utils": "8.20.0"
"@sentry-internal/browser-utils": "8.21.0",
"@sentry-internal/feedback": "8.21.0",
"@sentry-internal/replay": "8.21.0",
"@sentry-internal/replay-canvas": "8.21.0",
"@sentry/core": "8.21.0",
"@sentry/types": "8.21.0",
"@sentry/utils": "8.21.0"
},
"devDependencies": {
"@sentry-internal/integration-shims": "8.20.0",
"@sentry-internal/integration-shims": "8.21.0",
"fake-indexeddb": "^4.0.1"

@@ -54,0 +54,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc