Skip to content
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

Hubs/Scopes Merge 28 - Fix breadcrumb ordering #3355

Merged
merged 34 commits into from
Apr 23, 2024

Conversation

adinauer
Copy link
Member

@adinauer adinauer commented Apr 15, 2024

#skip-changelog

📜 Description

Use System.nanoTime() to have a more detailed timestamp for ordering breadcrumbs.
The actual value shouldn't matter too much as breadcrumbs should be created / deserialized in order and nanos are only used if timestamp is the same.

💡 Motivation and Context

To have better ordering of breadcrumbs and avoid random order when timestamp is equal. This also caused flaky tests.

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

adinauer and others added 30 commits March 27, 2024 16:30
Copy link
Contributor

github-actions bot commented Apr 15, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against fb074c8

@adinauer adinauer mentioned this pull request Apr 16, 2024
7 tasks
@markushi markushi changed the title Hubs/Scpes Merge 28 - Fix breadcrumb ordering Hubs/Scopes Merge 28 - Fix breadcrumb ordering Apr 19, 2024
Base automatically changed from feat/hsm-27-discussions to 8.x.x April 22, 2024 14:24
@@ -663,8 +667,11 @@ public void setUnknown(@Nullable Map<String, Object> unknown) {
@Override
@SuppressWarnings("JavaUtilDate")
public int compareTo(@NotNull Breadcrumb o) {
// TODO also use nano time if equal
return timestamp.compareTo(o.timestamp);
int timestampCompare = timestamp.compareTo(o.timestamp);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to have consistent ordering, should we always use nanos?
We would also have to change the constructor to take a nano time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense, e.g. for OTEL where we likely have to create breadcrumbs after the fact. Will change it to only use nanos in a follow up PR.

@adinauer adinauer merged commit 2d01626 into 8.x.x Apr 23, 2024
9 of 20 checks passed
@adinauer adinauer deleted the feat/hsm-28-breadcrumb-ordering branch April 23, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants