fix(instrumentation-pino): log-sending was losing records when the level was reduced #2699
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this fix, if a Pino logger level was reduced (e.g. from 'info' to 'debug'),
then log.debug('msg') would not work. The same thing would happen if a child
logger was created at a lower-level than its parent.
This issue was that PinoInstrumentation is internally using a pino multistream
(https://getpino.io/#/docs/api?id=pino-multistream) and statically setting
the level of those streams to the current Logger level. If the logger level
was set lower, the multistream levels would end up filtering records
at that original higher level. The fix is to set the stream levels to
0 to never filter out records.
Closes: #2696