diff --git a/plugins/out_opentelemetry/opentelemetry.c b/plugins/out_opentelemetry/opentelemetry.c index eedc9193f69..a1e5f29e1df 100644 --- a/plugins/out_opentelemetry/opentelemetry.c +++ b/plugins/out_opentelemetry/opentelemetry.c @@ -1095,7 +1095,11 @@ static int append_v1_logs_message(struct opentelemetry_context *ctx, /* SpanId */ if (ctx->ra_span_id_message) { flb_plg_info(ctx->ins, "span id message not null"); + flb_plg_info(ctx->ins, "pattern is %s\n", ctx->ra_span_id_message->pattern); ra_val = flb_ra_get_value_object(ctx->ra_span_id_message, *event->body); + if(ra_val != NULL){ + flb_plg_info(ctx->ins, "ra_val is null"); + } if (ra_val != NULL && ra_val->o.type == MSGPACK_OBJECT_BIN) { flb_plg_info(ctx->ins, "span id ra_val"); log_record->span_id.data = flb_calloc(1, ra_val->o.via.bin.size); @@ -1109,8 +1113,9 @@ static int append_v1_logs_message(struct opentelemetry_context *ctx, } /* TraceId */ - if (ctx->ra_span_id_message) { - ra_val = flb_ra_get_value_object(ctx->ra_span_id_message, *event->body); + if (ctx->ra_trace_id_message) { + flb_plg_info(ctx->ins, "trace id message not null"); + ra_val = flb_ra_get_value_object(ctx->ra_trace_id_message, *event->body); if (ra_val != NULL && ra_val->o.type == MSGPACK_OBJECT_BIN) { log_record->trace_id.data = flb_calloc(1, ra_val->o.via.bin.size); if (log_record->trace_id.data) { diff --git a/src/flb_ra_key.c b/src/flb_ra_key.c index 098479ed605..20adc6a8096 100644 --- a/src/flb_ra_key.c +++ b/src/flb_ra_key.c @@ -88,6 +88,7 @@ static int ra_key_val_id(flb_sds_t ckey, msgpack_object map) } map_size = map.via.map.size; + printf("map size %d", map_size); for (i = map_size - 1; i >= 0; i--) { key = map.via.map.ptr[i].key; @@ -216,9 +217,11 @@ struct flb_ra_value *flb_ra_key_to_value(flb_sds_t ckey, /* Get the key position in the map */ i = ra_key_val_id(ckey, map); if (i == -1) { + printf("map does not contain key"); return NULL; } + printf("getting val from map"); /* Reference entries */ val = map.via.map.ptr[i].val; diff --git a/src/flb_record_accessor.c b/src/flb_record_accessor.c index 444fdf8ca61..16409e8cf55 100644 --- a/src/flb_record_accessor.c +++ b/src/flb_record_accessor.c @@ -779,6 +779,8 @@ struct flb_ra_value *flb_ra_get_value_object(struct flb_record_accessor *ra, return NULL; } + flb_info("key name is %s\n", rp->key->name); + return flb_ra_key_to_value(rp->key->name, map, rp->key->subkeys); }