Skip to content

Commit

Permalink
in_opentelemetry: improved OTLP error handling (#8962)
Browse files Browse the repository at this point in the history
* Add logging in cases of opentelemetry metric+trace decode fail
* Return error val in case of opentelemetry metric payload decode failure
* Update opentelemetry HTTP server to return deserialisation error message in non-ok handling cases

---------

Signed-off-by: Stewart Webb <stewart.james.webb@gmail.com>
  • Loading branch information
nuclearpidgeon authored Jun 25, 2024
1 parent 1c58785 commit 1c3740d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion plugins/in_opentelemetry/opentelemetry_prot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2217,6 +2217,10 @@ static int process_payload_metrics_ng(struct flb_opentelemetry *ctx,

cmt_decode_opentelemetry_destroy(&decoded_contexts);
}
else {
flb_plg_warn(ctx->ins, "non-success cmetrics opentelemetry decode result %d", result);
return -1;
}

return 0;
}
Expand Down Expand Up @@ -2266,6 +2270,9 @@ static int process_payload_traces_proto_ng(struct flb_opentelemetry *ctx,
result = flb_input_trace_append(ctx->ins, NULL, 0, decoded_context);
ctr_decode_opentelemetry_destroy(decoded_context);
}
else {
flb_plg_warn(ctx->ins, "non-success ctraces opentelemetry decode result %d", result);
}

return result;
}
Expand Down Expand Up @@ -2478,7 +2485,12 @@ int opentelemetry_prot_handle_ng(struct flb_http_request *request,
send_export_service_response_ng(response, result, payload_type);
}
else {
send_response_ng(response, context->successful_response_code, NULL);
if (result == 0) {
send_response_ng(response, context->successful_response_code, NULL);
}
else {
send_response_ng(response, 400, "invalid request: deserialisation error\n");
}
}

return result;
Expand Down

0 comments on commit 1c3740d

Please sign in to comment.