Skip to content

Commit

Permalink
Improve ocaml-ci builds
Browse files Browse the repository at this point in the history
- `String.starts_with` added in 4.13.
- `__FUNCTION__` added in 4.12.
- Force version of PCRE bindings (from 2020, OCaml 4.08).
- Force version of Lwt (`Lwt.reraise` added in 5.7.0).
  • Loading branch information
smondet committed Nov 13, 2024
1 parent dc07cd9 commit 4ce705f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions devkit.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ depends: [
"camlzip"
"libevent" {>= "0.8.0"}
"ocurl" {>= "0.7.2"}
"pcre"
"pcre" {>= "7.4.6"}
"trace" {>= "0.4"}
"extunix" {>= "0.1.4"}
"lwt" {>= "2.5.2"}
"lwt" {>= "5.7.0"}
"lwt_ppx"
"base-bytes"
"base-unix"
Expand Down
7 changes: 5 additions & 2 deletions web.ml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ module Http (IO : IO_TYPE) (Curl_IO : CURL with type 'a t = 'a IO.t) : HTTP with
(* Given a list of strings, check pre-existing entry starting with `~name`; and adds the concatenation of `~name` and `~value` if not. *)
let add_if_absent ~name ~value strs =
match strs with
| Some strs when List.exists (StringLabels.starts_with ~prefix:(name^":")) strs -> strs
| Some strs when List.exists (fun s -> Stre.starts_with s (name^":")) strs -> strs
| Some strs -> (String.concat ": " [name; value]) :: strs
| None -> [String.concat ": " [name; value]]

Expand Down Expand Up @@ -301,7 +301,10 @@ module Http (IO : IO_TYPE) (Curl_IO : CURL with type 'a t = 'a IO.t) : HTTP with
"url.full", `String url;
]
in
let explicit_span = Possibly_otel.enter_manual_span ~__FUNCTION__ ~__FILE__ ~__LINE__ ~data:describe action_name in
let explicit_span =
(* We set the value of `__FUNCTION__` to preserve the build with OCaml < 4.12. *)
Possibly_otel.enter_manual_span
~__FUNCTION__:"Devkit.Web.Http.http_request'" ~__FILE__ ~__LINE__ ~data:describe action_name in

let headers = match Possibly_otel.Traceparent.get_ambient ~explicit_span () with
| None -> headers
Expand Down

0 comments on commit 4ce705f

Please sign in to comment.