feat(metrics): update config for starrocks database pooling
This commit is contained in:
parent
5b1da5a140
commit
70e40bd1b3
@ -1,5 +1,4 @@
|
|||||||
from pydantic_settings import BaseSettings
|
from pydantic_settings import BaseSettings
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
|
|
||||||
class AppSettings(BaseSettings):
|
class AppSettings(BaseSettings):
|
||||||
@ -20,7 +19,8 @@ class AppSettings(BaseSettings):
|
|||||||
STARROCKS_USER: str = "root"
|
STARROCKS_USER: str = "root"
|
||||||
STARROCKS_PASSWORD: str = ""
|
STARROCKS_PASSWORD: str = ""
|
||||||
STARROCKS_DATABASE: str = "freeleaps"
|
STARROCKS_DATABASE: str = "freeleaps"
|
||||||
|
STARROCKS_POOL_RECYCLE: int = 300
|
||||||
|
|
||||||
# Prometheus settings
|
# Prometheus settings
|
||||||
PROMETHEUS_ENDPOINT: str = "http://kube-prometheus-stack-prometheus.freeleaps-monitoring-system:9090"
|
PROMETHEUS_ENDPOINT: str = "http://kube-prometheus-stack-prometheus.freeleaps-monitoring-system:9090"
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class SiteSettings(BaseSettings):
|
|||||||
ENV: str = "dev"
|
ENV: str = "dev"
|
||||||
|
|
||||||
SERVER_HOST: str = "localhost"
|
SERVER_HOST: str = "localhost"
|
||||||
SERVER_PORT: int = 9000
|
SERVER_PORT: int = 8009
|
||||||
|
|
||||||
URL: str = "http://localhost"
|
URL: str = "http://localhost"
|
||||||
TIME_ZONE: str = "UTC"
|
TIME_ZONE: str = "UTC"
|
||||||
|
|||||||
@ -25,8 +25,9 @@ class DatabaseConnectionPool:
|
|||||||
charset='utf8mb4',
|
charset='utf8mb4',
|
||||||
autocommit=True,
|
autocommit=True,
|
||||||
minsize=5, # Minimum number of connections in the pool
|
minsize=5, # Minimum number of connections in the pool
|
||||||
maxsize=20, # Maximum number of connections in the pool
|
maxsize=10, # Maximum number of connections in the pool
|
||||||
pool_recycle=3600, # Recycle connections after 1 hour
|
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
|
echo=False # Set to True for SQL query logging
|
||||||
)
|
)
|
||||||
await self.module_logger.log_info(
|
await self.module_logger.log_info(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user