feat: drop stack trace collection from loggers#2065
Merged
crivetimihai merged 1 commit intomainfrom Jan 14, 2026
Merged
Conversation
This was referenced Jan 13, 2026
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
573684d to
499e9a0
Compare
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Remove
exc_info=Truefrom error logging in plugin framework hot path to eliminate critical performance bottleneck.Closes: #2064
Problem
Performance profiling revealed the plugin framework was spending ~80% of execution time formatting exception tracebacks that were never displayed or thrown. For a typical plugin hook invocation:
The root cause was
exc_info=Trueinlogger.error()calls within exception handlers inmcpgateway/plugins/framework/manager.py:284,288, which forced Python to capture and format full stack traces on every errorpath, even when:
Changes
Removed
exc_info=Trueparameter from two logger.error() calls inPluginExecutor._execute_hook():PluginErrorhandlerExceptionhandlerException details are still captured via
str(pe)andstr(e)in the log message.Impact
Overall Performance Improvement: 84.9% FASTER
Total execution time reduced from 16.19s to 2.44s across all plugin tests.
Detailed Results
Performance evaluation using cProfile, following the guideline in
tests/performance.Key Highlights
Best improvements (>94% faster):
Typical improvements: 80-85% reduction in execution time
Minimum improvement: 64.5% (PIIFilterPlugin_prompt_pre_fetch)