Add /stats endpoint#1
Open
druids-app[bot] wants to merge 1 commit into
Open
Conversation
Add a /stats HTTP endpoint that returns: - total: total number of log entries - by_level: breakdown by log level (INFO/WARN/ERROR) Log levels are derived from HTTP status codes: - INFO: 2xx, 3xx - WARN: 4xx - ERROR: 5xx The server reads logs from the LOG_DIR environment variable (defaults to "logs/"). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
|
||
| if __name__ == "__main__": | ||
| port = int(os.environ.get("PORT", 5000)) | ||
| app.run(host="0.0.0.0", port=port, debug=True) |
Author
Audit Results ✓Verdict: APPROVED Spec Requirements
Code ReviewThe implementation is clean and correct:
Verification QualityThe builder provided genuine end-to-end verification:
What I Verified
No lazy patterns detected. This is a complete, honest verification that proves the implementation works. |
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
Adds a
/statsHTTP endpoint that returns log statistics:total: Total number of log entriesby_level: Breakdown by log level (INFO/WARN/ERROR)Implementation
server.pyLOG_DIRenvironment variable (defaults tologs/)Testing
Verified with 1000 test log entries:
{ "total": 1000, "by_level": { "INFO": 891, "WARN": 71, "ERROR": 38 } }Also tested with empty log directory (returns zeros).