← ZIO Telemetry docs

Counter

zio.telemetry.opentelemetry.metrics.Counter
See theCounter companion object
trait Counter[-A] extends Instrument[A]

A Counter instrument that records values of type A

Type parameters

A

according to the specification, it can be either scala.Long or scala.Double type

Attributes

Companion
object
Source
Counter.scala
Graph
Supertypes
trait Instrument[A]
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def add(value: A, attributes: Attributes = ...)(implicit trace: Trace): UIO[Unit]

Records a value.

Records a value.

It uses the context taken from the zio.telemetry.opentelemetry.context.ContextStorage to associate with this measurement.

Value parameters

attributes

set of attributes to associate with the value

value

increment amount. MUST be non-negative

Attributes

Source
Counter.scala
def inc(attributes: Attributes = ...)(implicit trace: Trace): UIO[Unit]

Increments a counter by one.

Increments a counter by one.

It uses the context taken from the zio.telemetry.opentelemetry.context.ContextStorage to associate with this measurement.

Value parameters

attributes

set of attributes to associate with the value

Attributes

Source
Counter.scala

Inherited and Abstract methods

def record0(value: A, attributes: Attributes = ..., context: Context = ...): Unit

Attributes

Inherited from:
Instrument
Source
Instrument.scala