-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added apache bencmark and middleware for stress testing
- Loading branch information
1 parent
903650f
commit 04ae0ea
Showing
7 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import logging | ||
import time | ||
|
||
|
||
# ?metric_middleware | ||
def metric_middleware(get_response): | ||
def middleware(request): | ||
# Get beginning stats | ||
start_time = time.perf_counter() | ||
|
||
# Process the request | ||
response = get_response(request) | ||
|
||
# Get ending stats | ||
end_time = time.perf_counter() | ||
|
||
# Calculate stats | ||
total_time = end_time - start_time | ||
|
||
# Log the results | ||
logger = logging.getLogger("debug") | ||
logger.info(f"Total time: {(total_time):.2f}s") | ||
print(f"Total time: {(total_time):.2f}s") | ||
|
||
return response | ||
|
||
return middleware |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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