Skip to content

Conversation

@onelapahead
Copy link
Contributor

@onelapahead onelapahead commented Nov 30, 2025

This is a slightly philosophical PR - but working on codebases using ff-common, I've found I'm often failing to find the log message I need, and often fighting to filter out all the noise of the logs I rarely need in production (but do find helpful in development). Adapted from #200 originally.

In short - I think we log too much at the debug level, especially in these libraries which should mostly log trace, and not enough at the info level. I worry we depend too much on debug to "see everything", and we can't guarantee users will actually have debug on when they hit a new problem. We need to make sure info has "enough" (which is very hard to known) to debug know issues / bugs / edge cases, and compensate additionally with metrics and tracing. For unknown issues / networking / database-related issues - thats where trace can be enabled temporarily to help triage.

Between human SREs, log aggregation systems, and agentic AI - there is a cost to every byte of waste in terms of storage, processing, and context. A "less is more" mindset is necessary. Especially as we consider adopting more modern, performant logging frameworks like https://github.com/uber-go/zap which encourage structured logging and sampling.

All that said - this PR proposes two significant changes:

  1. It decreases a lot of internal logs for ffapi, ffresty, fftls, and dbsql to trace to avoid logging 10-100s of lines per API request (especially when TLS and databases are in play)
  2. Allows for dynamically configuring the log level of a process using a new PUT API on the monitoring server:
    curl -X PUT http://localhost:6000/logging?level=<info|trace|debug|...>
    This then means a user can change the log level in a process to see more details if needed, especially if they need to see the now trace logs referred to above, or go from info to debug in a less expensive way, w/o continually over logging.

Additionally, exposes the prometheus.Gather within the metrics managers' Prometheus registry to allow for custom metrics exporting and filtering.

@onelapahead onelapahead requested a review from a team as a code owner November 30, 2025 23:55
Signed-off-by: hfuss <[email protected]>
Copy link
Contributor

@EnriqueL8 EnriqueL8 left a comment

Choose a reason for hiding this comment

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

Thanks @onelapahead - I agree with moving those logs to Trace, I've felt the same level of pain debugging logs and being polluted by that.

I have a few questions on the way the log level is set and some confusions there

onelapahead and others added 2 commits December 1, 2025 08:11
Co-authored-by: Peter Broadhurst <[email protected]>
Signed-off-by: hayden <[email protected]>
Signed-off-by: hfuss <[email protected]>
// Wrap the request itself in a log wrapper, that gives minimal request/response and timing info
l := log.L(ctx)
l.Infof("--> %s %s", req.Method, req.URL.Path)
l.Logf(hs.apiEntryLoggingLevel, "--> %s %s", req.Method, req.URL.Path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Was thinking you'd grab the local/remote fields back out the context to log here.

Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

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

Thanks for working through this. Important stuff 👍

Copy link
Contributor

@EnriqueL8 EnriqueL8 left a comment

Choose a reason for hiding this comment

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

Looks great - thanks @onelapahead for working through all the comments 🙇🏼

@EnriqueL8 EnriqueL8 merged commit 9fae2a7 into hyperledger:main Dec 1, 2025
5 of 6 checks passed
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.

3 participants