Skip to content
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

out_azure_kusto: added default kusto endpoints connection timeout interval configs #8361

Closed
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 21 additions & 0 deletions plugins/out_azure_kusto/azure_kusto.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,17 @@ flb_sds_t execute_ingest_csl_command(struct flb_azure_kusto *ctx, const char *cs
struct flb_http_client *c;
flb_sds_t resp = NULL;

ctx->u->base.net.connect_timeout = ctx->ingestion_endpoint_connect_timeout;
ctx->u->base.net.keepalive_max_recycle = ctx->keep_alive_max_connection_recycle;

/* Get upstream connection */
u_conn = flb_upstream_conn_get(ctx->u);

if (!u_conn) {
flb_plg_error(ctx->ins, "[out_azure_kusto] cannot create upstream connection while connecting to kusto endpoint");
FLB_OUTPUT_RETURN(FLB_RETRY);
}

if (u_conn) {
token = get_azure_kusto_token(ctx);

Expand Down Expand Up @@ -219,6 +227,13 @@ static int cb_azure_kusto_init(struct flb_output_instance *ins, struct flb_confi
return -1;
}

const char *tmp = flb_output_get_property("ingestion_endpoint_connect_timeout", ins);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not necessary, because the config map defaults to FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT (btw, let's fix that name)

if (tmp != NULL) {
ctx->ingestion_endpoint_connect_timeout = strtol(tmp, NULL, 0);
} else {
ctx->ingestion_endpoint_connect_timeout = FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT;
}

flb_output_set_context(ins, ctx);

/* Network mode IPv6 */
Expand Down Expand Up @@ -462,6 +477,12 @@ static struct flb_config_map config_map[] = {
offsetof(struct flb_azure_kusto, time_key),
"The key name of the time. If 'include_time_key' is false, "
"This property is ignored"},
{FLB_CONFIG_MAP_TIME, "ingestion_endpoint_connect_timeout", FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT, 0, FLB_TRUE,
offsetof(struct flb_azure_kusto, ingestion_endpoint_connect_timeout),
"Set the ingestion endpoint connection timeout in seconds"},
{FLB_CONFIG_MAP_INT, "keep_alive_max_connection_recycle", FLB_AZURE_KUSTO_KEEP_ALIVE_MAX_RECYCLE, 0, FLB_TRUE,
offsetof(struct flb_azure_kusto, keep_alive_max_connection_recycle),
"Set the ingestion endpoint connection timeout in seconds"},
/* EOF */
{0}};

Expand Down
7 changes: 7 additions & 0 deletions plugins/out_azure_kusto/azure_kusto.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@

#define FLB_AZURE_KUSTO_RESOURCES_LOAD_INTERVAL_SEC 3600

#define FLB_AZURE_KUSTO_INGEST_ENDPOINT_CONNECTION_TIMEOUT "60"
#define FLB_AZURE_KUSTO_KEEP_ALIVE_MAX_RECYCLE "20"

struct flb_azure_kusto_resources {
struct flb_upstream_ha *blob_ha;
struct flb_upstream_ha *queue_ha;
Expand All @@ -70,6 +73,10 @@ struct flb_azure_kusto {
flb_sds_t table_name;
flb_sds_t ingestion_mapping_reference;

/* connection configuration */
int ingestion_endpoint_connect_timeout;
int keep_alive_max_connection_recycle;

/* records configuration */
flb_sds_t log_key;
int include_tag_key;
Expand Down
5 changes: 5 additions & 0 deletions plugins/out_azure_kusto/azure_kusto_ingest.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ static flb_sds_t azure_kusto_create_blob(struct flb_azure_kusto *ctx, flb_sds_t

u_conn = flb_upstream_conn_get(u_node->u);

if (!u_conn) {
flb_plg_error(ctx->ins, "[out_azure_kusto] cannot create upstream connection while connecting to blob endpoint");
FLB_OUTPUT_RETURN(FLB_RETRY);
}

if (u_conn) {
uri = azure_kusto_create_blob_uri(ctx, u_node, blob_id);

Expand Down
Loading