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 bug Global serializer not invoked for strings when base: null #597

Merged
merged 4 commits into from Mar 27, 2019

Conversation

yellowbrickc
Copy link
Contributor

No description provided.

Copy link
Member

@davidmarkclements davidmarkclements left a comment

Choose a reason for hiding this comment

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

thanks @yellowbrickc - can you show benchmarks for this vs master?

lib/tools.js Outdated Show resolved Hide resolved
lib/tools.js Outdated Show resolved Hide resolved
lib/tools.js Outdated Show resolved Hide resolved
test/basic.test.js Show resolved Hide resolved
David Mark Clements and others added 2 commits February 5, 2019 15:28
Co-Authored-By: yellowbrickc <yellowbrickc@users.noreply.github.com>
@mcollina
Copy link
Member

mcollina commented Feb 5, 2019

Can you run the benchmarks before and after and see if there is any difference?

@yellowbrickc
Copy link
Contributor Author

I run the both benchmarks a few times and the result was always different, even the measurements for bunyan and co. In the last run some numbers for pino are higher, some are lower.
I'm attaching the 2 text files here.
bench_master.txt
bench_issue_479.txt

@mcollina
Copy link
Member

mcollina commented Feb 6, 2019

Numbers should be stable, maybe you had something else running on your computer? Docker, Chrome, Slack could all be responsible :/.

@davidmarkclements
Copy link
Member

davidmarkclements commented Feb 6, 2019

.. ok I'm just thinking this through.. can you please verify this assumption:

we're making a change to the metadata API (by adding a msg property) to solve the global serializer not being invoked when base is null?

@yellowbrickc can you also add comparison benchmarks – as @mcollina says try making sure you have minimum background processes. Also, choose benchmarks that would hit this path and feel free to comment out the benchmarks for other loggers (which also might help with clearer numbers). Even with background processes disabled, they'll always vary slightly, but you're looking for within ~1-2%

@yellowbrickc
Copy link
Contributor Author

I run the file /internal/just-pino.bench.js twice per branch and the numbers are reliable now. They look good I think but it is your call of course
bench_issue.txt
bench_master.txt

@yellowbrickc
Copy link
Contributor Author

we're making a change to the metadata API (by adding a msg property) to solve the global serializer not being invoked when base is null?

The only change regarding the metadata (the tests prove this) is that this.lastObj gets the property msg. The global serializer is applied to this object (before it became the lastObject ) This way it is ensured that the same logic is applied to the msg as to all the other properties to be logged.

But you are right, the connection to base=null is not visible. I debugged now again and found the culprit: https://github.com/pinojs/pino/blob/master/pino.js#L88
The serializer is called in tools.js in the method asChindings https://github.com/pinojs/pino/blob/master/lib/tools.js#L148

I think there is no connection between the base = null and the missing call to the serializer, the reproduction through console.log has led to false conclusion. Fact is, the prop msg was logged differently from the rest and this is the bug.

@yellowbrickc
Copy link
Contributor Author

Hi @davidmarkclements @mcollina
what should we do with this PR, merge or throw away?
Maybe this bug is not really a bug because nobody seems missing a fix for it...

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM, this is ok for me. I've just been extremely busy :/

@davidmarkclements @jsumners can you please check?

@mcollina mcollina dismissed davidmarkclements’s stale review March 27, 2019 10:45

no activity, should be ok now.

@mcollina mcollina merged commit e386651 into pinojs:master Mar 27, 2019
@github-actions
Copy link

github-actions bot commented Feb 5, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants