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

feat: Add support for custom COAP requests logging #99

Merged
merged 5 commits into from
Sep 4, 2024

Conversation

akolosov-n
Copy link
Collaborator

@akolosov-n akolosov-n commented Sep 3, 2024

Introduce a decorator for CoapTransport which logs all inbound and outbound CoAP packets.

The change makes also possible to enable/disable transport logging on CoapServer creation.

Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 61.70213% with 18 lines in your changes missing coverage. Please review.

Project coverage is 93.01%. Comparing base (7fd3715) to head (592e189).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
.../com/mbed/coap/transport/LoggingCoapTransport.java 69.69% 8 Missing and 2 partials ⚠️
...n/java/com/mbed/coap/server/CoapServerBuilder.java 50.00% 4 Missing and 1 partial ⚠️
.../com/mbed/coap/server/CoapServerBuilderForTcp.java 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #99      +/-   ##
============================================
- Coverage     93.18%   93.01%   -0.17%     
- Complexity     2028     2033       +5     
============================================
  Files           134      134              
  Lines          4577     4598      +21     
  Branches        618      617       -1     
============================================
+ Hits           4265     4277      +12     
- Misses          171      177       +6     
- Partials        141      144       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akolosov-n akolosov-n marked this pull request as ready for review September 3, 2024 12:41
@akolosov-n akolosov-n changed the title Add support for custom COAP requests logging feat: Add support for custom COAP requests logging Sep 4, 2024
@akolosov-n akolosov-n force-pushed the alko/use-mdc-for-logging branch 2 times, most recently from e9e33da to 440831f Compare September 4, 2024 07:30
@akolosov-n akolosov-n requested review from szysas and removed request for szysas September 4, 2024 11:05
@@ -80,9 +67,11 @@ public final class CoapServerBuilder {
private int maxQueueSize = 100;
private Filter.SimpleFilter<CoapRequest, CoapResponse> outboundFilter = Filter.identity();
private Filter.SimpleFilter<CoapRequest, CoapResponse> routeFilter = Filter.identity();
private Filter.SimpleFilter<CoapRequest, CoapResponse> requestFilter = Filter.identity();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we name it somehow different, 'request' might be misleading depends on client or server. How about inboundFilter or inboundPreFilter as it happens quite early in a filter pipeline.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Isn't it enough to call it inboundRequestFilter like it is now or e.g. serverRequestFilter? There is CoapRequestConverter in the beginning of the inboundService filter chain which always makes CoapRequests out of the incoming packets meaning that only requests can come into this filter. Calling it just inboundPreFilter makes a feeling that it accepts raw coap packets.

@akolosov-n akolosov-n merged commit cec0ecd into master Sep 4, 2024
5 of 6 checks passed
@akolosov-n akolosov-n deleted the alko/use-mdc-for-logging branch September 4, 2024 12:09
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