Skip to content

compatibility with lwt.6#55

Open
raphael-proust wants to merge 7 commits intomasterfrom
lwt6-compat
Open

compatibility with lwt.6#55
raphael-proust wants to merge 7 commits intomasterfrom
lwt6-compat

Conversation

@raphael-proust
Copy link
Contributor

note that bc lwt had some significant changes in version 6, the version after this PR is not compatible with lwt<6. we might want to do something special like keeping a separate branch for lwt<6 support with distinct releases and such. or not? what do you think?

@raphael-proust
Copy link
Contributor Author

can't build until ocaml/opam-repository#29421 is merged

and poll is guaranteed to be available without the fd limitation.
*)
let () =
if not (Lwt_config._HAVE_LIBEV && Lwt_config.libev_default) then begin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this method not available in lwt 6?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is available

is the concern that then we don't have a version of devkit that's compatible with both 5.9 and 6 so it makes the upgrade for users more difficult? if that's the case then i have ocsigen/lwt#1106 in the works to allow specifically for that

Copy link
Contributor

@rr0gi rr0gi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is lwt_engine change required?

end
| Lwt_engine.Engine_id__poll -> ()
| lwteng ->
eprintfn "Unknown Lwt engine (%s) in use, leaving as is" Obj.Extension_constructor.(name (of_val lwteng));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see Obj i suspect
there is no name function to use?
but then anw i would rather emit log for non-default behaviour branch (ie select=>poll) and do not log anything in other branches (ie here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can make that change

devkit.opam Outdated
"curl_lwt"
"pcre2" {>= "8.0.3"}
"trace" {>= "0.4"}
"trace" {>= "0.10" & < "0.11"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the upper bound?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a different incompatibility that's only unearthed when you unlock ocaml5 or lwt6

basically using lwt6+ocaml5 changes the dependency cone so that it allows trace>=0.11 which was not allowed before and that breaks some things, the upper bound was implicit by transitivity but has to be made explicit now

Comment on lines -8 to -13
let get_ambient ?explicit_span () =
let get_ambient ?explicit_span:_ () =
let* Scope.{ trace_id; span_id; _ } = Scope.get_ambient_scope () in
let span_id = match explicit_span with
| Some {Trace_core.span; _} -> Opentelemetry_trace.Conv.span_id_to_otel span
| None -> span_id
in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c-cube I got lost in the old/new combinators and took an off-road shortcut, could you help me figure out how to get the span-id out of the explicit_span parameter?

Comment on lines -18 to +14
match Scope.get_ambient_scope () with
| None ->
Trace_core.enter_manual_span ~parent:None ~__FUNCTION__ ~__FILE__ ~__LINE__ ?data name
| Some Scope.{ span_id; trace_id; _ } ->
let otrace_espan = Trace_core.{
span = Opentelemetry_trace.Conv.span_id_of_otel span_id;
trace_id = Opentelemetry_trace.Conv.trace_id_of_otel trace_id;
meta = Trace_core.Meta_map.empty
} in
let parent = Some (Trace_core.ctx_of_span otrace_espan) in
Trace_core.enter_manual_span ~parent ~__FUNCTION__ ~__FILE__ ~__LINE__ ?data name
Trace_core.enter_span ~parent:None ~__FUNCTION__ ~__FILE__ ~__LINE__ ?data name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@c-cube
Copy link
Contributor

c-cube commented Mar 14, 2026 via email

@raphael-proust
Copy link
Contributor Author

It's working with recent versions on the master branch

What's a ballpark for a release date for that feature of the master branch? Just for planning, no pressure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants