teoat commited on
Commit
b14fa0a
·
verified ·
1 Parent(s): df13c48

Upload core/performance.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. core/performance.py +5 -3
core/performance.py CHANGED
@@ -18,7 +18,9 @@ logger = logging.getLogger(__name__)
18
  # Prometheus Metrics
19
  http_requests_total = Counter("http_requests_total", "Total HTTP requests", ["method", "endpoint", "status"])
20
 
21
- http_request_duration_seconds = Histogram("http_request_duration_seconds", "HTTP request latency", ["method", "endpoint"])
 
 
22
 
23
  fraud_detections_total = Counter("fraud_detections_total", "Total fraud detections", ["risk_level"])
24
 
@@ -26,7 +28,7 @@ ai_predictions_total = Counter("ai_predictions_total", "Total AI predictions mad
26
 
27
  pending_cases = Gauge("pending_cases", "Number of pending fraud cases")
28
 
29
- database_query_duration = Histogram("database_query_duration_seconds", "Database query execution time", ["query_type"])
30
 
31
  cache_hits_total = Counter("cache_hits_total", "Total cache hits", ["cache_type"])
32
 
@@ -122,7 +124,7 @@ def update_pending_cases(count: int):
122
 
123
  def record_db_query(query_type: str, duration: float):
124
  """Record database query performance"""
125
- database_query_duration.labels(query_type=query_type).observe(duration)
126
 
127
 
128
  def record_cache_hit(cache_type: str = "default"):
 
18
  # Prometheus Metrics
19
  http_requests_total = Counter("http_requests_total", "Total HTTP requests", ["method", "endpoint", "status"])
20
 
21
+ http_request_duration_seconds = Histogram(
22
+ "http_request_duration_seconds", "HTTP request latency", ["method", "endpoint"]
23
+ )
24
 
25
  fraud_detections_total = Counter("fraud_detections_total", "Total fraud detections", ["risk_level"])
26
 
 
28
 
29
  pending_cases = Gauge("pending_cases", "Number of pending fraud cases")
30
 
31
+ from core.query_monitoring import query_duration # noqa: E402
32
 
33
  cache_hits_total = Counter("cache_hits_total", "Total cache hits", ["cache_type"])
34
 
 
124
 
125
  def record_db_query(query_type: str, duration: float):
126
  """Record database query performance"""
127
+ query_duration.labels(operation="general", table=query_type).observe(duration)
128
 
129
 
130
  def record_cache_hit(cache_type: str = "default"):