You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@sentry-internal/browser-utils

Package Overview
Dependencies
Maintainers
9
Versions
152
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

to
9.36.0

33

build/cjs/metrics/lcp.js

@@ -34,3 +34,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

if (pageloadSpanId) {
sendStandaloneLcpSpan(standaloneLcpValue, standaloneLcpEntry, pageloadSpanId);
_sendStandaloneLcpSpan(standaloneLcpValue, standaloneLcpEntry, pageloadSpanId);
}

@@ -79,3 +79,10 @@ cleanupLcpHandler();

function sendStandaloneLcpSpan(lcpValue, entry, pageloadSpanId) {
/**
* Exported only for testing!
*/
function _sendStandaloneLcpSpan(
lcpValue,
entry,
pageloadSpanId,
) {
debugBuild.DEBUG_BUILD && core.logger.log(`Sending LCP span (${lcpValue})`);

@@ -97,8 +104,17 @@

if (entry) {
attributes['lcp.element'] = core.htmlTreeAsString(entry.element);
attributes['lcp.id'] = entry.id;
attributes['lcp.url'] = entry.url;
attributes['lcp.loadTime'] = entry.loadTime;
attributes['lcp.renderTime'] = entry.renderTime;
attributes['lcp.size'] = entry.size;
entry.element && (attributes['lcp.element'] = core.htmlTreeAsString(entry.element));
entry.id && (attributes['lcp.id'] = entry.id);
// Trim URL to the first 200 characters.
entry.url && (attributes['lcp.url'] = entry.url.trim().slice(0, 200));
// loadTime is the time of LCP that's related to receiving the LCP element response..
entry.loadTime != null && (attributes['lcp.loadTime'] = entry.loadTime);
// renderTime is loadTime + rendering time
// it's 0 if the LCP element is loaded from a 3rd party origin that doesn't send the
// `Timing-Allow-Origin` header.
entry.renderTime != null && (attributes['lcp.renderTime'] = entry.renderTime);
entry.size != null && (attributes['lcp.size'] = entry.size);
}

@@ -132,3 +148,4 @@

exports._sendStandaloneLcpSpan = _sendStandaloneLcpSpan;
exports.trackLcpAsStandaloneSpan = trackLcpAsStandaloneSpan;
//# sourceMappingURL=lcp.js.map

@@ -32,3 +32,3 @@ import { getClient, getActiveSpan, getRootSpan, spanToJSON, logger, browserPerformanceTimeOrigin, getCurrentScope, htmlTreeAsString, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE, SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT, SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';

if (pageloadSpanId) {
sendStandaloneLcpSpan(standaloneLcpValue, standaloneLcpEntry, pageloadSpanId);
_sendStandaloneLcpSpan(standaloneLcpValue, standaloneLcpEntry, pageloadSpanId);
}

@@ -77,3 +77,10 @@ cleanupLcpHandler();

function sendStandaloneLcpSpan(lcpValue, entry, pageloadSpanId) {
/**
* Exported only for testing!
*/
function _sendStandaloneLcpSpan(
lcpValue,
entry,
pageloadSpanId,
) {
DEBUG_BUILD && logger.log(`Sending LCP span (${lcpValue})`);

@@ -95,8 +102,17 @@

if (entry) {
attributes['lcp.element'] = htmlTreeAsString(entry.element);
attributes['lcp.id'] = entry.id;
attributes['lcp.url'] = entry.url;
attributes['lcp.loadTime'] = entry.loadTime;
attributes['lcp.renderTime'] = entry.renderTime;
attributes['lcp.size'] = entry.size;
entry.element && (attributes['lcp.element'] = htmlTreeAsString(entry.element));
entry.id && (attributes['lcp.id'] = entry.id);
// Trim URL to the first 200 characters.
entry.url && (attributes['lcp.url'] = entry.url.trim().slice(0, 200));
// loadTime is the time of LCP that's related to receiving the LCP element response..
entry.loadTime != null && (attributes['lcp.loadTime'] = entry.loadTime);
// renderTime is loadTime + rendering time
// it's 0 if the LCP element is loaded from a 3rd party origin that doesn't send the
// `Timing-Allow-Origin` header.
entry.renderTime != null && (attributes['lcp.renderTime'] = entry.renderTime);
entry.size != null && (attributes['lcp.size'] = entry.size);
}

@@ -130,3 +146,3 @@

export { trackLcpAsStandaloneSpan };
export { _sendStandaloneLcpSpan, trackLcpAsStandaloneSpan };
//# sourceMappingURL=lcp.js.map

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

{"type":"module","version":"9.36.0-alpha.2","sideEffects":false}
{"type":"module","version":"9.36.0","sideEffects":false}

@@ -11,2 +11,6 @@ /**

export declare function trackLcpAsStandaloneSpan(): void;
/**
* Exported only for testing!
*/
export declare function _sendStandaloneLcpSpan(lcpValue: number, entry: LargestContentfulPaint | undefined, pageloadSpanId: string): void;
//# sourceMappingURL=lcp.d.ts.map

@@ -11,2 +11,6 @@ /**

export declare function trackLcpAsStandaloneSpan(): void;
/**
* Exported only for testing!
*/
export declare function _sendStandaloneLcpSpan(lcpValue: number, entry: LargestContentfulPaint | undefined, pageloadSpanId: string): void;
//# sourceMappingURL=lcp.d.ts.map
{
"name": "@sentry-internal/browser-utils",
"version": "9.36.0-alpha.2",
"version": "9.36.0",
"description": "Browser Utilities for all Sentry JavaScript SDKs",

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

"dependencies": {
"@sentry/core": "9.36.0-alpha.2"
"@sentry/core": "9.36.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