-
Notifications
You must be signed in to change notification settings - Fork 31
feat: Add support for breadcrumb filtering. #733
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
Changes from 1 commit
ae68e23
74d4fe7
3e3993b
02ec60d
c5a9130
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,7 +77,8 @@ export default function decorateFetch(callback: (breadcrumb: HttpBreadcrumb) => | |
| return response; | ||
| }); | ||
| } | ||
| wrapper.prototype = originalFetch.prototype; | ||
|
|
||
| wrapper.prototype = originalFetch?.prototype; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small robustness improvement exposed by running tests in VSCode. |
||
|
|
||
| try { | ||
| // Use defineProperty to prevent this value from being enumerable. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| import { Collector } from './api/Collector'; | ||
| import { HttpBreadCrumbOptions, Options, StackOptions, UrlFilter } from './api/Options'; | ||
| import { | ||
| BreadcrumbFilter, | ||
| HttpBreadcrumbOptions, | ||
| Options, | ||
| StackOptions, | ||
| UrlFilter, | ||
| } from './api/Options'; | ||
| import { MinLogger } from './MinLogger'; | ||
|
|
||
| export function defaultOptions(): ParsedOptions { | ||
|
|
@@ -14,6 +20,7 @@ export function defaultOptions(): ParsedOptions { | |
| instrumentFetch: true, | ||
| instrumentXhr: true, | ||
| }, | ||
| breadcrumbFilters: [], | ||
| }, | ||
| stack: { | ||
| source: { | ||
|
|
@@ -55,7 +62,7 @@ function itemOrDefault<T>(item: T | undefined, defaultValue: T, checker?: (item: | |
| } | ||
|
|
||
| function parseHttp( | ||
| options: HttpBreadCrumbOptions | false | undefined, | ||
| options: HttpBreadcrumbOptions | false | undefined, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consistent capitalization change. |
||
| defaults: ParsedHttpOptions, | ||
| logger?: MinLogger, | ||
| ): ParsedHttpOptions { | ||
|
|
@@ -163,6 +170,11 @@ export default function parse(options: Options, logger?: MinLogger): ParsedOptio | |
| checkBasic('boolean', 'breadcrumbs.keyboardInput', logger), | ||
| ), | ||
| http: parseHttp(options.breadcrumbs?.http, defaults.breadcrumbs.http, logger), | ||
| breadcrumbFilters: itemOrDefault( | ||
| options.breadcrumbs?.breadcrumbFilters, | ||
| defaults.breadcrumbs.breadcrumbFilters, | ||
| checkBasic('array', 'breadcrumbs.breadcrumbFilters', logger), | ||
|
||
| ), | ||
| }, | ||
| stack: parseStack(options.stack, defaults.stack), | ||
| maxPendingEvents: itemOrDefault( | ||
|
|
@@ -271,6 +283,11 @@ export interface ParsedOptions { | |
| * Settings for http instrumentation and breadcrumbs. | ||
| */ | ||
| http: ParsedHttpOptions; | ||
|
|
||
| /** | ||
| * Custom breadcrumb filters. | ||
| */ | ||
| breadcrumbFilters: BreadcrumbFilter[]; | ||
| }; | ||
|
|
||
| /** | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.