mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-09 20:33:36 -04:00
format
This commit is contained in:
parent
d061c64818
commit
788dc38e9b
1 changed files with 20 additions and 12 deletions
|
|
@ -7,7 +7,8 @@ module Rand_bytes = Rand_bytes
|
||||||
(** Generation of random identifiers *)
|
(** Generation of random identifiers *)
|
||||||
|
|
||||||
open struct
|
open struct
|
||||||
let result_bind x f = match x with
|
let result_bind x f =
|
||||||
|
match x with
|
||||||
| Error e -> Error e
|
| Error e -> Error e
|
||||||
| Ok x -> f x
|
| Ok x -> f x
|
||||||
end
|
end
|
||||||
|
|
@ -443,7 +444,8 @@ module Globals = struct
|
||||||
| None -> l
|
| None -> l
|
||||||
| Some v ->
|
| Some v ->
|
||||||
default_key_value ~key:Conventions.Attributes.Service.instance_id
|
default_key_value ~key:Conventions.Attributes.Service.instance_id
|
||||||
~value:(Some (String_value v)) () :: l
|
~value:(Some (String_value v)) ()
|
||||||
|
:: l
|
||||||
in
|
in
|
||||||
let l =
|
let l =
|
||||||
match !service_namespace with
|
match !service_namespace with
|
||||||
|
|
@ -489,6 +491,7 @@ end
|
||||||
*)
|
*)
|
||||||
module Span_link : sig
|
module Span_link : sig
|
||||||
open Proto.Trace
|
open Proto.Trace
|
||||||
|
|
||||||
type t = span_link
|
type t = span_link
|
||||||
|
|
||||||
val make :
|
val make :
|
||||||
|
|
@ -501,15 +504,19 @@ module Span_link : sig
|
||||||
t
|
t
|
||||||
end = struct
|
end = struct
|
||||||
open Proto.Trace
|
open Proto.Trace
|
||||||
|
|
||||||
type t = span_link
|
type t = span_link
|
||||||
|
|
||||||
let make ~trace_id ~span_id ?trace_state ?(attrs=[]) ?dropped_attributes_count () : t =
|
let make ~trace_id ~span_id ?trace_state ?(attrs = [])
|
||||||
|
?dropped_attributes_count () : t =
|
||||||
let attributes = List.map _conv_key_value attrs in
|
let attributes = List.map _conv_key_value attrs in
|
||||||
let dropped_attributes_count = Option.map Int32.of_int dropped_attributes_count in
|
let dropped_attributes_count =
|
||||||
|
Option.map Int32.of_int dropped_attributes_count
|
||||||
|
in
|
||||||
default_span_link
|
default_span_link
|
||||||
~trace_id:(Trace_id.to_bytes trace_id)
|
~trace_id:(Trace_id.to_bytes trace_id)
|
||||||
~span_id:(Span_id.to_bytes span_id)
|
~span_id:(Span_id.to_bytes span_id) ?trace_state ~attributes
|
||||||
?trace_state ~attributes ?dropped_attributes_count ()
|
?dropped_attributes_count ()
|
||||||
end
|
end
|
||||||
|
|
||||||
(** Spans.
|
(** Spans.
|
||||||
|
|
@ -696,7 +703,8 @@ module Trace = struct
|
||||||
| Error e -> default_status ~code:Status_code_error ~message:e ()
|
| Error e -> default_status ~code:Status_code_error ~message:e ()
|
||||||
in
|
in
|
||||||
let span, _ =
|
let span, _ =
|
||||||
(* TODO: should the attrs passed to with_ go on the Span (in Span.create) or on the ResourceSpan (in emit)?
|
(* TODO: should the attrs passed to with_ go on the Span
|
||||||
|
(in Span.create) or on the ResourceSpan (in emit)?
|
||||||
(question also applies to Opentelemetry_lwt.Trace.with) *)
|
(question also applies to Opentelemetry_lwt.Trace.with) *)
|
||||||
Span.create ?kind ~trace_id ?parent ?links ~id:span_id ?trace_state
|
Span.create ?kind ~trace_id ?parent ?links ~id:span_id ?trace_state
|
||||||
~attrs:scope.attrs ~events:scope.events ~start_time
|
~attrs:scope.attrs ~events:scope.events ~start_time
|
||||||
|
|
@ -913,8 +921,8 @@ module Logs = struct
|
||||||
~instrumentation_library_logs:[ ll ] ()
|
~instrumentation_library_logs:[ ll ] ()
|
||||||
in
|
in
|
||||||
Collector.send_logs [ rl ] ~ret:ignore
|
Collector.send_logs [ rl ] ~ret:ignore
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
(** A set of callbacks that produce metrics when called.
|
(** A set of callbacks that produce metrics when called.
|
||||||
The metrics are automatically called regularly.
|
The metrics are automatically called regularly.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue