From 8c2dc731de5fe7da81b7523cc17adebc88097940 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Thu, 19 Sep 2019 20:51:18 +0200 Subject: [PATCH] adapt --- monitoring-experiments.opam | 3 +-- src/monitoring_experiments.ml | 9 ++++++++- src/monitoring_experiments.mli | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/monitoring-experiments.opam b/monitoring-experiments.opam index e1c17af..34b9818 100644 --- a/monitoring-experiments.opam +++ b/monitoring-experiments.opam @@ -21,11 +21,10 @@ depends: [ "tcpip" "mirage-net-solo5" "mirage-solo5" - "ocaml-freestanding" + "ocaml-freestanding" {>= "0.4.5"} "bheap" ] pin-depends: [ - [ "ocaml-freestanding.dev" "git+https://github.com/hannesm/ocaml-freestanding.git#mallinfo" ] [ "mirage-solo5.dev" "git+https://github.com/hannesm/mirage-solo5.git#stats" ] [ "bheap.dev" "git+https://github.com/hannesm/bheap.git#expose-size" ] [ "mirage-net-solo5.dev" "git+https://github.com/hannesm/mirage-net-solo5.git#stats" ] diff --git a/src/monitoring_experiments.ml b/src/monitoring_experiments.ml index 37fa8b6..41033fa 100644 --- a/src/monitoring_experiments.ml +++ b/src/monitoring_experiments.ml @@ -163,6 +163,13 @@ module M = struct let t = { flows = [] } in Lwt.async (timer_loop get host interval t); t + + (* actually a pushed *) + let push ?(interval = 10) ?hostname flow = + let get, reporter = R.store_reporter C.elapsed_ns () in + Metrics.set_reporter reporter; + let host = match hostname with None -> [] | Some host -> [vmname host] in + Lwt.async (timer_loop get host interval { flows = [ flow ] }) end module S (T : Mirage_time_lwt.S) (P : Mirage_clock.PCLOCK) (C : Mirage_clock.MCLOCK) (S : Mirage_stack_lwt.V4) = struct @@ -204,7 +211,7 @@ jfuLKkCfGcw9A8o= |} in match X509.Certificate.decode_pem data with | Ok c -> c - | Error (`Parse e) -> invalid_arg e + | Error (`Msg e) -> invalid_arg e let create_tls ?(port = 8093) ?hostname ?(interval = 10) s certificates = Metrics.enable_all (); diff --git a/src/monitoring_experiments.mli b/src/monitoring_experiments.mli index 5fc6182..df3bab9 100644 --- a/src/monitoring_experiments.mli +++ b/src/monitoring_experiments.mli @@ -35,6 +35,8 @@ module M : sig deregistered. *) val add_flow : t -> F.flow -> unit + + val push : ?interval:int -> ?hostname:string -> F.flow -> unit end module S (T : Mirage_time_lwt.S) (P : Mirage_clock.PCLOCK) (C : Mirage_clock.MCLOCK) (S : Mirage_stack_lwt.V4) : sig