Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sentry-internal/browser-utils

Package Overview
Dependencies
Maintainers
9
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry-internal/browser-utils - npm Package Compare versions

Comparing version 8.43.0 to 8.44.0

64

build/cjs/metrics/browserMetrics.js

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

const performance = utils.getBrowserPerformanceAPI();
if (!performance || !types.WINDOW.performance.getEntries || !core.browserPerformanceTimeOrigin) {
if (!performance || !performance.getEntries || !core.browserPerformanceTimeOrigin) {
// Gatekeeper if performance API not available

@@ -247,4 +247,3 @@ return;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
performanceEntries.slice(_performanceCursor).forEach((entry) => {
performanceEntries.slice(_performanceCursor).forEach(entry => {
const startTime = utils.msToSec(entry.startTime);

@@ -265,3 +264,3 @@ const duration = utils.msToSec(

case 'navigation': {
_addNavigationSpans(span, entry, timeOrigin);
_addNavigationSpans(span, entry , timeOrigin);
break;

@@ -288,3 +287,3 @@ }

case 'resource': {
_addResourceSpans(span, entry, entry.name , startTime, duration, timeOrigin);
_addResourceSpans(span, entry , entry.name, startTime, duration, timeOrigin);
break;

@@ -349,6 +348,8 @@ }

/** Create measure related spans */
/**
* Create measure related spans.
* Exported only for tests.
*/
function _addMeasureSpans(
span,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
entry,

@@ -393,10 +394,10 @@ startTime,

/** Instrument navigation entries */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function _addNavigationSpans(span, entry, timeOrigin) {
['unloadEvent', 'redirect', 'domContentLoadedEvent', 'loadEvent', 'connect'].forEach(event => {
(['unloadEvent', 'redirect', 'domContentLoadedEvent', 'loadEvent', 'connect'] ).forEach(event => {
_addPerformanceNavigationTiming(span, entry, event, timeOrigin);
});
_addPerformanceNavigationTiming(span, entry, 'secureConnection', timeOrigin, 'TLS/SSL', 'connectEnd');
_addPerformanceNavigationTiming(span, entry, 'fetch', timeOrigin, 'cache', 'domainLookupStart');
_addPerformanceNavigationTiming(span, entry, 'secureConnection', timeOrigin, 'TLS/SSL');
_addPerformanceNavigationTiming(span, entry, 'fetch', timeOrigin, 'cache');
_addPerformanceNavigationTiming(span, entry, 'domainLookup', timeOrigin, 'DNS');
_addRequest(span, entry, timeOrigin);

@@ -408,11 +409,10 @@ }

span,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
entry,
event,
timeOrigin,
name,
eventEnd,
name = event,
) {
const end = eventEnd ? (entry[eventEnd] ) : (entry[`${event}End`] );
const start = entry[`${event}Start`] ;
const eventEnd = _getEndPropertyNameForNavigationTiming(event) ;
const end = entry[eventEnd];
const start = entry[`${event}Start`];
if (!start || !end) {

@@ -422,3 +422,3 @@ return;

utils.startAndEndSpan(span, timeOrigin + utils.msToSec(start), timeOrigin + utils.msToSec(end), {
op: `browser.${name || event}`,
op: `browser.${name}`,
name: entry.name,

@@ -431,4 +431,13 @@ attributes: {

function _getEndPropertyNameForNavigationTiming(event) {
if (event === 'secureConnection') {
return 'connectEnd';
}
if (event === 'fetch') {
return 'domainLookupStart';
}
return `${event}End`;
}
/** Create request and response related spans */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function _addRequest(span, entry, timeOrigin) {

@@ -461,3 +470,6 @@ const requestStartTimestamp = timeOrigin + utils.msToSec(entry.requestStart );

/** Create resource-related spans */
/**
* Create resource-related spans.
* Exported only for tests.
*/
function _addResourceSpans(

@@ -486,9 +498,15 @@ span,

if (entry.deliveryType != null) {
attributes['http.response_delivery_type'] = entry.deliveryType;
// `deliveryType` is experimental and does not exist everywhere
const deliveryType = (entry ).deliveryType;
if (deliveryType != null) {
attributes['http.response_delivery_type'] = deliveryType;
}
if ('renderBlockingStatus' in entry) {
attributes['resource.render_blocking_status'] = entry.renderBlockingStatus;
// Types do not reflect this property yet
const renderBlockingStatus = (entry )
.renderBlockingStatus;
if (renderBlockingStatus) {
attributes['resource.render_blocking_status'] = renderBlockingStatus;
}
if (parsedUrl.protocol) {

@@ -495,0 +513,0 @@ attributes['url.scheme'] = parsedUrl.protocol.split(':').pop(); // the protocol returned by parseUrl includes a :, but OTEL spec does not, so we remove it.

@@ -233,3 +233,3 @@ import { browserPerformanceTimeOrigin, getActiveSpan, spanToJSON, setMeasurement, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, parseUrl, htmlTreeAsString, getComponentName } from '@sentry/core';

const performance = getBrowserPerformanceAPI();
if (!performance || !WINDOW.performance.getEntries || !browserPerformanceTimeOrigin) {
if (!performance || !performance.getEntries || !browserPerformanceTimeOrigin) {
// Gatekeeper if performance API not available

@@ -245,4 +245,3 @@ return;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
performanceEntries.slice(_performanceCursor).forEach((entry) => {
performanceEntries.slice(_performanceCursor).forEach(entry => {
const startTime = msToSec(entry.startTime);

@@ -263,3 +262,3 @@ const duration = msToSec(

case 'navigation': {
_addNavigationSpans(span, entry, timeOrigin);
_addNavigationSpans(span, entry , timeOrigin);
break;

@@ -286,3 +285,3 @@ }

case 'resource': {
_addResourceSpans(span, entry, entry.name , startTime, duration, timeOrigin);
_addResourceSpans(span, entry , entry.name, startTime, duration, timeOrigin);
break;

@@ -347,6 +346,8 @@ }

/** Create measure related spans */
/**
* Create measure related spans.
* Exported only for tests.
*/
function _addMeasureSpans(
span,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
entry,

@@ -391,10 +392,10 @@ startTime,

/** Instrument navigation entries */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function _addNavigationSpans(span, entry, timeOrigin) {
['unloadEvent', 'redirect', 'domContentLoadedEvent', 'loadEvent', 'connect'].forEach(event => {
(['unloadEvent', 'redirect', 'domContentLoadedEvent', 'loadEvent', 'connect'] ).forEach(event => {
_addPerformanceNavigationTiming(span, entry, event, timeOrigin);
});
_addPerformanceNavigationTiming(span, entry, 'secureConnection', timeOrigin, 'TLS/SSL', 'connectEnd');
_addPerformanceNavigationTiming(span, entry, 'fetch', timeOrigin, 'cache', 'domainLookupStart');
_addPerformanceNavigationTiming(span, entry, 'secureConnection', timeOrigin, 'TLS/SSL');
_addPerformanceNavigationTiming(span, entry, 'fetch', timeOrigin, 'cache');
_addPerformanceNavigationTiming(span, entry, 'domainLookup', timeOrigin, 'DNS');
_addRequest(span, entry, timeOrigin);

@@ -406,11 +407,10 @@ }

span,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
entry,
event,
timeOrigin,
name,
eventEnd,
name = event,
) {
const end = eventEnd ? (entry[eventEnd] ) : (entry[`${event}End`] );
const start = entry[`${event}Start`] ;
const eventEnd = _getEndPropertyNameForNavigationTiming(event) ;
const end = entry[eventEnd];
const start = entry[`${event}Start`];
if (!start || !end) {

@@ -420,3 +420,3 @@ return;

startAndEndSpan(span, timeOrigin + msToSec(start), timeOrigin + msToSec(end), {
op: `browser.${name || event}`,
op: `browser.${name}`,
name: entry.name,

@@ -429,4 +429,13 @@ attributes: {

function _getEndPropertyNameForNavigationTiming(event) {
if (event === 'secureConnection') {
return 'connectEnd';
}
if (event === 'fetch') {
return 'domainLookupStart';
}
return `${event}End`;
}
/** Create request and response related spans */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function _addRequest(span, entry, timeOrigin) {

@@ -459,3 +468,6 @@ const requestStartTimestamp = timeOrigin + msToSec(entry.requestStart );

/** Create resource-related spans */
/**
* Create resource-related spans.
* Exported only for tests.
*/
function _addResourceSpans(

@@ -484,9 +496,15 @@ span,

if (entry.deliveryType != null) {
attributes['http.response_delivery_type'] = entry.deliveryType;
// `deliveryType` is experimental and does not exist everywhere
const deliveryType = (entry ).deliveryType;
if (deliveryType != null) {
attributes['http.response_delivery_type'] = deliveryType;
}
if ('renderBlockingStatus' in entry) {
attributes['resource.render_blocking_status'] = entry.renderBlockingStatus;
// Types do not reflect this property yet
const renderBlockingStatus = (entry )
.renderBlockingStatus;
if (renderBlockingStatus) {
attributes['resource.render_blocking_status'] = renderBlockingStatus;
}
if (parsedUrl.protocol) {

@@ -493,0 +511,0 @@ attributes['url.scheme'] = parsedUrl.protocol.split(':').pop(); // the protocol returned by parseUrl includes a :, but OTEL spec does not, so we remove it.

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

{"type":"module","version":"8.43.0","sideEffects":false}
{"type":"module","version":"8.44.0","sideEffects":false}

@@ -34,14 +34,12 @@ import { Span } from '@sentry/core';

export declare function addPerformanceEntries(span: Span, options: AddPerformanceEntriesOptions): void;
/** Create measure related spans */
export declare function _addMeasureSpans(span: Span, entry: Record<string, any>, startTime: number, duration: number, timeOrigin: number): number;
export interface ResourceEntry extends Record<string, unknown> {
initiatorType?: string;
transferSize?: number;
encodedBodySize?: number;
decodedBodySize?: number;
renderBlockingStatus?: string;
deliveryType?: string;
}
/** Create resource-related spans */
export declare function _addResourceSpans(span: Span, entry: ResourceEntry, resourceUrl: string, startTime: number, duration: number, timeOrigin: number): void;
/**
* Create measure related spans.
* Exported only for tests.
*/
export declare function _addMeasureSpans(span: Span, entry: PerformanceEntry, startTime: number, duration: number, timeOrigin: number): number;
/**
* Create resource-related spans.
* Exported only for tests.
*/
export declare function _addResourceSpans(span: Span, entry: PerformanceResourceTiming, resourceUrl: string, startTime: number, duration: number, timeOrigin: number): void;
//# sourceMappingURL=browserMetrics.d.ts.map

@@ -34,14 +34,12 @@ import type { Span } from '@sentry/core';

export declare function addPerformanceEntries(span: Span, options: AddPerformanceEntriesOptions): void;
/** Create measure related spans */
export declare function _addMeasureSpans(span: Span, entry: Record<string, any>, startTime: number, duration: number, timeOrigin: number): number;
export interface ResourceEntry extends Record<string, unknown> {
initiatorType?: string;
transferSize?: number;
encodedBodySize?: number;
decodedBodySize?: number;
renderBlockingStatus?: string;
deliveryType?: string;
}
/** Create resource-related spans */
export declare function _addResourceSpans(span: Span, entry: ResourceEntry, resourceUrl: string, startTime: number, duration: number, timeOrigin: number): void;
/**
* Create measure related spans.
* Exported only for tests.
*/
export declare function _addMeasureSpans(span: Span, entry: PerformanceEntry, startTime: number, duration: number, timeOrigin: number): number;
/**
* Create resource-related spans.
* Exported only for tests.
*/
export declare function _addResourceSpans(span: Span, entry: PerformanceResourceTiming, resourceUrl: string, startTime: number, duration: number, timeOrigin: number): void;
//# sourceMappingURL=browserMetrics.d.ts.map
{
"name": "@sentry-internal/browser-utils",
"version": "8.43.0",
"version": "8.44.0",
"description": "Browser Utilities for all Sentry JavaScript SDKs",

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

"dependencies": {
"@sentry/core": "8.43.0"
"@sentry/core": "8.44.0"
},

@@ -45,0 +45,0 @@ "scripts": {

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