Skip to content

Commit

Permalink
More docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Jul 28, 2023
1 parent 3768b3c commit 75d5132
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/baseframe/statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ def pipeline(self) -> Pipeline:

@staticmethod
def _request_started(app: Flask) -> None:
"""Record start time when serving a request."""
if app.config['STATSD_RATE'] != 0:
setattr(g, REQUEST_START_TIME_ATTR, time.time())

def _request_finished(self, app: Flask, response: Response) -> None:
"""Calculate time to render a response and log to statsd."""
if hasattr(g, REQUEST_START_TIME_ATTR):
start_time = getattr(g, REQUEST_START_TIME_ATTR)
metrics = [
Expand Down

0 comments on commit 75d5132

Please sign in to comment.