Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion modules/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
import prometheus_client

class Metrics(enum.Enum):

WAV_FILE_GENERATION_SECONDS = (
"wav_file_generation_seconds",
"Time taken to generate the phone script wav file in seconds",
prometheus_client.Summary,
)

API_RESPONSE_CODES = (
"leetcode_api_response_codes",
Expand Down Expand Up @@ -94,4 +100,4 @@ def instance(cls):
if cls._instance is None:
cls._instance = cls.__new__(cls)
cls.init(cls)
return cls._instance
return cls._instance
1 change: 1 addition & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ async def get_phone_script():
with wav_generation_lock:
if last_wav_generation_time is None or current_time - last_wav_generation_time > 1800:
logger.info("Regenerating phone script audio file on demand")
with metrics_handler.wav_file_generation_seconds.time():
my_big_dumb_generation_life()

Choose a reason for hiding this comment

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

does this have to be indented?


MetricsHandler.wav_last_sent.set(time.time())
Expand Down