-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add structured logging reports via new Erlang 21 logger #3526
Conversation
The new logger only works in Erlang 21+, so we can start simplifying the codebase by removing the macro that provides support for retrieving stack traces the old way.
@@ -191,7 +191,7 @@ ErlOpts = case os:getenv("ERL_OPTS") of | |||
end. | |||
|
|||
AddConfig = [ | |||
{require_otp_vsn, "20|21|22|23"}, | |||
{require_otp_vsn, "21|22|23"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't review the rest but wanted to explicitly say "+1 for dropping 20.x on main, -1 for dropping 20.x on 3.x."
That means this wouldn't easily be backported to 3.x, until such time as we can confirm >20.x on 3.x code is stable at scale.
what => invalid_transaction_option_value, | ||
option => Option, | ||
value => Val, | ||
details => "string transaction option must be less than 16 bytes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be less than
or less than or equal
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case
statement checks for < 16
so that's what I put into the log message. I know the previous log message said differently. I didn't check if a 16 byte was actually allowed by erlfdb
or not; if it is, we should update the test in the case
statement as well as the log message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I think the check is wrong. I remember going by the other client's API docs (Python I think) https://apple.github.io/foundationdb/api-python.html#database-options and it said up to 16 hexadecimal digits
. But we can fix it in a separate PR.
Out of curiosity, had actually disabled the check locally and set to a much higher value and nothing seems to have happened but it's better to just go by the documentation and stick to =< 16.
fdbserver --help
also indicates the same:
/usr/sbin/fdbserver --help | grep -A2 machine_id
-i ID, --machine_id ID
Machine and zone identifier key (up to 16 hex characters).
Defaults to a random value shared by all fdbserver processes
Instead add it explicitly in each module.
Also, switch to request_id to disambiguate a bit.
This will require new base images to be uploaded to Docker Hub before the PR is merged.
ESL packages are not (yet?) available for 21.3.8.{18-22}
This reverts commit 0a6200d.
All set from my perspective now. This is only adding the logging invocations; all the work of defining and configuring the handlers, formatters, and filters will come in a separate PR. |
couch_log:info("Apache CouchDB ~s is starting.~n", [ | ||
couch_server:get_version() | ||
]). | ||
|
||
|
||
notify_started() -> | ||
?LOG_INFO(#{ | ||
what => starting_couchdb_complete, | ||
time_to_relax => true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Nice work!
Overview
This PR adds log statements as structured reports (i.e. Erlang maps) using the macros defined by Erlang itself as part of the new approach to logging implemented in Erlang 21. It does not introduce any handler configuration to actually process these reports; that will come in a subsequent PR.
Testing recommendations
You should observe any change in logging behavior.
Related Issues or Pull Requests
Initial discussion about structured logging dates to at least #1373
Checklist
rel/overlay/etc/default.ini