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

Enhance PerformanceBehaviour with request count and detailed docs #509

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

Bram1903
Copy link
Collaborator

@Bram1903 Bram1903 commented Sep 3, 2023

PerformanceBehaviour of the MediatR pipeline has been improved to introduce a request counter to track the number of requests application-wide.

This counter increments thread-safely and initiates performance timing only after the first 3 requests to avoid skewing data due to just-in-time compilation or other startup overheads. Also introduced detailed class and method commenting to enhance code understandability.

Changed The ILogger Paramater

  • [Logger Type Parameter Update] Updated the logger in PerformanceBehaviour to be more specific:
    • Before: private readonly ILogger<TRequest> _logger;
    • After: private readonly ILogger<PerformanceBehaviour<TRequest, TResponse>> _logger;
    • This change allows for more context-aware logging within the PerformanceBehaviour class.

PerformanceBehaviour of MediatR pipeline has been improved to introduce a request counter in order to keep track of the number of requests application-wide.

This counter increments in a thread-safe manner and initiates performance timing only after first 3 requests to avoid skewing of data due to just in time compilation or other startup overheads. Also introduced detailed class and method commenting to enhance code understandability.
@Bram1903 Bram1903 added Enhancement New feature or request Refactoring Improvement to the existing code base labels Sep 3, 2023
@Bram1903 Bram1903 requested a review from neozhu September 3, 2023 12:49
@Bram1903 Bram1903 self-assigned this Sep 3, 2023
@Bram1903 Bram1903 linked an issue Sep 3, 2023 that may be closed by this pull request
Copy link
Owner

@neozhu neozhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@neozhu neozhu merged commit 14a5c20 into main Sep 3, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Refactoring Improvement to the existing code base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initial Slow Database Query on Non-Identity Pages Warnings
2 participants