Merge pull request 'feat(metrics): update config for starrocks database pooling' (#80) from feature/icecheng/metric-fix into dev

Reviewed-on: freeleaps/freeleaps-service-hub#80
This commit is contained in:
icecheng 2025-09-30 05:52:19 +00:00
commit 3de8dbd5fd
3 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,4 @@
from pydantic_settings import BaseSettings
from typing import Optional
class AppSettings(BaseSettings):
@ -20,7 +19,8 @@ class AppSettings(BaseSettings):
STARROCKS_USER: str = "root"
STARROCKS_PASSWORD: str = ""
STARROCKS_DATABASE: str = "freeleaps"
STARROCKS_POOL_RECYCLE: int = 300
# Prometheus settings
PROMETHEUS_ENDPOINT: str = "http://kube-prometheus-stack-prometheus.freeleaps-monitoring-system:9090"

View File

@ -11,7 +11,7 @@ class SiteSettings(BaseSettings):
ENV: str = "dev"
SERVER_HOST: str = "localhost"
SERVER_PORT: int = 9000
SERVER_PORT: int = 8009
URL: str = "http://localhost"
TIME_ZONE: str = "UTC"

View File

@ -25,8 +25,9 @@ class DatabaseConnectionPool:
charset='utf8mb4',
autocommit=True,
minsize=5, # Minimum number of connections in the pool
maxsize=20, # Maximum number of connections in the pool
pool_recycle=3600, # Recycle connections after 1 hour
maxsize=10, # Maximum number of connections in the pool
pool_recycle=app_settings.STARROCKS_POOL_RECYCLE, # Recycle connections after 0.5 hours
connect_timeout=30, # Connection timeout in seconds
echo=False # Set to True for SQL query logging
)
await self.module_logger.log_info(