mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
use Extensions module in opentelemetry.trace
This commit is contained in:
parent
e4346b14fd
commit
e6412b02e1
2 changed files with 42 additions and 17 deletions
|
|
@ -6,19 +6,30 @@ module Well_known = struct end
|
|||
let on_internal_error =
|
||||
ref (fun msg -> Printf.eprintf "error in Opentelemetry_trace: %s\n%!" msg)
|
||||
|
||||
type span_info = {
|
||||
start_time: int64;
|
||||
name: string;
|
||||
scope: Otel.Scope.t;
|
||||
parent: Otel.Span_ctx.t option;
|
||||
}
|
||||
module Extensions = struct
|
||||
type span_info = {
|
||||
start_time: int64;
|
||||
name: string;
|
||||
scope: Otel.Scope.t;
|
||||
parent: Otel.Span_ctx.t option;
|
||||
}
|
||||
|
||||
type Trace.span += Span_otel of span_info
|
||||
let scope_of_span_info s = s.scope
|
||||
|
||||
type Trace.extension_event +=
|
||||
| Ev_link_span of Trace.span * Trace.span
|
||||
| Ev_set_span_kind of Trace.span * Otel.Span_kind.t
|
||||
| Ev_record_exn of Trace.span * exn * Printexc.raw_backtrace
|
||||
type Trace.span += Span_otel of span_info
|
||||
|
||||
type Trace.extension_event +=
|
||||
| Ev_link_span of Trace.span * Trace.span
|
||||
| Ev_record_exn of Trace.span * exn * Printexc.raw_backtrace
|
||||
| Ev_set_span_kind of Trace.span * Otel.Span_kind.t
|
||||
|
||||
type Trace.metric +=
|
||||
| Metric_hist of Opentelemetry_proto.Metrics.histogram_data_point
|
||||
| Metric_sum_int of int
|
||||
| Metric_sum_float of float
|
||||
end
|
||||
|
||||
open Extensions
|
||||
|
||||
module Internal = struct
|
||||
let enter_span' ?(parent_span : Trace.span option) ~__FUNCTION__ ~__FILE__
|
||||
|
|
|
|||
|
|
@ -19,12 +19,26 @@
|
|||
module Otel := Opentelemetry
|
||||
module Otrace := Trace_core
|
||||
|
||||
type Otrace.extension_event +=
|
||||
| Ev_link_span of Otrace.span * Otrace.span
|
||||
(** Link the two spans together. Both must be currently active spans. *)
|
||||
| Ev_set_span_kind of Otrace.span * Otel.Span_kind.t
|
||||
| Ev_record_exn of Otrace.span * exn * Printexc.raw_backtrace
|
||||
(** Record exception and potentially turn span to an error *)
|
||||
module Extensions : sig
|
||||
type span_info
|
||||
|
||||
val scope_of_span_info : span_info -> Otel.Scope.t
|
||||
|
||||
type Otrace.span += Span_otel of span_info
|
||||
|
||||
type Otrace.extension_event +=
|
||||
| Ev_link_span of Otrace.span * Otrace.span
|
||||
(** Link the two spans together. Both must be currently active spans.
|
||||
*)
|
||||
| Ev_record_exn of Otrace.span * exn * Printexc.raw_backtrace
|
||||
| Ev_set_span_kind of Otrace.span * Otel.Span_kind.t
|
||||
(** Record exception and potentially turn span to an error *)
|
||||
|
||||
type Otrace.metric +=
|
||||
| Metric_hist of Opentelemetry_proto.Metrics.histogram_data_point
|
||||
| Metric_sum_int of int
|
||||
| Metric_sum_float of float
|
||||
end
|
||||
|
||||
val on_internal_error : (string -> unit) ref
|
||||
(** Callback to print errors in the library itself (ie bugs) *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue