Pulse (Stats)


Pulse is Envoy Mobile’s stats library, used for capturing client application time series metrics. Currently two types of metrics are supported: Counter and Gauge.

This library (like all of Envoy Mobile) is under active development.

To leverage Pulse, obtain an instance of a PulseClient from an Envoy Mobile Engine (refer to Starting Envoy for building an engine instance), and use it to create Counter or Gauge instances. The following code examples show how to create a Counter, and the same approach is used to create a Gauge.

Kotlin example:

pulseClient.counter(Element("foo"), Element("bar"))

Swift example:

pulseClient.counter(elements: ["foo", "bar"])

The counter method from the PulseClient takes a variable number of elements and returns a Counter instance. The elements provided are used to form a dot(.) delimited string that serves as the identifier of the counter. The string formed from the example code above is foo.bar.

Store the instance of the counter or gauge, then use it to increment as necessary.


A Counter can be incremented by calling the increment() method when applicable.

The count argument of increment is defaulted with a value of 1.


// Increment the counter by 1
// Kotlin, Swift

// Increment the counter by 5
// Kotlin

// Increment the counter by 5
// Swift
counter.increment(count: 5)


The value of a Gauge can be incremented, decremented, or reassigned.


// Set the gauge to 5
// Kotlin

// Swift
gauge.set(value: 5)

// Add 5 to the gauge
// Kotlin

// Swift
gauge.add(amount: 5)

// Subtract 5 from the gauge
// Kotlin

// Swift
gauge.sub(amount: 5)