Skip to content

Conversation

@72636c
Copy link
Contributor

@72636c 72636c commented Aug 14, 2025

Which problem is this PR solving?

We noticed that our user-defined mixin was breaking because it could not access the third logger argument. Excerpt from https://getpino.io/#/docs/api?id=mixin-function:

const logger = pino({
  mixin (obj, num, logger) {
    return {
      tags: logger.tags
    }
  }
})

[Update(by trentm): the 3rd arg to a mixin was added in [email protected].]

Short description of the changes

Try to propagate mixin args.

Unfortunately I couldn't get this running on my local; npm run compile just hangs on my machine. So this is just some quick guesswork, hopefully it's enough to understand the problem though!

 NX   The Nx Daemon is unsupported in WebAssembly environments. Some things may be slower than or not function as expected.

memory allocation of 70 bytes failed

We noticed that our user-defined `mixin` was breaking because it could
not access the third `logger` argument.

https://getpino.io/#/docs/api?id=mixin-function
@72636c 72636c requested a review from a team as a code owner August 14, 2025 04:00
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 14, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: 72636c / name: Ryan Ling (9008526)
  • ✅ login: trentm / name: Trent Mick (096407d)

return Object.assign(
otelMixin(ctx, level),
origMixin(ctx, level)
origMixin(ctx, level, ...rest)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@trentm
Copy link
Contributor

trentm commented Aug 15, 2025

The Nx Daemon is unsupported in WebAssembly environments.

Interesting. What is your environment? I'm just curious. Are you running some "in-browser dev environment"?

@codecov
Copy link

codecov bot commented Aug 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.83%. Comparing base (8a93515) to head (096407d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2983   +/-   ##
=======================================
  Coverage   89.83%   89.83%           
=======================================
  Files         188      188           
  Lines        9294     9295    +1     
  Branches     1907     1907           
=======================================
+ Hits         8349     8350    +1     
  Misses        945      945           
Files with missing lines Coverage Δ
...ckages/instrumentation-pino/src/instrumentation.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trentm
Copy link
Contributor

trentm commented Aug 15, 2025

Test failures. I'm guessing they are due to the test being dependent on a particular newer version of pino.

The feature where the logger is passed into the mixin as the 3rd arg came in pinojs/pino#1709 which was included in v8.14.0.

* d3a4560 - (tag: v8.14.0) Bumped v8.13.0 (2 years, 3 months ago) <Matteo Collina>
* b473f36 - docs: add 'best performance for basic stdout logging' to help.md (#1584) (2 years, 3 months ago) <Janek Lasocki-Biczysko>
* 962bc2b - feat: pass logger/child logger as param to mixin (#1709) (2 years, 3 months ago) <mary marchini>

and the current installed pino is [email protected]:

% npm ls pino
[email protected] /Users/trentm/tm/opentelemetry-js-contrib17
└─┬ @opentelemetry/[email protected] -> ./packages/instrumentation-pino
  └── [email protected]

Still, we'll need to write the test to work with older versions for the "test-all-versions" tests.

… to latest pino@8

Not updating to pino@9 because I think that drops support for some versions of Node.js
we support here and might require using scripts/skip-test-if.js which I don't want
to do yet.
Copy link
Contributor

@trentm trentm left a comment

Choose a reason for hiding this comment

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

This is great. Thanks for the fix.

@trentm trentm merged commit 3263936 into open-telemetry:main Aug 15, 2025
24 checks passed
@dyladan dyladan mentioned this pull request Aug 13, 2025
@72636c
Copy link
Contributor Author

72636c commented Aug 15, 2025

Thanks for getting the tests going @trentm! Turns out this was PEBKAC; I recently set up a new laptop and mistakenly had Node.js version defaulted to v24 in the absence of a .node-version or .nvmrc, which resulted in a borked npm ci. LTS works wonders 🙂

@72636c 72636c deleted the mixin-args branch August 15, 2025 22:54
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.

4 participants