Skip to content

Commit 2efd853

Browse files
committed
ref: User API to filter sentry requests in breadcrumbs
1 parent 673454d commit 2efd853

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/browser/src/integrations/breadcrumbs.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Dsn } from '@sentry/core';
1+
import { API, Dsn } from '@sentry/core';
22
import { getCurrentHub } from '@sentry/hub';
33
import { Integration, Severity } from '@sentry/types';
44
import { isFunction, isString } from '@sentry/utils/is';
@@ -354,8 +354,7 @@ export class Breadcrumbs implements Integration {
354354
* Can be disabled or individually configured via the `autoBreadcrumbs` config option
355355
*/
356356
public install(options: BrowserOptions = {}): void {
357-
// TODO: Use API provider instead of raw `new Dsn`
358-
const filterUrl = options.dsn && new Dsn(options.dsn).user;
357+
const filterUrl = options.dsn && new API(options.dsn).getStoreEndpoint();
359358

360359
if (this.config.console) {
361360
this.instrumentConsole();

packages/core/src/dsn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { DsnComponents, DsnLike, DsnProtocol } from '@sentry/types';
22
import { SentryError } from './error';
33

44
/** Regular expression used to parse a Dsn. */
5-
const Dsn_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/;
5+
const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w\.-]+)(?::(\d+))?\/(.+)/;
66

77
/** The Sentry Dsn, identifying a Sentry instance and project. */
88
export class Dsn implements DsnComponents {
@@ -52,7 +52,7 @@ export class Dsn implements DsnComponents {
5252

5353
/** Parses a string into this Dsn. */
5454
private fromString(str: string): void {
55-
const match = Dsn_REGEX.exec(str);
55+
const match = DSN_REGEX.exec(str);
5656
if (!match) {
5757
throw new SentryError('Invalid Dsn');
5858
}

0 commit comments

Comments
 (0)