Skip to content

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

Merged
merged 18 commits into from
Sep 26, 2024
Merged

Conversation

perf2711
Copy link
Contributor

@perf2711 perf2711 commented Mar 5, 2024

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.

@perf2711 perf2711 added the enhancement New feature or request label Mar 5, 2024
@perf2711 perf2711 self-assigned this Mar 5, 2024
Base automatically changed from dev to main March 28, 2024 09:58
@perf2711 perf2711 changed the base branch from main to dev April 8, 2024 15:28
Base automatically changed from dev to main June 10, 2024 15:18
@perf2711 perf2711 changed the base branch from main to dev June 10, 2024 15:20
@perf2711 perf2711 deleted the branch main June 17, 2024 14:47
@perf2711 perf2711 closed this Jun 17, 2024
@perf2711 perf2711 reopened this Jun 17, 2024
@perf2711 perf2711 changed the base branch from dev to main June 17, 2024 14:50
@perf2711 perf2711 force-pushed the feature/BT-718-reduce-breadcrumb-size branch from 6c41841 to 5b03f4d Compare June 25, 2024 11:41
Copy link
Collaborator

@konraddysput konraddysput left a 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?

@@ -53,6 +60,33 @@ export class InMemoryBreadcrumbsStorage implements BreadcrumbsStorage, Backtrace

this._breadcrumbs.add(breadcrumb);

if (this._limits.maximumBreadcrumbsSize) {
Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Collaborator

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?

Copy link
Contributor Author

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) {
Copy link
Collaborator

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?

Copy link
Contributor Author

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

Copy link
Collaborator

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

Copy link
Contributor Author

@perf2711 perf2711 Jul 11, 2024

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

@perf2711 perf2711 force-pushed the feature/BT-718-reduce-breadcrumb-size branch from 3431f57 to 84f390a Compare July 10, 2024 10:42
}

let limitedBreadcrumb: RawBreadcrumb | LimitedRawBreadcrumb;
if (this._limits.maximumAttributesDepth !== undefined && rawBreadcrumb.attributes) {
Copy link
Collaborator

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

@perf2711 perf2711 force-pushed the feature/BT-718-reduce-breadcrumb-size branch from 84f390a to 8d4594f Compare September 4, 2024 11:42
@perf2711 perf2711 changed the title BT-718 - Reduce breadcrumb size sdk-core: reduce breadcrumbs size Sep 11, 2024
@perf2711 perf2711 merged commit 8ec2804 into main Sep 26, 2024
5 checks passed
@perf2711 perf2711 deleted the feature/BT-718-reduce-breadcrumb-size branch September 26, 2024 14:58
This was referenced Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants