Skip to content

Conversation

NickWemekamp
Copy link
Contributor

Pull request for issue: #78.

This pull requests adds mdc support for JUL which is useful for legacy applications that want to use APM.

Before merging please review the MdcSupplier interface. I implemented it similar to the ObjectMessageJacksonSerializer interface but I noticed that the ObjectMessageJacksonSerializer does not have unit tests for when there is no Jackson Objectmapper on the classpath. Currently this is similar to my implementation of MdcSupplierwhere the MdcSupplier.Unavailable, which is used if slf4j is not on the classpath, is not tested with unit tests. I am not really sure how to proceed with this issue.

@ghost
Copy link

ghost commented Jul 2, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Started by user Felix Barnsteiner, Replayed #6]

  • Start Time: 2020-07-02T17:40:13.997+0000

  • Duration: 10 min 44 sec

Test stats 🧪

Test Results
Failed 0
Passed 104
Skipped 4
Total 108

Copy link
Member

@felixbarny felixbarny left a comment

Choose a reason for hiding this comment

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

Just a minor detail, otherwise looks good to me, thanks 🎉

if (copyOfContextMap != null ) {
return copyOfContextMap;
}
return new HashMap<String, String>();
Copy link
Member

Choose a reason for hiding this comment

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

return Collections.emptyMap()


@Override
public Map<String, String> getMDC() {
return new HashMap<String, String>();
Copy link
Member

Choose a reason for hiding this comment

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

return Collections.emptyMap()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I somehow assumed that this was not possible as I first had return Objects.requireNonNullElse(copyOfContextMap, Collections.emptyMap()); but maven wouldn't compile that.

On a side note, is it intended that maven compiles to java 6 (legacy support or something else)? My idea hints me towards code style improvements that don't compile. e.g. multi catch blocks like this: catch (Exception | LinkageError e) { return Unavailable.INSTANCE; }

@felixbarny felixbarny merged commit a76505b into elastic:master Jul 3, 2020
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.

2 participants