@@ -31,34 +31,38 @@ type Config struct {
31
31
PortalProxyURL string
32
32
Topics []string
33
33
34
- Redis * redis.RedisConfig
35
- ClickHouse * clickhouse.ClickHouseConfig
36
- OpenTelemetry * otel.OpenTelemetryConfig
37
- PublishQueueConfig * mqs.QueueConfig
38
- DeliveryQueueConfig * mqs.QueueConfig
39
- LogQueueConfig * mqs.QueueConfig
40
- PublishMaxConcurrency int
41
- DeliveryMaxConcurrency int
42
- LogMaxConcurrency int
43
- RetryIntervalSeconds int
44
- RetryMaxCount int
34
+ Redis * redis.RedisConfig
35
+ ClickHouse * clickhouse.ClickHouseConfig
36
+ OpenTelemetry * otel.OpenTelemetryConfig
37
+ PublishQueueConfig * mqs.QueueConfig
38
+ DeliveryQueueConfig * mqs.QueueConfig
39
+ LogQueueConfig * mqs.QueueConfig
40
+ PublishMaxConcurrency int
41
+ DeliveryMaxConcurrency int
42
+ LogMaxConcurrency int
43
+ RetryIntervalSeconds int
44
+ RetryMaxCount int
45
+ LogBatcherDelayThresholdSeconds int
46
+ LogBatcherItemCountThreshold int
45
47
}
46
48
47
49
var defaultConfig = map [string ]any {
48
- "PORT" : 3333 ,
49
- "REDIS_HOST" : "127.0.0.1" ,
50
- "REDIS_PORT" : 6379 ,
51
- "REDIS_PASSWORD" : "" ,
52
- "REDIS_DATABASE" : 0 ,
53
- "DELIVERY_RABBITMQ_EXCHANGE" : "outpost" ,
54
- "DELIVERY_RABBITMQ_QUEUE" : "outpost.delivery" ,
55
- "LOG_RABBITMQ_EXCHANGE" : "outpost_logs" ,
56
- "LOG_RABBITMQ_QUEUE" : "outpost_logs.log" ,
57
- "PUBLISHMQ_MAX_CONCURRENCY" : 1 ,
58
- "DELIVERYMQ_MAX_CONCURRENCY" : 1 ,
59
- "LOGMQ_MAX_CONCURRENCY" : 1 ,
60
- "RETRY_INTERVAL_SECONDS" : 30 ,
61
- "MAX_RETRY_COUNT" : 10 ,
50
+ "PORT" : 3333 ,
51
+ "REDIS_HOST" : "127.0.0.1" ,
52
+ "REDIS_PORT" : 6379 ,
53
+ "REDIS_PASSWORD" : "" ,
54
+ "REDIS_DATABASE" : 0 ,
55
+ "DELIVERY_RABBITMQ_EXCHANGE" : "outpost" ,
56
+ "DELIVERY_RABBITMQ_QUEUE" : "outpost.delivery" ,
57
+ "LOG_RABBITMQ_EXCHANGE" : "outpost_logs" ,
58
+ "LOG_RABBITMQ_QUEUE" : "outpost_logs.log" ,
59
+ "PUBLISHMQ_MAX_CONCURRENCY" : 1 ,
60
+ "DELIVERYMQ_MAX_CONCURRENCY" : 1 ,
61
+ "LOGMQ_MAX_CONCURRENCY" : 1 ,
62
+ "RETRY_INTERVAL_SECONDS" : 30 ,
63
+ "MAX_RETRY_COUNT" : 10 ,
64
+ "LOG_BATCHER_DELAY_THRESHOLD_SECONDS" : 5 ,
65
+ "LOG_BATCHER_ITEM_COUNT_THRESHOLD" : 100 ,
62
66
}
63
67
64
68
var (
@@ -161,16 +165,18 @@ func Parse(flags Flags) (*Config, error) {
161
165
Password : viper .GetString ("REDIS_PASSWORD" ),
162
166
Database : mustInt (viper , "REDIS_DATABASE" ),
163
167
},
164
- ClickHouse : clickHouseConfig ,
165
- OpenTelemetry : openTelemetry ,
166
- PublishQueueConfig : publishQueueConfig ,
167
- DeliveryQueueConfig : deliveryQueueConfig ,
168
- LogQueueConfig : logQueueConfig ,
169
- PublishMaxConcurrency : mustInt (viper , "PUBLISHMQ_MAX_CONCURRENCY" ),
170
- DeliveryMaxConcurrency : mustInt (viper , "DELIVERYMQ_MAX_CONCURRENCY" ),
171
- LogMaxConcurrency : mustInt (viper , "LOGMQ_MAX_CONCURRENCY" ),
172
- RetryIntervalSeconds : mustInt (viper , "RETRY_INTERVAL_SECONDS" ),
173
- RetryMaxCount : mustInt (viper , "MAX_RETRY_COUNT" ),
168
+ ClickHouse : clickHouseConfig ,
169
+ OpenTelemetry : openTelemetry ,
170
+ PublishQueueConfig : publishQueueConfig ,
171
+ DeliveryQueueConfig : deliveryQueueConfig ,
172
+ LogQueueConfig : logQueueConfig ,
173
+ PublishMaxConcurrency : mustInt (viper , "PUBLISHMQ_MAX_CONCURRENCY" ),
174
+ DeliveryMaxConcurrency : mustInt (viper , "DELIVERYMQ_MAX_CONCURRENCY" ),
175
+ LogMaxConcurrency : mustInt (viper , "LOGMQ_MAX_CONCURRENCY" ),
176
+ RetryIntervalSeconds : mustInt (viper , "RETRY_INTERVAL_SECONDS" ),
177
+ RetryMaxCount : mustInt (viper , "MAX_RETRY_COUNT" ),
178
+ LogBatcherDelayThresholdSeconds : mustInt (viper , "LOG_BATCHER_DELAY_THRESHOLD_SECONDS" ),
179
+ LogBatcherItemCountThreshold : mustInt (viper , "LOG_BATCHER_ITEM_COUNT_THRESHOLD" ),
174
180
}
175
181
176
182
return config , nil
0 commit comments