Skip to content
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

fix(instrumentation-pino): log-sending was losing records when the level was reduced #2699

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

trentm
Copy link
Contributor

@trentm trentm commented Feb 5, 2025

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

…vel was reduced

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: open-telemetry#2696
@trentm trentm self-assigned this Feb 5, 2025
@trentm trentm requested a review from a team as a code owner February 5, 2025 23:06
@github-actions github-actions bot requested a review from seemk February 5, 2025 23:06
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.96%. Comparing base (0057f15) to head (d5a577a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2699   +/-   ##
=======================================
  Coverage   90.96%   90.96%           
=======================================
  Files         171      171           
  Lines        8133     8133           
  Branches     1649     1649           
=======================================
  Hits         7398     7398           
  Misses        735      735           
Files with missing lines Coverage Δ
...emetry-instrumentation-pino/src/instrumentation.ts 100.00% <ø> (ø)

@trentm
Copy link
Contributor Author

trentm commented Feb 5, 2025

Cycle the instr-pino label to see if that triggers the TAV test run.

@trentm trentm enabled auto-merge (squash) February 7, 2025 18:50
@trentm trentm merged commit c9fdd1a into open-telemetry:main Feb 7, 2025
10 checks passed
@dyladan dyladan mentioned this pull request Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pino instrumentation hiding log lines when child logger configured at lower level than parent
3 participants