Skip to content

Commit

Permalink
Update app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VoronM1522 authored Feb 26, 2025
1 parent 8302f8a commit 0afc4dd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app_python/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

# Prometheus metrics
REQUEST_COUNT = Counter('app_request_count', 'Total number of requests')
REQUEST_TIME = Gauge('app_request_time_seconds', 'Time spent processing requests')
REQUEST_TIME = Gauge('app_request_time_seconds',
'Time spent processing requests')
ERROR_COUNT = Counter('app_error_count', 'Total number of errors')


Expand Down Expand Up @@ -46,7 +47,8 @@ def current_time() -> str:

time = datetime.now(TIME_ZONE)
REQUEST_COUNT.inc() # Increment request counter
REQUEST_TIME.set((datetime.now() - start_time).total_seconds()) # Set request time
REQUEST_TIME.set((datetime.now() - \
start_time).total_seconds()) # Set request time

return f"Current time in {TIME_ZONE} is {time.strftime('%H:%M:%S')}"

Expand All @@ -61,4 +63,3 @@ def metrics() -> Response:

if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000, debug=True)

0 comments on commit 0afc4dd

Please sign in to comment.