File tree 9 files changed +207
-1
lines changed 9 files changed +207
-1
lines changed Original file line number Diff line number Diff line change @@ -227,3 +227,12 @@ let octez_release =
227
227
~placeholder: " <tag>"
228
228
~description: " Use the octez release <tag> instead of local octez binaries."
229
229
()
230
+
231
+ let open_telemetry =
232
+ Clap. flag
233
+ ~section
234
+ ~set_long: " open-telemetry"
235
+ ~unset_long: " no-open-telemetry"
236
+ ~set_long_synonyms: [" otel" ]
237
+ ~description: " Run the Open Telemetry stack"
238
+ grafana
Original file line number Diff line number Diff line change @@ -100,3 +100,6 @@ val os : string
100
100
101
101
(* * The tag of the octez release to be used. *)
102
102
val octez_release : string option
103
+
104
+ (* * Activate the Open Telemetry collector. *)
105
+ val open_telemetry : bool
Original file line number Diff line number Diff line change @@ -88,6 +88,8 @@ type t = {
88
88
website : Web .t option ;
89
89
prometheus : Prometheus .t option ;
90
90
grafana : Grafana .t option ;
91
+ otel : Otel .t option ;
92
+ jaeger : Jaeger .t option ;
91
93
deployement : Deployement .t option ;
92
94
}
93
95
@@ -163,6 +165,8 @@ let shutdown ?exn t =
163
165
let * () =
164
166
Option. fold ~none: Lwt. return_unit ~some: Grafana. shutdown t.grafana
165
167
in
168
+ let * () = Option. fold ~none: Lwt. return_unit ~some: Otel. shutdown t.otel in
169
+ let * () = Option. fold ~none: Lwt. return_unit ~some: Jaeger. shutdown t.jaeger in
166
170
let * () =
167
171
Option. fold
168
172
~none: Lwt. return_unit
@@ -215,9 +219,24 @@ let orchestrator deployement f =
215
219
Lwt. return_some grafana
216
220
else Lwt. return_none
217
221
in
222
+ let * otel, jaeger =
223
+ if Env. open_telemetry then
224
+ let * otel = Otel. run ~jaeger: true in
225
+ let * jaeger = Jaeger. run () in
226
+ Lwt. return (Some otel, Some jaeger)
227
+ else Lwt. return (None , None )
228
+ in
218
229
Log. info " Post prometheus" ;
219
230
let t =
220
- {website; agents; prometheus; grafana; deployement = Some deployement}
231
+ {
232
+ website;
233
+ agents;
234
+ prometheus;
235
+ grafana;
236
+ otel;
237
+ jaeger;
238
+ deployement = Some deployement;
239
+ }
221
240
in
222
241
let sigint = sigint () in
223
242
let main_promise =
@@ -500,6 +519,8 @@ let register ?proxy_files ?vms ~__FILE__ ~title ~tags ?seed f =
500
519
agents = [default_agent];
501
520
website = None ;
502
521
grafana = None ;
522
+ otel = None ;
523
+ jaeger = None ;
503
524
prometheus = None ;
504
525
deployement = None ;
505
526
}
Original file line number Diff line number Diff line change @@ -70,6 +70,8 @@ let dns = Cli.dns
70
70
71
71
let os = Cli. os
72
72
73
+ let open_telemetry = Cli. open_telemetry
74
+
73
75
let docker_image =
74
76
(* In localhost mode, we don't want to interact with GCP. The image is taken
75
77
locally. *)
Original file line number Diff line number Diff line change @@ -79,6 +79,8 @@ val dns : bool
79
79
80
80
val os : string
81
81
82
+ val open_telemetry : bool
83
+
82
84
val init : unit -> unit Lwt .t
83
85
84
86
val project_id : unit -> string Lwt .t
Original file line number Diff line number Diff line change
1
+ (* ****************************************************************************)
2
+ (* *)
3
+ (* SPDX-License-Identifier: MIT *)
4
+ (* SPDX-FileCopyrightText: 2024 Nomadic Labs <[email protected] > *)
5
+ (* *)
6
+ (* ****************************************************************************)
7
+
8
+ type t = unit
9
+
10
+ let run () =
11
+ let * () =
12
+ Process. run
13
+ " docker"
14
+ [
15
+ " run" ;
16
+ " -d" ;
17
+ " --network" ;
18
+ " host" ;
19
+ " --rm" ;
20
+ " --name" ;
21
+ " jaeger" ;
22
+ " -p" ;
23
+ " 16686:16686" ;
24
+ " -p" ;
25
+ " 14250:14250" ;
26
+ " jaegertracing/all-in-one:latest" ;
27
+ ]
28
+ in
29
+ let is_ready output = String. trim output = " 200" in
30
+ let run () =
31
+ Process. spawn
32
+ " curl"
33
+ [" -s" ; " -o" ; " /dev/null" ; " -w" ; " %{http_code}" ; " http://localhost:16686/" ]
34
+ in
35
+ let * _ = Env. wait_process ~is_ready ~run () in
36
+ Lwt. return ()
37
+
38
+ let shutdown () =
39
+ let * () = Docker. kill " jaeger" |> Process. check in
40
+ Lwt. return_unit
Original file line number Diff line number Diff line change
1
+ (* ****************************************************************************)
2
+ (* *)
3
+ (* SPDX-License-Identifier: MIT *)
4
+ (* SPDX-FileCopyrightText: 2024 Nomadic Labs <[email protected] > *)
5
+ (* *)
6
+ (* ****************************************************************************)
7
+
8
+ type t
9
+
10
+ val run : unit -> t Lwt .t
11
+
12
+ val shutdown : t -> unit Lwt .t
Original file line number Diff line number Diff line change
1
+ (* ****************************************************************************)
2
+ (* *)
3
+ (* SPDX-License-Identifier: MIT *)
4
+ (* SPDX-FileCopyrightText: 2024 Nomadic Labs <[email protected] > *)
5
+ (* *)
6
+ (* ****************************************************************************)
7
+
8
+ type t = unit
9
+
10
+ let configuration ~jaeger =
11
+ let jaeger =
12
+ if jaeger then
13
+ {|
14
+ otlp/ jaeger :
15
+ endpoint : http :// localhost:4317
16
+ tls :
17
+ insecure : true
18
+ |}
19
+ else " "
20
+ in
21
+ Format. asprintf
22
+ {|
23
+ receivers :
24
+ otlp :
25
+ protocols :
26
+ http :
27
+ endpoint : "0.0.0.0:55681"
28
+
29
+ exporters:
30
+
31
+ % s
32
+
33
+ processors:
34
+ batch : # Batch processor to optimize telemetry processing
35
+ timeout : 5 s
36
+
37
+ service:
38
+ pipelines :
39
+ traces : # Pipeline to process trace data
40
+ receivers : [otlp]
41
+ processors : [batch]
42
+ exporters : [otlp/ jaeger]
43
+
44
+ telemetry :
45
+ metrics :
46
+ address : "0.0.0.0:8888" # Optional : Expose metrics for the collector itself (Prometheus scrapeable )
47
+
48
+ extensions :
49
+ - health_check
50
+
51
+ extensions:
52
+ health_check :
53
+ endpoint : "localhost:13133"
54
+ |}
55
+ jaeger
56
+
57
+ let run ~jaeger =
58
+ let configuration_file =
59
+ Filename. get_temp_dir_name () // " otel-config.yaml"
60
+ in
61
+ let contents = configuration ~jaeger in
62
+ write_file configuration_file ~contents ;
63
+ let * () =
64
+ Process. run
65
+ " docker"
66
+ [
67
+ " run" ;
68
+ " -d" ;
69
+ " --rm" ;
70
+ " --network" ;
71
+ " host" ;
72
+ " --name" ;
73
+ " otel-collector" ;
74
+ " -p" ;
75
+ " 4317-4318:4317-4318" ;
76
+ " -p" ;
77
+ " 13133:13133" ;
78
+ " -p" ;
79
+ " 55680-55681:55680-55681" ;
80
+ " -v" ;
81
+ Format. asprintf " %s:/etc/otel/config.yaml" configuration_file;
82
+ " otel/opentelemetry-collector:latest" ;
83
+ " --config" ;
84
+ " /etc/otel/config.yaml" ;
85
+ ]
86
+ in
87
+ let is_ready output = String. trim output = " 200" in
88
+ let run () =
89
+ Process. spawn
90
+ " curl"
91
+ [
92
+ " -s" ;
93
+ " -o" ;
94
+ " /dev/null" ;
95
+ " -w" ;
96
+ " %{http_code}" ;
97
+ " http://localhost:13133/healthz" ;
98
+ ]
99
+ in
100
+ let * _ = Env. wait_process ~is_ready ~run () in
101
+ Lwt. return ()
102
+
103
+ let shutdown () =
104
+ let * () = Docker. kill " otel-collector" |> Process. check in
105
+ Lwt. return_unit
Original file line number Diff line number Diff line change
1
+ (* ****************************************************************************)
2
+ (* *)
3
+ (* SPDX-License-Identifier: MIT *)
4
+ (* SPDX-FileCopyrightText: 2024 Nomadic Labs <[email protected] > *)
5
+ (* *)
6
+ (* ****************************************************************************)
7
+
8
+ type t
9
+
10
+ val run : jaeger :bool -> t Lwt .t
11
+
12
+ val shutdown : t -> unit Lwt .t
You can’t perform that action at this time.
0 commit comments