Module Tezos_oxymeter.Observer

This module provides modules and functions to represent the interactions with the outside world.

Observer modules

module Smartpower : sig ... end

Module that represents the abstract communication with a smartpower through sockets.

module Blind : sig ... end

Module that represents an observation without any metric returned.

module Mock : sig ... end

Module to generate random number when you observe it.

type observer =
| Blind

Return a report with 0 everywhere.

| Mock

Return a report with random numbers. For test purpose.

| Smartpower of Smartpower.station Lwt.t

Return a report from smartpower.

Wrapper type to define the way to observe the consumption.

Interact with observer

val create : string list -> observer

Create an observer from an argument list.

The arguments can be:

  • or "off" for a Blind observer.
  • "mock" for a Mock observer.
  • "power" ; host ; port for a Smartpower observer on host:port.
val observe : observer -> Report.t Lwt.t

Takes an observer and returns the Report.t obtained. As some observers introduces asynchronous interactions, it's wrapped into an Lwt.t.

val to_string : Report.t -> string

to_string report converts a Report.t into a sendable string.

val pp : Stdlib.Format.formatter -> observer -> unit

pp ppf observer is used to pretty print an observer.