diff --git a/plugins/out_calyptia/calyptia.c b/plugins/out_calyptia/calyptia.c index 4f3a7f99fc6..6b53a31c2ca 100644 --- a/plugins/out_calyptia/calyptia.c +++ b/plugins/out_calyptia/calyptia.c @@ -759,7 +759,7 @@ static int cb_calyptia_init(struct flb_output_instance *ins, #ifdef FLB_HAVE_CHUNK_TRACE ctx->trace_endpoint = flb_sds_create_size(256); - flb_sds_printf(&ctx->trace_endpoint, CALYPTIA_ENDPOINT_TRACE, + flb_sds_printf(&ctx->trace_endpoint, CALYPTIA_ENDPOINT_TRACE, ctx->pipeline_id); #endif /* FLB_HAVE_CHUNK_TRACE */ return 0; @@ -790,7 +790,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk, void *out_context, struct flb_config *config) { - int ret; + int ret = FLB_RETRY; size_t off = 0; size_t out_size = 0; char *out_buf = NULL; @@ -801,7 +801,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk, #endif /* FLB_HAVE_CHUNK_TRACE */ struct flb_connection *u_conn; - struct flb_http_client *c; + struct flb_http_client *c = NULL; struct flb_calyptia *ctx = out_context; struct cmt *cmt; (void) i_ins; @@ -867,7 +867,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk, cmt_encode_msgpack_destroy(out_buf); } } - + #ifdef FLB_HAVE_CHUNK_TRACE if (event_chunk->type == (FLB_EVENT_TYPE_LOGS | FLB_EVENT_TYPE_HAS_TRACE)) { json = flb_pack_msgpack_to_json_format(event_chunk->data, @@ -896,7 +896,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk, flb_sds_destroy(ctx->metrics_endpoint); FLB_OUTPUT_RETURN(FLB_RETRY); } - + /* perform request: 'ret' might be FLB_OK, FLB_ERROR or FLB_RETRY */ ret = calyptia_http_do(ctx, c, CALYPTIA_ACTION_TRACE); if (ret == FLB_OK) { @@ -911,7 +911,10 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk, #endif /* FLB_HAVE_CHUNK_TRACE */ flb_upstream_conn_release(u_conn); - flb_http_client_destroy(c); + + if (c) { + flb_http_client_destroy(c); + } FLB_OUTPUT_RETURN(ret); } diff --git a/plugins/out_opentelemetry/opentelemetry_logs.c b/plugins/out_opentelemetry/opentelemetry_logs.c index 7d55fe32a8b..d7b7cea2fb3 100644 --- a/plugins/out_opentelemetry/opentelemetry_logs.c +++ b/plugins/out_opentelemetry/opentelemetry_logs.c @@ -482,7 +482,7 @@ static int append_v1_logs_metadata_and_fields(struct opentelemetry_context *ctx, } if (!severity_number_set && ctx->ra_severity_number_message) { - ra_val = flb_ra_get_value_object(ctx->ra_severity_number_metadata, *event->body); + ra_val = flb_ra_get_value_object(ctx->ra_severity_number_message, *event->body); if (ra_val != NULL) { if (ra_val->o.type == MSGPACK_OBJECT_POSITIVE_INTEGER && is_valid_severity_number(ra_val->o.via.u64)) { log_record->severity_number = ra_val->o.via.u64; @@ -640,7 +640,7 @@ static int append_v1_logs_metadata_and_fields(struct opentelemetry_context *ctx, flb_ra_key_value_destroy(ra_val); } - if (!trace_flags_set && ctx->ra_trace_flags_metadata) { + if (!trace_flags_set) { ra_val = flb_ra_get_value_object(ctx->ra_trace_flags_metadata, *event->metadata); if (ra_val != NULL) { if (ra_val->o.type == MSGPACK_OBJECT_POSITIVE_INTEGER) {