SlidingDiagnostics

zio.kafka.diagnostics.SlidingDiagnostics

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def make[DiagnosticEvent](queueSize: Int): ZIO[Scope, Nothing, QueuingDiagnostics[DiagnosticEvent]]

Create a Diagnostics implementation that keeps the last queueSize emitted events in a queue.

Create a Diagnostics implementation that keeps the last queueSize emitted events in a queue.

Useful for testing, or any other case where you don't want to risk high memory usage due to a slow diagnostics implementation.

For example, for a Diagnostics that keeps the last 100 consumer DiagnosticEvents use:

 import zio.kafka.consumer.diagnostics.{DiagnosticEvent => ConsumerDiagnosticEvent}
 for {
   diagnostics <- SlidingDiagnostics.make[ConsumerDiagnosticEvent](100)
   ... use diagnostics
   events <- diagnostics.queue.takeAll
 } yield {
   assert(events.length == 100)
 }

Type parameters

DiagnosticEvent

the type of event to keep

Value parameters

queueSize

number of events to retain in the queue

Attributes