|
| 1 | +val queue_name : string |
| 2 | + |
| 3 | +val default_path : string |
| 4 | + |
| 5 | +module Errors : sig |
| 6 | + type error = |
| 7 | + | Internal_error of string |
| 8 | + | Unimplemented of string |
| 9 | + | Unknown_error |
| 10 | + |
| 11 | + val typ_of_error : error Rpc.Types.typ |
| 12 | + |
| 13 | + val error : error Rpc.Types.def |
| 14 | +end |
| 15 | + |
| 16 | +exception Observer_error of Errors.error |
| 17 | + |
| 18 | +type debug_info = string |
| 19 | + |
| 20 | +(** ObserverAPI contains the declarations for the RPCs which are sent to |
| 21 | + Observer modules when the corresponding function is called on the Observer |
| 22 | + see ocaml/libs/tracing/ and ocaml/xapi/xapi_observer.ml *) |
| 23 | +module ObserverAPI : functor (R : Idl.RPC) -> sig |
| 24 | + val description : Idl.Interface.description |
| 25 | + |
| 26 | + val implementation : R.implementation |
| 27 | + |
| 28 | + val create : |
| 29 | + ( debug_info |
| 30 | + -> string |
| 31 | + -> string |
| 32 | + -> (string * string) list |
| 33 | + -> string list |
| 34 | + -> bool |
| 35 | + -> (unit, Errors.error) R.comp |
| 36 | + ) |
| 37 | + R.res |
| 38 | + (** [create dbg uuid name attributes endpoints enabled] is for when the |
| 39 | + Observer is created. [uuid] is the Observer which has been created and |
| 40 | + the parameters following are the fields the Observer was created with. *) |
| 41 | + |
| 42 | + val destroy : (debug_info -> string -> (unit, Errors.error) R.comp) R.res |
| 43 | + (** [destroy dbg uuid] is for when the Observer is destroyed. [uuid] |
| 44 | + is the Observer which has been destroyed.*) |
| 45 | + |
| 46 | + val set_enabled : |
| 47 | + (debug_info -> string -> bool -> (unit, Errors.error) R.comp) R.res |
| 48 | + (** [set_enabled dbg uuid enabled] is for when the Observer's enabled |
| 49 | + field is set to [enabled]. *) |
| 50 | + |
| 51 | + val set_attributes : |
| 52 | + ( debug_info |
| 53 | + -> string |
| 54 | + -> (string * string) list |
| 55 | + -> (unit, Errors.error) R.comp |
| 56 | + ) |
| 57 | + R.res |
| 58 | + (** [set_attributes dbg uuid attributes] is for when the Observer's |
| 59 | + attributes field is set to [attributes]. *) |
| 60 | + |
| 61 | + val set_endpoints : |
| 62 | + (debug_info -> string -> string list -> (unit, Errors.error) R.comp) R.res |
| 63 | + (** [set_endpoints dbg uuid endpoints] is for when the Observer's endpoints |
| 64 | + field is set to [endpoints]. *) |
| 65 | + |
| 66 | + val init : (debug_info -> (unit, Errors.error) R.comp) R.res |
| 67 | + (** [init dbg] is for when tracing is first initialised *) |
| 68 | + |
| 69 | + val set_trace_log_dir : |
| 70 | + (debug_info -> string -> (unit, Errors.error) R.comp) R.res |
| 71 | + (** [set_trace_log_dir dbg dir] is for when the destination of the |
| 72 | + trace logs is set to [dir]. *) |
| 73 | + |
| 74 | + val set_export_interval : |
| 75 | + (debug_info -> float -> (unit, Errors.error) R.comp) R.res |
| 76 | + (** [set_export_interval dbg interval] is for when the interval between trace |
| 77 | + exports is set to [interval]. *) |
| 78 | + |
| 79 | + val set_max_spans : (debug_info -> int -> (unit, Errors.error) R.comp) R.res |
| 80 | + (** [set_max_spans dbg spans] is for when the max number of spans is |
| 81 | + set to [spans]. *) |
| 82 | + |
| 83 | + val set_max_traces : (debug_info -> int -> (unit, Errors.error) R.comp) R.res |
| 84 | + (** [set_max_traces dbg traces] is for when the max number of traces is |
| 85 | + set to [traces]. *) |
| 86 | + |
| 87 | + val set_max_file_size : |
| 88 | + (debug_info -> int -> (unit, Errors.error) R.comp) R.res |
| 89 | + (** [set_max_file_size dbg file_size] is for when the max size of a trace file |
| 90 | + is set to [file_size]. *) |
| 91 | + |
| 92 | + val set_host_id : (debug_info -> string -> (unit, Errors.error) R.comp) R.res |
| 93 | + (** [set_host_id dbg host_id] is for when the host to be traced is |
| 94 | + set to [host_id]. *) |
| 95 | + |
| 96 | + val set_compress_tracing_files : |
| 97 | + (debug_info -> bool -> (unit, Errors.error) R.comp) R.res |
| 98 | + (** [set_compress_tracing_files dbg enabled] is for when the compression of |
| 99 | + tracing files is enabled/disabled according to [enabled]. *) |
| 100 | +end |
| 101 | + |
| 102 | +(** A Server_impl module will define how the Server responds to ObserverAPI calls *) |
| 103 | +module type Server_impl = sig |
| 104 | + type context = unit |
| 105 | + |
| 106 | + val create : |
| 107 | + context |
| 108 | + -> dbg:debug_info |
| 109 | + -> uuid:string |
| 110 | + -> name_label:string |
| 111 | + -> attributes:(string * string) list |
| 112 | + -> endpoints:string list |
| 113 | + -> enabled:bool |
| 114 | + -> unit |
| 115 | + |
| 116 | + val destroy : context -> dbg:debug_info -> uuid:string -> unit |
| 117 | + |
| 118 | + val set_enabled : |
| 119 | + context -> dbg:debug_info -> uuid:string -> enabled:bool -> unit |
| 120 | + |
| 121 | + val set_attributes : |
| 122 | + context |
| 123 | + -> dbg:debug_info |
| 124 | + -> uuid:string |
| 125 | + -> attributes:(string * string) list |
| 126 | + -> unit |
| 127 | + |
| 128 | + val set_endpoints : |
| 129 | + context -> dbg:debug_info -> uuid:string -> endpoints:string list -> unit |
| 130 | + |
| 131 | + val init : context -> dbg:debug_info -> unit |
| 132 | + |
| 133 | + val set_trace_log_dir : context -> dbg:debug_info -> dir:string -> unit |
| 134 | + |
| 135 | + val set_export_interval : context -> dbg:debug_info -> interval:float -> unit |
| 136 | + |
| 137 | + val set_max_spans : context -> dbg:debug_info -> spans:int -> unit |
| 138 | + |
| 139 | + val set_max_traces : context -> dbg:debug_info -> traces:int -> unit |
| 140 | + |
| 141 | + val set_max_file_size : context -> dbg:debug_info -> file_size:int -> unit |
| 142 | + |
| 143 | + val set_host_id : context -> dbg:debug_info -> host_id:string -> unit |
| 144 | + |
| 145 | + val set_compress_tracing_files : |
| 146 | + context -> dbg:debug_info -> enabled:bool -> unit |
| 147 | +end |
| 148 | + |
| 149 | +(** A Server for receiving ObserverAPI calls *) |
| 150 | +module Server : functor (_ : Server_impl) () -> sig |
| 151 | + module S : sig |
| 152 | + val create : |
| 153 | + ( debug_info |
| 154 | + -> string |
| 155 | + -> string |
| 156 | + -> (string * string) list |
| 157 | + -> string list |
| 158 | + -> bool |
| 159 | + -> unit |
| 160 | + ) |
| 161 | + -> unit |
| 162 | + |
| 163 | + val destroy : (debug_info -> string -> unit) -> unit |
| 164 | + |
| 165 | + val set_enabled : (debug_info -> string -> bool -> unit) -> unit |
| 166 | + |
| 167 | + val set_attributes : |
| 168 | + (debug_info -> string -> (string * string) list -> unit) -> unit |
| 169 | + |
| 170 | + val set_endpoints : (debug_info -> string -> string list -> unit) -> unit |
| 171 | + |
| 172 | + val init : (debug_info -> unit) -> unit |
| 173 | + |
| 174 | + val set_trace_log_dir : (debug_info -> string -> unit) -> unit |
| 175 | + |
| 176 | + val set_export_interval : (debug_info -> float -> unit) -> unit |
| 177 | + |
| 178 | + val set_max_spans : (debug_info -> int -> unit) -> unit |
| 179 | + |
| 180 | + val set_max_traces : (debug_info -> int -> unit) -> unit |
| 181 | + |
| 182 | + val set_max_file_size : (debug_info -> int -> unit) -> unit |
| 183 | + |
| 184 | + val set_host_id : (debug_info -> string -> unit) -> unit |
| 185 | + |
| 186 | + val set_compress_tracing_files : (debug_info -> bool -> unit) -> unit |
| 187 | + end |
| 188 | + |
| 189 | + val process : Rpc.call -> Rpc.response |
| 190 | +end |
| 191 | + |
| 192 | +(** A client for sending ObserverAPI calls to the above queue_name *) |
| 193 | +module Client : sig |
| 194 | + val create : |
| 195 | + debug_info |
| 196 | + -> string |
| 197 | + -> string |
| 198 | + -> (string * string) list |
| 199 | + -> string list |
| 200 | + -> bool |
| 201 | + -> unit |
| 202 | + |
| 203 | + val destroy : debug_info -> string -> unit |
| 204 | + |
| 205 | + val set_enabled : debug_info -> string -> bool -> unit |
| 206 | + |
| 207 | + val set_attributes : debug_info -> string -> (string * string) list -> unit |
| 208 | + |
| 209 | + val set_endpoints : debug_info -> string -> string list -> unit |
| 210 | + |
| 211 | + val init : debug_info -> unit |
| 212 | + |
| 213 | + val set_trace_log_dir : debug_info -> string -> unit |
| 214 | + |
| 215 | + val set_export_interval : debug_info -> float -> unit |
| 216 | + |
| 217 | + val set_max_spans : debug_info -> int -> unit |
| 218 | + |
| 219 | + val set_max_traces : debug_info -> int -> unit |
| 220 | + |
| 221 | + val set_max_file_size : debug_info -> int -> unit |
| 222 | + |
| 223 | + val set_host_id : debug_info -> string -> unit |
| 224 | + |
| 225 | + val set_compress_tracing_files : debug_info -> bool -> unit |
| 226 | +end |
0 commit comments