Skip to content

Commit 3209c5f

Browse files
authored
Add mlis for observer_helpers and observer_skeleton (#6539)
2 parents aa1653a + 4927eef commit 3209c5f

File tree

3 files changed

+274
-1
lines changed

3 files changed

+274
-1
lines changed
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
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] notifies the
39+
forwarder that an Observer with [uuid] has been created. The subsequent
40+
parameters 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] notifies the forwarder that an Observer with [uuid]
44+
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] notifies the fowarder that the Observer
49+
with [uuid] has had its enabled field 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] notifies the fowarder that the
59+
Observer with [uuid] has had its attributes field 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] notifies the fowarder that the Observer
64+
with [uuid] has had its endpoints field set to [endpoints]. *)
65+
66+
val init : (debug_info -> (unit, Errors.error) R.comp) R.res
67+
(** [init dbg] notifies the forwarder that it should perform any tracing
68+
initialisation. *)
69+
70+
val set_trace_log_dir :
71+
(debug_info -> string -> (unit, Errors.error) R.comp) R.res
72+
(** [set_trace_log_dir dbg dir] notifies the fowarder that the trace_log_dir
73+
has been set to [dir]. *)
74+
75+
val set_export_interval :
76+
(debug_info -> float -> (unit, Errors.error) R.comp) R.res
77+
(** [set_export_interval dbg interval] notifies the fowarder that the interval
78+
between trace exports has been set to [interval]. *)
79+
80+
val set_max_spans : (debug_info -> int -> (unit, Errors.error) R.comp) R.res
81+
(** [set_max_spans dbg spans] notifies the fowarder that the max number of
82+
spans has been set to [spans]. *)
83+
84+
val set_max_traces : (debug_info -> int -> (unit, Errors.error) R.comp) R.res
85+
(** [set_max_traces dbg traces] notifies the fowarder that the max number of
86+
traces has been set to [traces]. *)
87+
88+
val set_max_file_size :
89+
(debug_info -> int -> (unit, Errors.error) R.comp) R.res
90+
(** [set_max_file_size dbg file_size] notifies the fowarder that the max file
91+
size has been set to [file_size]. *)
92+
93+
val set_host_id : (debug_info -> string -> (unit, Errors.error) R.comp) R.res
94+
(** [set_host_id dbg host_id] notifies the fowarder that the host to be traced
95+
has been set to [host_id]. *)
96+
97+
val set_compress_tracing_files :
98+
(debug_info -> bool -> (unit, Errors.error) R.comp) R.res
99+
(** [set_compress_tracing_files dbg enabled] notifies the fowarder that the
100+
compression of tracing files has been set to [enabled]. *)
101+
end
102+
103+
(** A Server_impl module will define how the Server responds to ObserverAPI calls *)
104+
module type Server_impl = sig
105+
type context = unit
106+
107+
val create :
108+
context
109+
-> dbg:debug_info
110+
-> uuid:string
111+
-> name_label:string
112+
-> attributes:(string * string) list
113+
-> endpoints:string list
114+
-> enabled:bool
115+
-> unit
116+
117+
val destroy : context -> dbg:debug_info -> uuid:string -> unit
118+
119+
val set_enabled :
120+
context -> dbg:debug_info -> uuid:string -> enabled:bool -> unit
121+
122+
val set_attributes :
123+
context
124+
-> dbg:debug_info
125+
-> uuid:string
126+
-> attributes:(string * string) list
127+
-> unit
128+
129+
val set_endpoints :
130+
context -> dbg:debug_info -> uuid:string -> endpoints:string list -> unit
131+
132+
val init : context -> dbg:debug_info -> unit
133+
134+
val set_trace_log_dir : context -> dbg:debug_info -> dir:string -> unit
135+
136+
val set_export_interval : context -> dbg:debug_info -> interval:float -> unit
137+
138+
val set_max_spans : context -> dbg:debug_info -> spans:int -> unit
139+
140+
val set_max_traces : context -> dbg:debug_info -> traces:int -> unit
141+
142+
val set_max_file_size : context -> dbg:debug_info -> file_size:int -> unit
143+
144+
val set_host_id : context -> dbg:debug_info -> host_id:string -> unit
145+
146+
val set_compress_tracing_files :
147+
context -> dbg:debug_info -> enabled:bool -> unit
148+
end
149+
150+
(** A Server for receiving ObserverAPI calls *)
151+
module Server : functor (_ : Server_impl) () -> sig
152+
module S : sig
153+
val create :
154+
( debug_info
155+
-> string
156+
-> string
157+
-> (string * string) list
158+
-> string list
159+
-> bool
160+
-> unit
161+
)
162+
-> unit
163+
164+
val destroy : (debug_info -> string -> unit) -> unit
165+
166+
val set_enabled : (debug_info -> string -> bool -> unit) -> unit
167+
168+
val set_attributes :
169+
(debug_info -> string -> (string * string) list -> unit) -> unit
170+
171+
val set_endpoints : (debug_info -> string -> string list -> unit) -> unit
172+
173+
val init : (debug_info -> unit) -> unit
174+
175+
val set_trace_log_dir : (debug_info -> string -> unit) -> unit
176+
177+
val set_export_interval : (debug_info -> float -> unit) -> unit
178+
179+
val set_max_spans : (debug_info -> int -> unit) -> unit
180+
181+
val set_max_traces : (debug_info -> int -> unit) -> unit
182+
183+
val set_max_file_size : (debug_info -> int -> unit) -> unit
184+
185+
val set_host_id : (debug_info -> string -> unit) -> unit
186+
187+
val set_compress_tracing_files : (debug_info -> bool -> unit) -> unit
188+
end
189+
190+
val process : Rpc.call -> Rpc.response
191+
end
192+
193+
(** A client for sending ObserverAPI calls to the above queue_name *)
194+
module Client : sig
195+
val create :
196+
debug_info
197+
-> string
198+
-> string
199+
-> (string * string) list
200+
-> string list
201+
-> bool
202+
-> unit
203+
204+
val destroy : debug_info -> string -> unit
205+
206+
val set_enabled : debug_info -> string -> bool -> unit
207+
208+
val set_attributes : debug_info -> string -> (string * string) list -> unit
209+
210+
val set_endpoints : debug_info -> string -> string list -> unit
211+
212+
val init : debug_info -> unit
213+
214+
val set_trace_log_dir : debug_info -> string -> unit
215+
216+
val set_export_interval : debug_info -> float -> unit
217+
218+
val set_max_spans : debug_info -> int -> unit
219+
220+
val set_max_traces : debug_info -> int -> unit
221+
222+
val set_max_file_size : debug_info -> int -> unit
223+
224+
val set_host_id : debug_info -> string -> unit
225+
226+
val set_compress_tracing_files : debug_info -> bool -> unit
227+
end
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
(** This module provides dummy implementations for each Observer function.
2+
These are intended to be used to fill in the functions that the module will
3+
not ever use, as they will raise an Unimplemented error if called *)
4+
module Observer : sig
5+
type context = unit
6+
7+
val create :
8+
context
9+
-> dbg:string
10+
-> uuid:string
11+
-> name_label:string
12+
-> attributes:(string * string) list
13+
-> endpoints:string list
14+
-> enabled:bool
15+
-> unit
16+
17+
val destroy : context -> dbg:string -> uuid:string -> unit
18+
19+
val set_enabled : context -> dbg:string -> uuid:string -> enabled:bool -> unit
20+
21+
val set_attributes :
22+
context
23+
-> dbg:string
24+
-> uuid:string
25+
-> attributes:(string * string) list
26+
-> unit
27+
28+
val set_endpoints :
29+
context -> dbg:string -> uuid:string -> endpoints:string list -> unit
30+
31+
val init : context -> dbg:string -> unit
32+
33+
val set_trace_log_dir : context -> dbg:string -> dir:string -> unit
34+
35+
val set_export_interval : context -> dbg:string -> interval:float -> unit
36+
37+
val set_max_spans : context -> dbg:string -> spans:int -> unit
38+
39+
val set_max_traces : context -> dbg:string -> traces:int -> unit
40+
41+
val set_max_file_size : context -> dbg:string -> file_size:int -> unit
42+
43+
val set_host_id : context -> dbg:string -> host_id:string -> unit
44+
45+
val set_compress_tracing_files : context -> dbg:string -> enabled:bool -> unit
46+
end

quality-gate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ verify-cert () {
2525
}
2626

2727
mli-files () {
28-
N=466
28+
N=464
2929
X="ocaml/tests"
3030
X+="|ocaml/quicktest"
3131
X+="|ocaml/message-switch/core_test"

0 commit comments

Comments
 (0)