New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignoreErrors, ignoreUrls, includePaths, etc equivalent in @sentry/browser? #1631

Closed
reintroducing opened this Issue Oct 8, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@reintroducing

reintroducing commented Oct 8, 2018

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

4.0.6

Description

When upgrading to @sentry/browser from raven-js, I can't find the equivalent of setting these options. Is there one? What is the suggested way to do this now?

@kamilogorek

This comment has been minimized.

Show comment
Hide comment
@kamilogorek

kamilogorek Oct 8, 2018

Member

They are exactly the same, we just didn't document them just yet :) (whitelistUrls, blacklistUrls, ignoreErrors)

see:

export interface Options {
/**
* Enable debug functionality in the SDK itself
*/
debug?: boolean;
/**
* Specifies whether this SDK should activate and send events to Sentry.
* Disabling the SDK reduces all overhead from instrumentation, collecting
* breadcrumbs and capturing events. Defaults to true.
*/
enabled?: boolean;
/**
* The Dsn used to connect to Sentry and identify the project. If omitted, the
* SDK will not send any data to Sentry.
*/
dsn?: string;
/**
* If this is set to false, default integrations will not be added.
*/
defaultIntegrations?: boolean;
/**
* List of integrations that should be installed after SDK was initialized.
* Accepts either a list of integrations or a function that receives
* default integrations and returns a new, updated list.
*/
integrations?: Integration[] | ((integrations: Integration[]) => Integration[]);
/**
* A pattern for error messages which should not be sent to Sentry.
* By default, all errors will be sent.
*/
ignoreErrors?: Array<string | RegExp>;
/**
* Transport object that should be used to send events to Sentry
*/
transport?: TransportClass<Transport>;
/**
* Options for the default transport that the SDK uses.
*/
transportOptions?: TransportOptions;
/**
* The release identifier used when uploading respective source maps. Specify
* this value to allow Sentry to resolve the correct source maps when
* processing events.
*/
release?: string;
/** The current environment of your application (e.g. "production"). */
environment?: string;
/** Sets the distribution for all events */
dist?: string;
/** The maximum number of breadcrumbs sent with events. Defaults to 100. */
maxBreadcrumbs?: number;
/** Console logging verbosity for the SDK Client. */
logLevel?: LogLevel;
/** A global sample rate to apply to all events (0 - 1). */
sampleRate?: number;
/** Attaches stacktraces to pure capture message / log integrations */
attachStacktrace?: boolean;
/**
* A callback invoked during event submission, allowing to optionally modify
* the event before it is sent to Sentry.
*
* Note that you must return a valid event from this callback. If you do not
* wish to modify the event, simply return it at the end.
* Returning null will case the event to be dropped.
*
* @param event The error or message event generated by the SDK.
* @param hint May contain additional information about the original exception.
* @returns A new event that will be sent | null.
*/
beforeSend?(event: SentryEvent, hint?: SentryEventHint): SentryEvent | null | Promise<SentryEvent | null>;
/**
* A callback invoked when adding a breadcrumb, allowing to optionally modify
* it before adding it to future events.
*
* Note that you must return a valid breadcrumb from this callback. If you do
* not wish to modify the breadcrumb, simply return it at the end.
* Returning null will case the breadcrumb to be dropped.
*
* @param breadcrumb The breadcrumb as created by the SDK.
* @returns The breadcrumb that will be added | null.
*/
beforeBreadcrumb?(
breadcrumb: Breadcrumb,
hint?: SentryBreadcrumbHint,
): Breadcrumb | null | Promise<Breadcrumb | null>;
}
for common options +
export interface BrowserOptions extends Options {
/**
* A pattern for error URLs which should not be sent to Sentry.
* To whitelist certain errors instead, use {@link Options.whitelistUrls}.
* By default, all errors will be sent.
*/
blacklistUrls?: Array<string | RegExp>;
/**
* A pattern for error URLs which should exclusively be sent to Sentry.
* This is the opposite of {@link Options.blacklistUrls}.
* By default, all errors will be sent.
*/
whitelistUrls?: Array<string | RegExp>;
}
for browser-specific ones

Member

kamilogorek commented Oct 8, 2018

They are exactly the same, we just didn't document them just yet :) (whitelistUrls, blacklistUrls, ignoreErrors)

see:

export interface Options {
/**
* Enable debug functionality in the SDK itself
*/
debug?: boolean;
/**
* Specifies whether this SDK should activate and send events to Sentry.
* Disabling the SDK reduces all overhead from instrumentation, collecting
* breadcrumbs and capturing events. Defaults to true.
*/
enabled?: boolean;
/**
* The Dsn used to connect to Sentry and identify the project. If omitted, the
* SDK will not send any data to Sentry.
*/
dsn?: string;
/**
* If this is set to false, default integrations will not be added.
*/
defaultIntegrations?: boolean;
/**
* List of integrations that should be installed after SDK was initialized.
* Accepts either a list of integrations or a function that receives
* default integrations and returns a new, updated list.
*/
integrations?: Integration[] | ((integrations: Integration[]) => Integration[]);
/**
* A pattern for error messages which should not be sent to Sentry.
* By default, all errors will be sent.
*/
ignoreErrors?: Array<string | RegExp>;
/**
* Transport object that should be used to send events to Sentry
*/
transport?: TransportClass<Transport>;
/**
* Options for the default transport that the SDK uses.
*/
transportOptions?: TransportOptions;
/**
* The release identifier used when uploading respective source maps. Specify
* this value to allow Sentry to resolve the correct source maps when
* processing events.
*/
release?: string;
/** The current environment of your application (e.g. "production"). */
environment?: string;
/** Sets the distribution for all events */
dist?: string;
/** The maximum number of breadcrumbs sent with events. Defaults to 100. */
maxBreadcrumbs?: number;
/** Console logging verbosity for the SDK Client. */
logLevel?: LogLevel;
/** A global sample rate to apply to all events (0 - 1). */
sampleRate?: number;
/** Attaches stacktraces to pure capture message / log integrations */
attachStacktrace?: boolean;
/**
* A callback invoked during event submission, allowing to optionally modify
* the event before it is sent to Sentry.
*
* Note that you must return a valid event from this callback. If you do not
* wish to modify the event, simply return it at the end.
* Returning null will case the event to be dropped.
*
* @param event The error or message event generated by the SDK.
* @param hint May contain additional information about the original exception.
* @returns A new event that will be sent | null.
*/
beforeSend?(event: SentryEvent, hint?: SentryEventHint): SentryEvent | null | Promise<SentryEvent | null>;
/**
* A callback invoked when adding a breadcrumb, allowing to optionally modify
* it before adding it to future events.
*
* Note that you must return a valid breadcrumb from this callback. If you do
* not wish to modify the breadcrumb, simply return it at the end.
* Returning null will case the breadcrumb to be dropped.
*
* @param breadcrumb The breadcrumb as created by the SDK.
* @returns The breadcrumb that will be added | null.
*/
beforeBreadcrumb?(
breadcrumb: Breadcrumb,
hint?: SentryBreadcrumbHint,
): Breadcrumb | null | Promise<Breadcrumb | null>;
}
for common options +
export interface BrowserOptions extends Options {
/**
* A pattern for error URLs which should not be sent to Sentry.
* To whitelist certain errors instead, use {@link Options.whitelistUrls}.
* By default, all errors will be sent.
*/
blacklistUrls?: Array<string | RegExp>;
/**
* A pattern for error URLs which should exclusively be sent to Sentry.
* This is the opposite of {@link Options.blacklistUrls}.
* By default, all errors will be sent.
*/
whitelistUrls?: Array<string | RegExp>;
}
for browser-specific ones

@reintroducing

This comment has been minimized.

Show comment
Hide comment
@reintroducing

reintroducing Oct 8, 2018

Thanks @kamilogorek, but ignoreErrors (out of the 3 i mentioned at least) is the only one that seems to be there. Are the others not supported anymore?

reintroducing commented Oct 8, 2018

Thanks @kamilogorek, but ignoreErrors (out of the 3 i mentioned at least) is the only one that seems to be there. Are the others not supported anymore?

@kamilogorek

This comment has been minimized.

Show comment
Hide comment
@kamilogorek

kamilogorek Oct 8, 2018

Member

@reintroducing ignoreUrls === blacklistUrls and as for includePaths it's not available anymore, as we have eventProcessors for cases like this. See: https://docs.sentry.io/learn/filtering/?platform=javascript and https://docs.sentry.io/platforms/javascript/#eventprocessors

Member

kamilogorek commented Oct 8, 2018

@reintroducing ignoreUrls === blacklistUrls and as for includePaths it's not available anymore, as we have eventProcessors for cases like this. See: https://docs.sentry.io/learn/filtering/?platform=javascript and https://docs.sentry.io/platforms/javascript/#eventprocessors

@reintroducing

This comment has been minimized.

Show comment
Hide comment
@reintroducing

reintroducing Oct 8, 2018

@kamilogorek Thanks for the quick responses. Roger that on ignoreUrls, my apologies for not looking at the names better, I thought they'd map 1:1.

As for includePaths, this was our config:

includePaths: [
    /https?:\/\/d2yt77z1f5bzb8\.cloudfront\.net/i
]

How would that translate to the eventProcessors?

reintroducing commented Oct 8, 2018

@kamilogorek Thanks for the quick responses. Roger that on ignoreUrls, my apologies for not looking at the names better, I thought they'd map 1:1.

As for includePaths, this was our config:

includePaths: [
    /https?:\/\/d2yt77z1f5bzb8\.cloudfront\.net/i
]

How would that translate to the eventProcessors?

@kamilogorek

This comment has been minimized.

Show comment
Hide comment
@kamilogorek

kamilogorek Oct 9, 2018

Member

Right now it'd be kinda "more complex than I'd like it to be", but we already merged a "rewriteFrames" integration, which will make it very easy. It'll be released before Friday this week :)

Sentry.init({
  integrations: [new Sentry.Integrations.RewriteFrames({
    iteratee: function (frame) {
      // check for paths here and override frames, eg. (1:1 copied from raven-js)
      // https://github.com/getsentry/sentry-javascript/blob/50918f98b09662f5000bdcfb6341187b3e97f66f/packages/raven-js/src/raven.js#L1708-L1717
      return frame;
    }
  })]
})
Member

kamilogorek commented Oct 9, 2018

Right now it'd be kinda "more complex than I'd like it to be", but we already merged a "rewriteFrames" integration, which will make it very easy. It'll be released before Friday this week :)

Sentry.init({
  integrations: [new Sentry.Integrations.RewriteFrames({
    iteratee: function (frame) {
      // check for paths here and override frames, eg. (1:1 copied from raven-js)
      // https://github.com/getsentry/sentry-javascript/blob/50918f98b09662f5000bdcfb6341187b3e97f66f/packages/raven-js/src/raven.js#L1708-L1717
      return frame;
    }
  })]
})
@kamilogorek

This comment has been minimized.

Show comment
Hide comment
@kamilogorek

kamilogorek Oct 16, 2018

Member

rewriteFrames has been already released, so let me close this :)

Member

kamilogorek commented Oct 16, 2018

rewriteFrames has been already released, so let me close this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment