from prometheus_client import Gauge, Summary, Counter

# Email Throttling Metrics
EMAIL_QUEUE_SIZE = Gauge('email_queue_size', 'Number of emails currently in the queue')
EMAIL_DROPPED_COUNT = Counter('email_dropped_count', 'Total number of emails dropped due to throttling')
EMAIL_PROCESSING_TIME = Summary('email_processing_time_seconds', 'Time spent processing emails in the queue')
EMAIL_SENT_SUCCESS_COUNT = Counter('email_sent_success_count', 'Total number of emails successfully sent')

def initialize_metrics():
    # Initialize Prometheus metrics endpoint.  This should be called at application startup.
    from prometheus_client import start_http_server
    start_http_server(8000) # Or whatever port you choose

#Example Usage (This would ideally live where the actual email processing happens)
#EMAIL_QUEUE_SIZE.set(get_queue_size())
#EMAIL_DROPPED_COUNT.inc()
#with EMAIL_PROCESSING_TIME.time():
#   process_email()
#EMAIL_SENT_SUCCESS_COUNT.inc()
