-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Benchmarking the logger #45
Comments
Hi, I've made some observations from my side. Most likely data sanitizers bring the greatest impact on performance. logger-decorator scans all incoming and outgoing data for sensitive patterns like /password/i. If you don't need this check or have an efficient algorithm of data sanitizing for your case, you can use custom paramsSanitizer and resultSanitizer. import { inspect } from 'util';
const decorator = new Decorator({
logger,
timestamp : true,
resultSanitizer : inspect,
paramsSanitizer : inspect
}); It should fix most performance problems with huge data processing. Unfortunately, if you need to analyze complex objects, performance losses are inevitable. However, your case of logging only errors is quite interesting for me, so I've created another issue #46 to cover it. Please notify here if custom sanitizers work for you, and subscribe linked issue if you're interested in the logging only errors feature. |
Thanks for your reply. Will watch out for it 🙂 |
# [1.5.0](v1.4.1...v1.5.0) (2021-09-23) ### Chore * adds a security policy ([ed86aba](ed86aba)) * adds bump strategy for devDependencies (non-major) ([03c9587](03c9587)) * adds gitleaks to circle pipeline ([114946e](114946e)) * adds performance tests for inspect sanitizers #45 ([255a46e](255a46e)), closes [#45](#45) * adds sponsorships ([35ed8e0](35ed8e0)) * combine mine packages in renovate updates ([54c97b8](54c97b8)) * create auto pr for major dependencies ([d2583a6](d2583a6)) * enhance own updates commit messages ([49a2365](49a2365)) * fixes audit [devDependencies] ([d08b1fc](d08b1fc)) * fixes renovate config ([982abaf](982abaf)) * Lock file maintenance ([eea1ac0](eea1ac0)) * Lock file maintenance ([ffe9a40](ffe9a40)) * Lock file maintenance ([b2432b7](b2432b7)) * Lock file maintenance ([47bfacf](47bfacf)) * Lock file maintenance ([19c2389](19c2389)) * Lock file maintenance ([2b00aec](2b00aec)) * Lock file maintenance ([dea06c9](dea06c9)) * Lock file maintenance ([e0043d8](e0043d8)) * Lock file maintenance ([66ba107](66ba107)) * Lock file maintenance ([5d305a8](5d305a8)) * not allow to fail on node 16 ([22ed683](22ed683)) * Update commitlint monorepo to v13 ([d008fd9](d008fd9)) * Update dependency eslint-plugin-regexp to v1 (#40) ([adec72a](adec72a)), closes [#40](#40) * Update dependency eslint-plugin-sonarjs to ^0.10.0 ([eb1417b](eb1417b)) * Update dependency eslint-plugin-unicorn to v35 ([415e4f4](415e4f4)) * Update devDependencies (non-major) ([51200bf](51200bf)) * Update devDependencies (non-major) ([33211c3](33211c3)) * Update devDependencies (non-major) (#48) ([b3f6184](b3f6184)), closes [#48](#48) * Update devDependencies (non-major) to v13 ([6894ad9](6894ad9)) ### New * adds errorsOnly option (closes #46) ([ea4b41a](ea4b41a)), closes [#46](#46)
Issue Description
Hi. I tried the decorator (Class Logger to be exact) but the thing we noticed was that our benchmarks deteriorated.
http_req_duration
went from 6ms to 35.15ms (a huge jump).We are interested in intercepting only errors. So, we have a custom logger like this:
Where we log only errors. No other custom code has been used and we just decorate the classes with
@log()
but this still leads to a huge impact on the benchmark. Any ideas on how we can solve this? Thanks 🙂Please follow the general troubleshooting steps first:
What do you expect to happen?
There is minimal impact to the benchmarks after adding the decorators.
What is actually happening?
Adding the decorator leads to a 29ms jump in the benchmarks.
Before
After
Environment:
The text was updated successfully, but these errors were encountered: