iilyak commented on code in PR #4483:
URL: https://github.com/apache/couchdb/pull/4483#discussion_r1143240353


##########
src/couch_log/src/couch_log_formatter.erl:
##########
@@ -365,9 +380,29 @@ format_args([H | T], FmtAcc, ArgsAcc) ->
     {Str, _} = couch_log_trunc_io:print(H, 100),
     format_args(T, ["~s" | FmtAcc], [Str | ArgsAcc]).
 
-maybe_truncate(Fmt, Args) ->
+maybe_truncate("", [], Meta, TruncateMeta) ->
+    MaxMsgSize = couch_log_config:get(max_message_size),
+    case format_meta(Meta) of
+        "" ->
+            "";
+        MetaStr when TruncateMeta and length(MetaStr) > MaxMsgSize ->
+            %% TODO: what to do when meta formatted data is too large?

Review Comment:
   If I understand the intend of the PR correctly the addition of `report` 
feature to logger serves a specific purpose. Which is to "report" a handful of 
integers along with the names of the keys.
   
   Given the fact that we 1) do not support complex terms 2) report counters 
only; I think the best strategy here would be to drop the report and log an 
error instead. Because if it  happen it is either:
   
   1. administrator set a `max_message_size` which is too small
   2. the developer passing too much data to report call.
   
   If we go with this route the general recommendation for developers would be 
to avoid using long names for counters.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to