Skip to content

out_bigquery: make HTTP buffer size configurable #10596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion plugins/out_bigquery/bigquery.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,9 @@ static int cb_bigquery_init(struct flb_output_instance *ins,
flb_sds_destroy(token);
}

/* Setup HTTP debug callbacks */
flb_output_set_http_debug_callbacks(ins);

return 0;
}

Expand Down Expand Up @@ -1014,13 +1017,16 @@ static void cb_bigquery_flush(struct flb_event_chunk *event_chunk,
FLB_OUTPUT_RETURN(FLB_RETRY);
}

flb_http_buffer_size(c, 4192);
flb_http_buffer_size(c, ctx->buffer_size);
flb_http_add_header(c, "User-Agent", 10, "Fluent-Bit", 10);
flb_http_add_header(c, "Content-Type", 12, "application/json", 16);

/* Compose and append Authorization header */
flb_http_add_header(c, "Authorization", 13, token, flb_sds_len(token));

/* Enable HTTP client debug callbacks */
flb_http_client_debug(c, ctx->ins->callback);

/* Send HTTP request */
ret = flb_http_do(c, &b_sent);

Expand Down Expand Up @@ -1143,6 +1149,11 @@ static struct flb_config_map config_map[] = {
0, FLB_TRUE, offsetof(struct flb_bigquery, ignore_unknown_values),
"Enable ignoring unknown value",
},
{
FLB_CONFIG_MAP_INT, "buffer_size", "4192",
0, FLB_TRUE, offsetof(struct flb_bigquery, buffer_size),
"Set the HTTP buffer size",
},
/* EOF */
{0}
};
Expand Down
1 change: 1 addition & 0 deletions plugins/out_bigquery/bigquery.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ struct flb_bigquery {

int skip_invalid_rows;
int ignore_unknown_values;
int buffer_size;

flb_sds_t uri;

Expand Down