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 middleware #17

Merged
merged 1 commit into from
Jun 29, 2023
Merged

🐛 fix middleware #17

merged 1 commit into from
Jun 29, 2023

Conversation

ponomarevkonst
Copy link
Contributor

Pull Request Description:

Issue
This pull request addresses the bug reported in issue #16. When the enabledMetrics.http configuration option is set to false, certain metrics (requestDuration, requestSize, responseSize) are still being collected, resulting in an error.

Changes Made
In the app/config/plugins.js file, I have made the following changes to fix the bug:

  • Introduced a new variable isHTTPMetricEnabled to store the value of config('enabledMetrics.http').
  • Added a conditional check if (!isHTTPMetricEnabled) return; to exit the middleware if HTTP metrics are disabled.
  • This ensures that the metrics collection code is bypassed when enabledMetrics.http is set to false, preventing the error from occurring.

Testing
I have tested the changes by following the steps mentioned in the issue description. After applying this fix, I confirmed that the error no longer occurs when accessing endpoints, and no metrics are collected when enabledMetrics.http is set to false.

This pull request resolves the bug and improves the behavior of the metrics collection feature when HTTP metrics are disabled.

@XanderD99 XanderD99 merged commit efdb496 into XanderD99:main Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants