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

Can't create a Breadcrumb with a custom date #1012

Closed
ctweney opened this issue Oct 26, 2020 · 3 comments
Closed

Can't create a Breadcrumb with a custom date #1012

ctweney opened this issue Oct 26, 2020 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ctweney
Copy link
Contributor

ctweney commented Oct 26, 2020

Because io.sentry.Breadcrumb was written as a final class with a well-defended constructor, one can only instantiate a Breadcrumb with a date equal to DateUtils.getCurrentDateTimeOrNull(). This is a crippling limitation. Please provide a public constructor that allows setting a different date.

I'm using io.sentry:sentry-android:3.1.0.

@marandaneto marandaneto added the enhancement New feature or request label Oct 26, 2020
@marandaneto
Copy link
Contributor

@ctweney mind sharing the use-case to create a breadcrumb with a custom breadcrumb?

@ctweney
Copy link
Contributor Author

ctweney commented Oct 26, 2020

Sure -- I want the breadcrumbs to persist from one run of the app to the next. Yet, I don't want to send breadcrumbs to the Sentry servers until an actual error is logged or the user pushes a certain button. So I persist breadcrumbs with the date/time they actually occurred into my app's SQLite db. If an error needs to be pushed to Sentry servers I get those breadcrumbs out of SQLite and push them.

@marandaneto
Copy link
Contributor

I see @ctweney, good point.

We can make this ctor public then

Breadcrumb(final @Nullable Date timestamp) {
this.timestamp = timestamp;
}

Would you like to open a PR? :)

@marandaneto marandaneto added the help wanted Extra attention is needed label Oct 27, 2020
ctweney pushed a commit to ctweney/sentry-java that referenced this issue Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants