What happened?
Description
When calling span.setStatus({ code: SpanStatusCode.ERROR, message: message}) it could be common to pass a caught Error as the message, like so:
try {
myFunction(); // throws error
} catch (e) { // if typescript strict mode is NOT enabled, `e` is of type `any`
span.setStatus({
code: SpanStatusCode.ERROR,
message: e, // this expects a `string`, but receives `Error`, which TypeScript treats as `any`, so this does not cause a compile error.
});
}
Expected Result
message is dropped as being not a string, a diag.warn is logged.
Actual Result
message which should be a string gets passed all though the SDK, to the exporter, and eventually gets JSON.stringifyd into an empty object, the OTel collector then rejects the whole trace export message with a 400 Bad Request.
Additional Details
This is happening in renovate bot where they catch an error and pass it directly as a message in setStatus: https://github.com/renovatebot/renovate/blob/5ca09edcbf454fc1b1ae9272ab240cd03d8d2e75/lib/instrumentation/index.ts#L145-L153
What happened?
Description
When calling
span.setStatus({ code: SpanStatusCode.ERROR, message: message})it could be common to pass a caughtErroras the message, like so:Expected Result
messageis dropped as being not astring, adiag.warnis logged.Actual Result
messagewhich should be astringgets passed all though the SDK, to the exporter, and eventually getsJSON.stringifyd into an empty object, the OTel collector then rejects the whole trace export message with a400 Bad Request.Additional Details
This is happening in renovate bot where they catch an error and pass it directly as a
messageinsetStatus: https://github.com/renovatebot/renovate/blob/5ca09edcbf454fc1b1ae9272ab240cd03d8d2e75/lib/instrumentation/index.ts#L145-L153