(ws cobra to sentry) bound the queue size used to hold up cobra messages before they are sent to sentry. Default queue size is a 100 messages. Without such limit the program runs out of memory when a subscriber receive a lot of messages that cannot make it to sentry

This commit is contained in:
Benjamin Sergeant
2019-12-25 22:15:57 -08:00
parent d2acfd5d1f
commit 3a25a05d9c
5 changed files with 18 additions and 2 deletions

View File

@ -105,6 +105,7 @@ int main(int argc, char** argv)
int count = 1;
int jobs = 4;
uint32_t maxWaitBetweenReconnectionRetries;
size_t maxQueueSize = 100;
auto addTLSOptions = [&tlsOptions, &verifyNone](CLI::App* app) {
app->add_option(
@ -268,6 +269,7 @@ int main(int argc, char** argv)
cobra2sentry->add_option("--rolesecret", rolesecret, "Role secret")->required();
cobra2sentry->add_option("--dsn", dsn, "Sentry DSN");
cobra2sentry->add_option("--jobs", jobs, "Number of thread sending events to Sentry");
cobra2sentry->add_option("--queue_size", maxQueueSize, "Size of the queue to hold messages before they are sent to Sentry");
cobra2sentry->add_option("channel", channel, "Channel")->required();
cobra2sentry->add_flag("-v", verbose, "Verbose");
cobra2sentry->add_flag("-s", strict, "Strict mode. Error out when sending to sentry fails");
@ -455,6 +457,7 @@ int main(int argc, char** argv)
verbose,
strict,
jobs,
maxQueueSize,
tlsOptions);
}
else if (app.got_subcommand("cobra_metrics_to_redis"))