mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-07 18:37:56 -05:00
do not use deprecated functions
This commit is contained in:
parent
6a1f1eb06b
commit
1a78802c20
3 changed files with 7 additions and 5 deletions
|
|
@ -130,7 +130,7 @@ end = struct
|
|||
let open Lwt.Syntax in
|
||||
let req = set_trace_context scope req in
|
||||
let* res, body = callback conn req body in
|
||||
Otel.Trace.add_attrs scope (fun () -> attrs_of_response res);
|
||||
Otel.Scope.add_attrs scope (fun () -> attrs_of_response res);
|
||||
Lwt.return (res, body))
|
||||
|
||||
let with_ ?trace_state ?service_name ?attrs
|
||||
|
|
@ -190,7 +190,7 @@ let client ?(scope : Otel.Scope.t option) (module C : Cohttp_lwt.S.Client) =
|
|||
~attrs (fun scope ->
|
||||
let headers = add_traceparent scope headers in
|
||||
let* res, body = C.call ?ctx ~headers ?body ?chunked meth uri in
|
||||
Otel.Trace.add_attrs scope (fun () ->
|
||||
Otel.Scope.add_attrs scope (fun () ->
|
||||
let code = Response.status res in
|
||||
let code = Code.code_of_status code in
|
||||
[ "http.status_code", `Int code ]);
|
||||
|
|
@ -220,7 +220,7 @@ let client ?(scope : Otel.Scope.t option) (module C : Cohttp_lwt.S.Client) =
|
|||
~attrs (fun scope ->
|
||||
let headers = add_traceparent scope headers in
|
||||
let* res, body = C.post_form ?ctx ~headers ~params uri in
|
||||
Otel.Trace.add_attrs scope (fun () ->
|
||||
Otel.Scope.add_attrs scope (fun () ->
|
||||
let code = Response.status res in
|
||||
let code = Code.code_of_status code in
|
||||
[ "http.status_code", `Int code ]);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ let run_job () =
|
|||
if j = 4 && !i mod 13 = 0 then failwith "oh no";
|
||||
|
||||
(* simulate a failure *)
|
||||
T.Trace.add_event scope (fun () -> T.Event.make "done with alloc")
|
||||
Opentelemetry.Scope.add_event scope (fun () ->
|
||||
T.Event.make "done with alloc")
|
||||
with Failure _ -> ()
|
||||
done
|
||||
done
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ let run_job () : unit Lwt.t =
|
|||
if j = 4 && !i mod 13 = 0 then failwith "oh no";
|
||||
|
||||
(* simulate a failure *)
|
||||
T.Trace.add_event scope (fun () -> T.Event.make "done with alloc");
|
||||
Opentelemetry.Scope.add_event scope (fun () ->
|
||||
T.Event.make "done with alloc");
|
||||
Lwt.return ()
|
||||
with Failure _ -> Lwt.return ()
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue