MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / record_generation_result

Function record_generation_result

src/core/monitoring.py:360–371  ·  view source on GitHub ↗
(generation_type: str, result: str, duration_seconds: Optional[float])

Source from the content-addressed store, hash-verified

358
359
360def record_generation_result(generation_type: str, result: str, duration_seconds: Optional[float]) -> None:
361 normalized_type = generation_type if generation_type in {"image", "video"} else "unknown"
362 normalized_result = result if result in {"success", "failed", "cancelled", "no_token", "invalid"} else "unknown"
363 GENERATION_REQUESTS_TOTAL.labels(
364 generation_type=normalized_type,
365 result=normalized_result,
366 ).inc()
367 if duration_seconds is not None and duration_seconds >= 0:
368 GENERATION_DURATION_SECONDS.labels(
369 generation_type=normalized_type,
370 result=normalized_result,
371 ).observe(float(duration_seconds))
372
373
374def record_token_refresh(kind: str, result: str) -> None:

Callers 1

handle_generationMethod · 0.85

Calls 3

incMethod · 0.80
labelsMethod · 0.80
observeMethod · 0.80

Tested by

no test coverage detected