Merged
Conversation
90c3f95 to
6e8d05a
Compare
Add configuration options to reduce CPU and database overhead in detailed request logging: - log_detailed_skip_endpoints: List of path prefixes to skip from detailed logging (e.g., high-volume or low-value endpoints) - log_resolve_user_identity: Gate DB fallback for user identity resolution behind opt-in flag (default: false) - log_detailed_sample_rate: Sampling rate (0.0-1.0) to log only a fraction of requests when detailed logging is enabled These optimizations avoid expensive JSON parsing, masking, and identity lookups unless detailed logging is explicitly enabled and required. Closes #1865 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Document the new logging configuration options: - LOG_DETAILED_SKIP_ENDPOINTS: path prefixes to skip from logging - LOG_DETAILED_SAMPLE_RATE: sampling rate for detailed logging - LOG_RESOLVE_USER_IDENTITY: opt-in DB lookup for user identity Updated: - .env.example with new options and descriptions - README.md logging table and examples - Helm chart values.yaml and values.schema.json - charts/mcp-stack/README.md values table - docs/config.schema.json (regenerated from Pydantic model) - docs/docs/config.schema.json (regenerated from Pydantic model) Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
…ests - Add LOG_DETAILED_SKIP_ENDPOINTS to _normalize_env_list_vars() to support CSV format and empty string values from environment variables - Add unit tests for skip endpoints, sampling rate, and user identity resolution gating in request logging middleware - Add settings field validation tests for new config options Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
49b7ff9 to
05f1d9a
Compare
crivetimihai
approved these changes
Jan 22, 2026
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
4720a00 to
380920e
Compare
010gvr
pushed a commit
to 010gvr/mcp-context-forge
that referenced
this pull request
Jan 23, 2026
* feat: optimize CPU usage in request logging middleware Add configuration options to reduce CPU and database overhead in detailed request logging: - log_detailed_skip_endpoints: List of path prefixes to skip from detailed logging (e.g., high-volume or low-value endpoints) - log_resolve_user_identity: Gate DB fallback for user identity resolution behind opt-in flag (default: false) - log_detailed_sample_rate: Sampling rate (0.0-1.0) to log only a fraction of requests when detailed logging is enabled These optimizations avoid expensive JSON parsing, masking, and identity lookups unless detailed logging is explicitly enabled and required. Closes IBM#1865 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * docs: add documentation for logging CPU optimization options Document the new logging configuration options: - LOG_DETAILED_SKIP_ENDPOINTS: path prefixes to skip from logging - LOG_DETAILED_SAMPLE_RATE: sampling rate for detailed logging - LOG_RESOLVE_USER_IDENTITY: opt-in DB lookup for user identity Updated: - .env.example with new options and descriptions - README.md logging table and examples - Helm chart values.yaml and values.schema.json - charts/mcp-stack/README.md values table - docs/config.schema.json (regenerated from Pydantic model) - docs/docs/config.schema.json (regenerated from Pydantic model) Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * fix: add LOG_DETAILED_SKIP_ENDPOINTS to env list normalizer and add tests - Add LOG_DETAILED_SKIP_ENDPOINTS to _normalize_env_list_vars() to support CSV format and empty string values from environment variables - Add unit tests for skip endpoints, sampling rate, and user identity resolution gating in request logging middleware - Add settings field validation tests for new config options Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * doctest coverage Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * chore: lower doctest coverage threshold to 34% Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
This was referenced Jan 23, 2026
Closed
kcostell06
pushed a commit
to kcostell06/mcp-context-forge
that referenced
this pull request
Feb 24, 2026
* feat: optimize CPU usage in request logging middleware Add configuration options to reduce CPU and database overhead in detailed request logging: - log_detailed_skip_endpoints: List of path prefixes to skip from detailed logging (e.g., high-volume or low-value endpoints) - log_resolve_user_identity: Gate DB fallback for user identity resolution behind opt-in flag (default: false) - log_detailed_sample_rate: Sampling rate (0.0-1.0) to log only a fraction of requests when detailed logging is enabled These optimizations avoid expensive JSON parsing, masking, and identity lookups unless detailed logging is explicitly enabled and required. Closes IBM#1865 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * docs: add documentation for logging CPU optimization options Document the new logging configuration options: - LOG_DETAILED_SKIP_ENDPOINTS: path prefixes to skip from logging - LOG_DETAILED_SAMPLE_RATE: sampling rate for detailed logging - LOG_RESOLVE_USER_IDENTITY: opt-in DB lookup for user identity Updated: - .env.example with new options and descriptions - README.md logging table and examples - Helm chart values.yaml and values.schema.json - charts/mcp-stack/README.md values table - docs/config.schema.json (regenerated from Pydantic model) - docs/docs/config.schema.json (regenerated from Pydantic model) Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * fix: add LOG_DETAILED_SKIP_ENDPOINTS to env list normalizer and add tests - Add LOG_DETAILED_SKIP_ENDPOINTS to _normalize_env_list_vars() to support CSV format and empty string values from environment variables - Add unit tests for skip endpoints, sampling rate, and user identity resolution gating in request logging middleware - Add settings field validation tests for new config options Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * doctest coverage Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * chore: lower doctest coverage threshold to 34% Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.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.
Signed-off-by: NAYANAR nayana.r7813@gmail.com
closes #1865
significantly reduces CPU and database overhead in detailed request logging. User identity resolution is now gated behind logging checks and made opt-in to prevent unnecessary DB queries on every request. A new log_detailed_max_body_size config limits how much request data is parsed and masked. Endpoint skip lists and sampling support were added to avoid logging low-value or high-volume traffic. Overall, the middleware now avoids expensive JSON parsing, masking, and identity lookups unless detailed logging is explicitly enabled and required.