← ZIO Profiling docs

CostCenter

zio.profiling.CostCenter
See theCostCenter companion object
final case class CostCenter(locations: Chunk[String])

A CostCenter allows grouping multiple source code locations into one unit for reporting and targeting purposes. Instead of relying on a function call hierarchy to identify a location, zio-profiling relies on manual tagging.

for {
 _ <- CostCenter.withChildCostCenter("short")(ZIO.succeed(Thread.sleep(20))) // code attributed to cost center `Root / "short"`
 _ <- CostCenter.withChildCostCenter("long")(ZIO.succeed(Thread.sleep(40))) // code attributes to cost center `Root / "long"`
} yield ()

Attributes

Companion
object
Source
CostCenter.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def /(location: String): CostCenter

Create a child cost center that is nested under this one.

Create a child cost center that is nested under this one.

Attributes

Source
CostCenter.scala
def hasParent(name: String): Boolean

Check whether this cost center has a parent with a given name.

Check whether this cost center has a parent with a given name.

(Root / "foo" / "bar").hasParent("foo") // true
(Root / "foo" / "bar").hasParent("bar") // true
(Root / "foo" / "bar").hasParent("baz") // false

Attributes

Source
CostCenter.scala

Check whether this cost center has a parent with a name matching the given regex.

Check whether this cost center has a parent with a name matching the given regex.

Attributes

Source
CostCenter.scala

Attributes

Source
CostCenter.scala

Attributes

Source
CostCenter.scala

Attributes

Source
CostCenter.scala
def render: String

Attributes

Source
CostCenter.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product