Socket
Socket
Sign inDemoInstall

@sentry/utils

Package Overview
Dependencies
1
Maintainers
11
Versions
470
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sentry/utils

Utilities for all Sentry JavaScript SDKs


Version published
Weekly downloads
8.6M
decreased by-18.08%
Maintainers
11
Install size
1.49 MB
Created
Weekly downloads
 

Package description

What is @sentry/utils?

The @sentry/utils package provides a collection of utility functions and classes that are used across the Sentry JavaScript SDK. These utilities help with various tasks such as data manipulation, browser and node environment checks, and integration with Sentry's error tracking and performance monitoring features.

What are @sentry/utils's main functionalities?

Data Manipulation

Provides utility functions for checking data types and manipulating data. For example, the `isString` function can be used to check if a variable is a string.

import { isString } from '@sentry/utils';

function logMessage(message) {
  if (isString(message)) {
    console.log(message);
  } else {
    console.log('Not a string');
  }
}

Environment Checks

Includes functions to check the current runtime environment, such as whether the code is running in a browser or Node.js environment. This is useful for writing isomorphic code that runs both on the client and server.

import { isNodeEnv } from '@sentry/utils';

if (isNodeEnv()) {
  console.log('Running in a Node environment');
} else {
  console.log('Not running in a Node environment');
}

Integration Helpers

Provides functions and classes to help integrate with Sentry, including adding global event processors that can modify or filter events before they are sent to Sentry.

import { addGlobalEventProcessor } from '@sentry/utils';

addGlobalEventProcessor(event => {
  // Modify the event object or return null to skip sending the event
  return event;
});

Other packages similar to @sentry/utils

Changelog

Source

7.95.0

Important Changes

Deprecations

This release includes some deprecations in preparation for v8.

Most notably, it deprecates the Replay & Feedback classes in favor of a functional replacement:

import * as Sentry from '@sentry/browser';

Sentry.init({
  integrations: [
    // Instead of
    new Sentry.Replay(),
    new Sentry.Feedback(),
    // Use the functional replacement:
    Sentry.replayIntegration(),
    Sentry.feedbackIntegration(),
  ],
});
  • feat(core): Deprecate Span.origin in favor of sentry.origin attribute (#10260)
  • feat(core): Deprecate Span.parentSpanId (#10244)
  • feat(core): Expose isInitialized() to replace checking via getClient (#10296)
  • feat(replay): Deprecate Replay, ReplayCanvas, Feedback classes (#10270)
  • feat(wasm): Deprecate Wasm integration class (#10230)

Other Changes

  • feat: Make parameterize function available through browser and node API (#10085)
  • feat(feedback): Configure feedback border radius (#10289)
  • feat(sveltekit): Update default integration handling & deprecate addOrUpdateIntegration (#10263)
  • fix(replay-canvas): Add missing dependency on @sentry/utils (#10279)
  • fix(tracing): Don't send negative ttfb (#10286)

Work in this release contributed by @AleshaOleg. Thank you for your contribution!

Readme

Source

Sentry

Sentry JavaScript SDK Utilities

npm version npm dm npm dt

General

Common utilities used by the Sentry JavaScript SDKs.

Note: This package is only meant to be used internally, and as such is not part of our public API contract and does not follow semver.

FAQs

Last updated on 23 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc