Skip to content

Commit

Permalink
feat: add dep on hmap, add standard keys
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Feb 26, 2024
1 parent 5b0bc61 commit 1cb53c3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
(ocaml
(>= "4.08"))
ptime
hmap
ambient-context
(odoc :with-doc)
(alcotest :with-test)
Expand Down
1 change: 1 addition & 0 deletions opentelemetry.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ depends: [
"dune" {>= "2.9"}
"ocaml" {>= "4.08"}
"ptime"
"hmap"
"ambient-context"
"odoc" {with-doc}
"alcotest" {with-test}
Expand Down
2 changes: 1 addition & 1 deletion src/core/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
(synopsis "API for opentelemetry instrumentation")
(flags :standard -warn-error -a+8)
(libraries opentelemetry.proto ambient-context ptime ptime.clock.os pbrt threads
opentelemetry.atomic)
opentelemetry.atomic hmap)
(public_name opentelemetry))
10 changes: 10 additions & 0 deletions src/core/opentelemetry.ml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ end = struct
let pp fmt t = Format.fprintf fmt "%s" (to_hex t)
end

(** Hmap key to carry around a {!Trace_id.t}, to remember what the current
trace is.
@since NEXT_RELEASE *)
let k_trace_id : Trace_id.t Hmap.key = Hmap.Key.create ()

(** Unique ID of a span. *)
module Span_id : sig
type t
Expand Down Expand Up @@ -479,6 +484,11 @@ end = struct
| Error msg -> invalid_arg @@ spf "invalid w3c trace context: %s" msg
end

(** Hmap key to carry around a {!Span_ctx.t}, e.g. to remember what the current
parent span is.
@since NEXT_RELEASE *)
let k_span_ctx : Span_ctx.t Hmap.key = Hmap.Key.create ()

(** {2 Attributes and conventions} *)

module Conventions = struct
Expand Down

0 comments on commit 1cb53c3

Please sign in to comment.