-
Notifications
You must be signed in to change notification settings - Fork 2
sdk-core: reduce breadcrumbs size #228
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
Conversation
packages/sdk-core/src/modules/breadcrumbs/model/BreadcrumbLimits.ts
Outdated
Show resolved
Hide resolved
packages/sdk-core/src/modules/breadcrumbs/storage/InMemoryBreadcrumbsStorage.ts
Outdated
Show resolved
Hide resolved
packages/sdk-core/src/modules/breadcrumbs/storage/InMemoryBreadcrumbsStorage.ts
Outdated
Show resolved
Hide resolved
6c41841
to
5b03f4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please discuss:
- what are we doing with defaults and what is the desired flow for them? I think it would be better if we also take a look into other examples and desired behavior for our library,
- can we apply the breadcrumb size limit only once?
packages/sdk-core/src/modules/breadcrumbs/BreadcrumbsManager.ts
Outdated
Show resolved
Hide resolved
@@ -53,6 +60,33 @@ export class InMemoryBreadcrumbsStorage implements BreadcrumbsStorage, Backtrace | |||
|
|||
this._breadcrumbs.add(breadcrumb); | |||
|
|||
if (this._limits.maximumBreadcrumbsSize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're applying this rule twice. In the BreadcrumbsManager
L:194 and here. Maybe we should always expect the storage to check it. I think it might make more sense if we assume the breadcrumb that exceed the limit will be dropped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not applied twice, in BreadcrumbManager
maximumBreadcrumbSize
is checked, and here maximumBreadcrumbsSize
. I'll rename the latter to match BreadcrumbLimit.maximumTotalBreadcrumbsSize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
later you mean in another pull request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latter, not later.
} | ||
|
||
let limitedBreadcrumb: RawBreadcrumb | LimitedRawBreadcrumb; | ||
if (this._limits.maximumAttributesDepth !== undefined && rawBreadcrumb.attributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be better if we modify limitedBreadcurmb variable instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, it isn't initialized at this point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry my bad. I meant rawBreadcrumb instead of limitedBreadcrumb. WE don't need to use limitedBreadcrumb at all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, because _interceptor
above expects RawBreadcrumb
and not LimitedRawBreadcrumb
3431f57
to
84f390a
Compare
} | ||
|
||
let limitedBreadcrumb: RawBreadcrumb | LimitedRawBreadcrumb; | ||
if (this._limits.maximumAttributesDepth !== undefined && rawBreadcrumb.attributes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry my bad. I meant rawBreadcrumb instead of limitedBreadcrumb. WE don't need to use limitedBreadcrumb at all
… and level/type checks
84f390a
to
8d4594f
Compare
This PR adds limits for controlling breadcrumb file sizes:
maximumAttributesDepth
maximumBreadcrumbMessageLength
maximumBreadcrumbSize
maximumBreadcrumbsSize
It also allows to disable all breadcrumb limits by setting
false
to them.Platform-specific changes will be included in subsequent pull requests.