zio-telemetry
zio-telemetry copied to clipboard
Set error attribute when encountering an error with a span
👋 we've been using zio-open-telemetry with DataDog for a bit. One weird thing we've been noticing is that our error spans don't show up as having errored in the DataDog UI. I think this is because DD expects
span.setAttribute("error", true)
When you encounter an error, which zio-open-telemetry doesn't do currently. Is there interest in adding those to zio-telemetry, probably in here? https://github.com/zio/zio-telemetry/blob/7e6e29c60ad4d9a72c03b175f598fb51f00ea693/opentelemetry/src/main/scala/zio/telemetry/opentelemetry/Tracing.scala#L56
Yes, this looks good. Would you mind adding a test and un-drafting?
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
Nathan Lincoln seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.
I think the actual problem is on line 55:
val errorStatus: StatusCode = cause.failureOption.flatMap(toErrorStatus.lift).getOrElse(StatusCode.UNSET)
If you change StatusCode.UNSET
to StatusCode.ERROR
then you don't need any additional attributes and the errored traces appear as expected in Datadog.
Closing this PR - I no longer work with ZIO (changed jobs) so I won't be able to put the time in to finish it - sorry for leaving it open for so long :disappointed: