mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-11-02 00:22:33 +00:00
smp server: add stats_save_interval option
This commit is contained in:
1 parent
845a60d3e9
commit
ad9854c7fa
4 files changed
+12
-2
No files matched your search
@@ -62,6 +62,7 @@ module Simplex.Messaging.Server.Env.STM
|
||||
defaultMsgQueueQuota,
|
||||
defMsgExpirationDays,
|
||||
defNtfExpirationHours,
|
||||
defStatsSaveInterval,
|
||||
defaultMessageExpiration,
|
||||
defaultNtfExpiration,
|
||||
defaultInactiveClientExpiration,
|
||||
@@ -172,6 +173,8 @@ data ServerConfig s = ServerConfig
|
||||
serverStatsLogFile :: FilePath,
|
||||
-- | file to save and restore stats
|
||||
serverStatsBackupFile :: Maybe FilePath,
|
||||
-- | interval to save stats, seconds
|
||||
statsSaveInterval :: Int64,
|
||||
-- | interval and file to save prometheus metrics
|
||||
prometheusInterval :: Maybe Int,
|
||||
prometheusMetricsFile :: FilePath,
|
||||
@@ -233,6 +236,9 @@ defaultNtfExpiration =
|
||||
checkInterval = 3600 -- seconds, 1 hour
|
||||
}
|
||||
|
||||
defStatsSaveInterval :: Int64
|
||||
defStatsSaveInterval = 300
|
||||
|
||||
defaultInactiveClientExpiration :: ExpirationConfig
|
||||
defaultInactiveClientExpiration =
|
||||
ExpirationConfig
|
||||
|
||||
@@ -495,6 +495,7 @@ smpServerCLI_ generateSite serveStaticFiles attachStaticFiles cfgPath logPath =
|
||||
logStatsStartTime = 0, -- seconds from 00:00 UTC
|
||||
serverStatsLogFile = combine logPath "smp-server-stats.daily.log",
|
||||
serverStatsBackupFile = logStats $> combine logPath "smp-server-stats.log",
|
||||
statsSaveInterval = readIniDefault defStatsSaveInterval "STORE_LOG" "stats_save_interval" ini,
|
||||
prometheusInterval = eitherToMaybe (lookupValue "STORE_LOG" "prometheus_interval" ini) >>= readMaybe . T.unpack,
|
||||
prometheusMetricsFile = combine logPath "smp-server-metrics.txt",
|
||||
pendingENDInterval = 15000000, -- 15 seconds
|
||||
|
||||
@@ -104,8 +104,10 @@ iniFileContent cfgPath logPath opts host basicAuth controlPortPwds =
|
||||
<> "# Log daily server statistics to CSV file\n"
|
||||
<> ("log_stats = " <> onOff logStats <> "\n\n")
|
||||
<> "# Log interval for real-time Prometheus metrics\n\
|
||||
\# prometheus_interval = 60\n\n\
|
||||
\[AUTH]\n\
|
||||
\# prometheus_interval = 60\n\n"
|
||||
<> "# Interval to save server statistics, seconds (requires log_stats)\n"
|
||||
<> ("# stats_save_interval = " <> tshow defStatsSaveInterval <> "\n\n")
|
||||
<> "[AUTH]\n\
|
||||
\# Set new_queues option to off to completely prohibit creating new messaging queues.\n\
|
||||
\# This can be useful when you want to decommission the server, but not all connections are switched yet.\n\
|
||||
\new_queues = on\n\n\
|
||||
|
||||
@@ -264,6 +264,7 @@ cfgMS msType = withStoreCfg (testServerStoreConfig msType) $ \serverStoreCfg ->
|
||||
logStatsStartTime = 0,
|
||||
serverStatsLogFile = testPath "smp-server-stats.daily.log",
|
||||
serverStatsBackupFile = Nothing,
|
||||
statsSaveInterval = defStatsSaveInterval,
|
||||
prometheusInterval = Nothing,
|
||||
prometheusMetricsFile = testPrometheusMetricsFile,
|
||||
pendingENDInterval = 500000,
|
||||
|
||||
Reference in new issue
Block a user