-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Requirements
- Implement a logging hook as described in appendix A of the OpenFeaure spec: https://github.com/open-feature/spec/blob/main/specification/appendix-a-included-utilities.md#logging-hook
- Remove all logging from evaluation lifecycle (hot path)
Java implementation: open-feature/java-sdk#1084
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Rahilsiddique commentedon Sep 24, 2024
So what I understand is that we have to create a hook that will be used to log the messages during flag life-cycle
i.e before, after, error and finally
Hey I would like to give it a try 🤚
Thanks !
toddbaert commentedon Oct 18, 2024
Yep - and also remove any non-debug logging in hot code-paths.
beeme1mr commentedon Nov 21, 2024
Hi @Rahilsiddique, is this something you're still interested in working on?
kevinmlong commentedon Dec 3, 2024
@beeme1mr / @toddbaert - I'm happy to take this issue on as my first issue. I can target a few weeks to have a PR opened for folks to take a look at.
beeme1mr commentedon Dec 3, 2024
Thanks @kevinmlong!
kevinmlong commentedon Dec 12, 2024
@beeme1mr / @toddbaert - trying to understand a few things when working on this issue.
It appears that
DefaultLogger
doesn't actually log anything wheninfo
ordebug
are called. Looking at the linked implementation from the Java SDK, it use debug forbefore
andafter
. Pretty easy to fill out the implementation, but then this causes the a few tests to fail. What's the reasoning here for whyconsole.info
andconsole.debug
shouldn't be used for the respective implementations inDefaultLogger
?kevinmlong commentedon Dec 12, 2024
Looking at the spec (https://github.com/open-feature/spec/blob/main/specification/appendix-a-included-utilities.md#logging-hook) seems we should be using
debug
andinfo
for these stages as well, so perhaps we should have theDefaultLogger
implement these.beeme1mr commentedon Dec 12, 2024
console.debug
is an alias forconsole.log
in node.js. That's why we decided to no-op debug by default. In this case, debug feels like the correct log level but it would definitely be annoying to see nothing if you're using the default logger. @toddbaert @lukas-reining, would either of you have a suggestion?kevinmlong commentedon Dec 12, 2024
Understood on the alias for
debug
, but seems that if we're providing thedebug
method it should probably do something. For now, I implemented aVerboseLogger
that implements all log levels and this is what theLoggerHook
uses when instantiating an instance ofSafeLogger
.lukas-reining commentedon Dec 13, 2024
I think so too @kevinmlong. When using the logging hook, i think it is safe to assume that everything that was given to debug should also be seen.
So I think this is a good way forward.
But I think it would make sense to not go for a
VerboseLogger
but rather add a defined environment variable and/or configuration in the constructor to set the log level.I think we should go for both, but especially the env variable would be important to have when a deployed service has issues and you want to turn on the logging without rebuilding.
cc @toddbaert @beeme1mr
toddbaert commentedon Dec 17, 2024
💯
We could do this, and maybe make the level info by default. With the other changes in this PR (not logging at all during hot paths) that might be OK.
kevinmlong commentedon Dec 19, 2024
@beeme1mr / @toddbaert - I started a draft PR (#1114) for the LoggingHook implementation. I could use some guidance on the "hot path" and what that means.
beeme1mr commentedon Dec 19, 2024
Hey @kevinmlong, a "hot path" is the code executed during a feature flag evaluation. Examples of non-hot paths would be registering a provider or hook. Basically, we're trying not to spam logs for actions that could happen at high frequency.