Skip to content

Commit

Permalink
Merge pull request #353 from MrAnno/fix-http-flush-part-key-change-de…
Browse files Browse the repository at this point in the history
…fault

http: set flush_on_worker_key_change only when templateURL+batches are used
  • Loading branch information
alltilla authored Oct 21, 2024
2 parents 5a31414 + 70c704c commit 5b1bd97
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions modules/http/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,19 @@ http_dd_init(LogPipe *s)
return FALSE;

if ((self->super.batch_lines || self->batch_bytes) && http_load_balancer_is_url_templated(self->load_balancer) &&
self->super.num_workers > 1 && !self->super.worker_partition_key)
self->super.num_workers > 1)
{
msg_error("http: worker-partition-key() must be set if using templates in the url() option "
"while batching is enabled and multiple workers are configured. "
"Make sure to set worker-partition-key() with a template that contains all the templates "
"used in the url() option",
log_pipe_location_tag(&self->super.super.super.super));
return FALSE;
log_threaded_dest_driver_set_flush_on_worker_key_change(&self->super.super.super, TRUE);

if (!self->super.worker_partition_key)
{
msg_error("http: worker-partition-key() must be set if using templates in the url() option "
"while batching is enabled and multiple workers are configured. "
"Make sure to set worker-partition-key() with a template that contains all the templates "
"used in the url() option",
log_pipe_location_tag(&self->super.super.super.super));
return FALSE;
}
}

log_template_options_init(&self->template_options, cfg);
Expand Down Expand Up @@ -510,8 +515,6 @@ http_dd_new(GlobalConfig *cfg)
self->super.stats_source = stats_register_type("http");
self->super.worker.construct = http_dw_new;

log_threaded_dest_driver_set_flush_on_worker_key_change(&self->super.super.super, TRUE);

curl_global_init(CURL_GLOBAL_ALL);

self->ssl_version = CURL_SSLVERSION_DEFAULT;
Expand Down

0 comments on commit 5b1bd97

Please sign in to comment.