← ZIO Telemetry docs

zio.telemetry.opentelemetry.tracing

Members list

Type members

Classlikes

object StatusMapper

Attributes

Companion
class
Source
StatusMapper.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract class StatusMapper[-E, -A](val failure: PartialFunction[E, Result[Throwable]], val success: PartialFunction[A, Result[String]])

Maps the result of a wrapped ZIO effect to the status of the io.opentelemetry.api.trace.Span.

Maps the result of a wrapped ZIO effect to the status of the io.opentelemetry.api.trace.Span.

For more details, see: Set status

Usage examples:

 StatusMapper.failure[MyError](_ => StatusCode.ERROR)(e => Some(new RuntimeException(e.message)))
 StatusMapper.failureNoException(_ => StatusCode.ERROR)
 StatusMapper.failureThrowable(StatusCode.ERROR)

 StatusMapper.success[Response] {
   resp => if(resp.code == 500) StatusCode.ERROR else StatusCode.OK
 } { resp =>
   if(resp.code == 500) Some(resp.errorMessage) else None
 }
 StatusMapper.successNoDescription[Response](_ => StatusCode.OK)

 StatusMapper.both(
   StatusMapper.failureThrowable(StatusCode.ERROR),
   StatusMapper.successNoDescription[Any](_ => StatusCode.OK)
 )

Value parameters

failure

partial function to map the ZIO failure to io.opentelemetry.api.trace.StatusCode and java.lang.Throwable. The latter is used to record the exception, see: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/exceptions.md#recording-an-exception

success

partial function to map the ZIO success to io.opentelemetry.api.trace.StatusCode and status description

Attributes

Companion
object
Source
StatusMapper.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Failure[E]
class Success[A]
object Tracing

Attributes

Companion
trait
Source
Tracing.scala
Supertypes
class Object
trait Matchable
class Any
Self type
Tracing.type
trait Tracing

Attributes

Companion
object
Source
Tracing.scala
Supertypes
class Object
trait Matchable
class Any
Self type