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

2.x Redesign #437

Merged
merged 13 commits into from
Feb 24, 2019
Merged

2.x Redesign #437

merged 13 commits into from
Feb 24, 2019

Conversation

whiskeysierra
Copy link
Collaborator

@whiskeysierra whiskeysierra commented Feb 22, 2019

Description

Motivation and Context

Fixes #211
Fixes #295
Fixes #296
Fixes #315
Fixes #334

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@whiskeysierra whiskeysierra changed the title Feature/2.x redesign 2.x Redesign Feb 22, 2019
@whiskeysierra
Copy link
Collaborator Author

Docs need to be updated.

@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@zalando zalando deleted a comment Feb 23, 2019
@whiskeysierra whiskeysierra marked this pull request as ready for review February 24, 2019 08:46
Copy link
Member

@lukasniemeier-zalando lukasniemeier-zalando left a comment

Choose a reason for hiding this comment

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

I see a few TODOs on "body replacement/without-body" - are they required for this PR? Or long-term?

Some of those restrictions could be mitigated with custom [`HttpLogWriter`](#writing)
implementations, but they were never ideal.

Starting with version 2.0 Logbook now comes with a [Strategy pattern](https://en.wikipedia.org/wiki/Strategy_pattern)

Choose a reason for hiding this comment

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

We may want to move the paragraphs above to the release notes of 2.0 or it's time to even provide a migration guide 😉

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This one in itself doesn't really require a migration, since it's just a new feature. But it's definitely worth having proper release notes for 2.0.


@Override
public void write(final Precorrelation precorrelation, final HttpRequest request) {
sinks.forEach(throwingConsumer(sink -> sink.write(precorrelation, request)));

Choose a reason for hiding this comment

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

Should these be sinks.filter(Sink::isActive).forEach?

Copy link
Collaborator Author

@whiskeysierra whiskeysierra Feb 24, 2019

Choose a reason for hiding this comment

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

Yes... 🤦‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

import static org.apiguardian.api.API.Status.STABLE;

@API(status = STABLE)
public interface Strategy {

Choose a reason for hiding this comment

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

TODO documentation? Just saying as the README teases this 😉

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🤦‍♂️

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed


- [`BodyOnlyIfErrorStrategy`](logbook-core/src/test/java/org/zalando/logbook/BodyOnlyIfErrorStrategy.java)
- [`ErrorResponseOnlyStrategy`](logbook-core/src/test/java/org/zalando/logbook/ErrorResponseOnlyStrategy.java)
- [`WithoutBodyStrategy`](logbook-core/src/test/java/org/zalando/logbook/WithoutBodyStrategy.java)

Choose a reason for hiding this comment

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

What do you think of shipping such example strategies? We know that there is a demand for such behavior and we can easily foresee that users may want to apply this to multiple services.

  • BodyOnlyIfStatusAtLeastStrategy(int)
  • StatusAtLeastStrategy(int)
  • WithoutBodyStrategy

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, probably worth it. I was hoping that the interface is so easy to use that users can just implement it within 2-5 lines.

Choose a reason for hiding this comment

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

Agreed on the easy-to-be-used, but still gets tedious to put these 5 lines in my 25 micro-services 😉

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I created #440 as a follow-up.

@whiskeysierra
Copy link
Collaborator Author

I see a few TODOs on "body replacement/without-body" - are they required for this PR? Or long-term?

I don't have an opinion how we should behave there.

@zalando zalando deleted a comment Feb 24, 2019
@lukasniemeier-zalando
Copy link
Member

👍

@whiskeysierra whiskeysierra merged commit eb15e9a into master Feb 24, 2019
@whiskeysierra whiskeysierra deleted the feature/2.x-redesign branch February 24, 2019 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants