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

New major version of notifier #47

Merged
merged 37 commits into from Oct 31, 2016
Merged

New major version of notifier #47

merged 37 commits into from Oct 31, 2016

Conversation

loopj
Copy link
Contributor

@loopj loopj commented Aug 25, 2016

ChangeLog

  • Uses Jackson for streaming JSON serialization
  • Uses Gradle as the build system
  • Logs internally using org.slf4j.Logger
  • Severity is now an enum instead of a String
  • Request information is automatically collected in Servlet API apps
  • JVM runtime, O/S, and locale diagnostics are collected
  • The Client object has been renamed to Bugsnag
  • The Event object has been renamed to Report
  • Report object is now exposed for ease of attaching diagnostics to error reports
  • Targets Java 1.6
  • Callbacks now support Java 8 lambda syntax, eg:
bugsnag.addCallback((report) -> {
    report.setSeverity(Severity.ERROR);
});
  • Chaining support added to Report methods
bugsnag.addCallback((report) -> {
    report.setSeverity(Severity.ERROR).setUserId("123");
});
  • Can now add a Callback to Bugsnag.notify calls
bugsnag.notify(ex, (report) -> {
    report.addToTab("tab", "key", "value");
});
  • Can now change the API key on a per-report basis using Callbacks
bugsnag.notify(ex, (report) -> {
    report.setApiKey("123456");
});
  • Error report delivery is now fully swappable via the Delivery interface
// Low-level use
Delivery delivery = new AsyncHttpDelivery();
delivery.setEndpoint(...);
bugsnag.setDelivery(delivery);

// Use synchronous delivery instead
Delivery delivery = new SyncHttpDelivery();
bugsnag.setDelivery(delivery);

// Shortcuts
bugsnag.setEndpoint(...);
bugsnag.setProxy(...);
bugsnag.setTimeout(...);

@loopj loopj changed the title [WIP] new major version of notifier [WIP] New major version of notifier Aug 25, 2016
@kattrali
Copy link
Contributor

1 commit

+1,739 −1,808 changed lines

… challenge accepted.

@kattrali
Copy link
Contributor

kattrali commented Sep 5, 2016

FYI a couple of *.class files were checked in

@kattrali
Copy link
Contributor

kattrali commented Sep 5, 2016

And build files within examples/build

}
// Don't notify if this error class should be ignored
if (config.shouldIgnoreClass(report.getExceptionName())) {
logger.debug("Error not reported to Bugsnag - exception class is in 'ignoreClasses'");
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should log the class name in this message, for clarity

Copy link
Contributor Author

@loopj loopj left a comment

Choose a reason for hiding this comment

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

Was this a style decision? Adding simple getter/setter functions increases the size of the jar, which admittedly is not a major concern, but not sure of the benefits.

@duncanhewett
Copy link
Contributor

@loopj It was just a best practice/style decision, but I've reverted that commit.

@duncanhewett
Copy link
Contributor

duncanhewett commented Oct 1, 2016

To get the build to work in all the JDKs I have:

  • Switched to Gradle 2.14 for JDK6 support
  • Removed the nebula.optional-base plugin and changed the servlet-api dependency to compileOnly which I think acheives the same effect
  • Changed the Travis build to use jdk_switcher to run different builds per JDK
  • Only build example apps on JDK8 (so they can use Lambda syntax)
  • Only run checkstyle on JDK8 (plugin doesn't support JDK6)
  • Use jackson-databind version 2.6.7 for JDK6 compability

Copy link
Contributor Author

@loopj loopj left a comment

Choose a reason for hiding this comment

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

Green tests 🎉

* @return the exceptions that make up the error.
*/
@Expose
public List<Exception> getExceptions() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This either needs to be protected or Exception needs to be public.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed, I don't think it needs to be public.

}

@Expose
public List<ThreadState> getThreads() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This either needs to be protected or ThreadState needs to be public.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed, I don't think it needs to be public.

* @param config the configuration for the report.
* @param throwable the error to create the report for.
*/
public Report(Configuration config, Throwable throwable) {
Copy link
Contributor

@foygl foygl Oct 14, 2016

Choose a reason for hiding this comment

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

If the expectation is that this always get built from Bugsnag.buildReport we should remove the public here to make this package protected. This will enforce the API usage which will make it easier to maintain and refactor in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed, I don't think it needs to be public.

* {@link Severity#WARNING} or {@link Severity#INFO}
* @return true unless the error report was ignored
*/
public boolean notify(Throwable throwable, Severity severity) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need a notify(Throwable, Severity, Callback) for completeness?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should add this yeah

Copy link
Contributor

Choose a reason for hiding this comment

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

Added.

JSONUtils.safePut(tab, entry.getKey(), entry.getValue());
}
} else {
addToTab("Custom Data", tabName, value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we officially dropping support for adding data without specifying a tab?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, it seems best to force choosing a tab name.

* @param endpoint the endpoint to send reports to
* @see #setDelivery
*/
public void setEndpoint(String endpoint) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We now need to declare the protocol explicitly i.e. can't use localhost have to use http://localhost. We should document this in the migration instructions.

@duncanhewett duncanhewett changed the title [WIP] New major version of notifier New major version of notifier Oct 31, 2016
@duncanhewett duncanhewett merged commit f135429 into master Oct 31, 2016
@duncanhewett duncanhewett deleted the next branch October 31, 2016 11:11
@loopj
Copy link
Contributor Author

loopj commented Oct 31, 2016

Omg

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

4 participants