zio-telemetry icon indicating copy to clipboard operation
zio-telemetry copied to clipboard

Set error attribute when encountering an error with a span

Open NLincoln opened this issue 3 years ago • 3 comments

👋 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

NLincoln avatar Feb 15 '22 20:02 NLincoln

Yes, this looks good. Would you mind adding a test and un-drafting?

runtologist avatar Apr 21 '22 11:04 runtologist

CLA assistant check
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.

CLAassistant avatar Aug 11 '22 15:08 CLAassistant

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.

n3ziniuka5 avatar Aug 28 '22 10:08 n3ziniuka5

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:

NLincoln avatar Dec 22 '22 02:12 NLincoln