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.
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
feat: Allow configuring pino to log with different keys #1867
feat: Allow configuring pino to log with different keys #1867
Changes from 1 commit
8be98f4
8a5009a
d918f92
8a4bb4a
359d726
96e2986
41d6a3a
991545f
a0362f1
b179e33
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand this correct this causes that all tests below use the new keys, not just the new
injects span context to records with custom keys
test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. I was having trouble configuring just one test independently of the others with the current setup. I can spend a bit more time on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleaned them up so that the
logKeys
config only applies to a single test but the tests are interfering with each other causing the "disabled instrumentation" block of tests to fail. If I comment out all the otherdescribe
blocks then they pass. I'm stumped at the moment but will revisit this in the next couple daysThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the pino tests were written in a way to instrument just once and then run all tests.
Don't know if there was a reason. Theoretically
.disable()
should cause to de-instrument and therefore should allow side effect free tests.But there might be cases where de-instrument doesn't work, e.g. if pino caches some stuff internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely don't have a perfect understanding of this patching, but I tried creating a new instrumentation + explicitly calling
enable()
on it as well as clearing the require cache viadelete require.cache[require.resolve('pino')]
but it made no difference. Would love to hear alternatives to try as welllThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I broke the enabled + disabled tests out into their own modules to skirt the problem. Let me know what you think