package opentelemetry

  1. Overview
  2. Docs
Core library for instrumentation and serialization for https://opentelemetry.io

Install

dune-project
 Dependency

Authors

Maintainers

Sources

opentelemetry-0.92.tbz
sha256=b635c486d1333cbb7276cc0075d5e01b017d4b37bd5941377ee1be07dfa25a45
sha512=2a19bf4e371ed2751e018c734ead2fd130d378ef0e018cda7b4aa3048af3e0db771fbd78d936199b34164950454bce0f3cb6211455e3647f7b7a85f4649bb22c

doc/src/opentelemetry.core/trace_flags.ml.html

Source file trace_flags.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
type t = int

let none = 0

let sampled_bit = 0x01

let random_bit = 0x02

let sampled = sampled_bit

let default = sampled_bit lor random_bit

external int_of_bool : bool -> int = "%identity"

let[@inline] make ~sampled ~random =
  int_of_bool sampled lor (int_of_bool random lsl 1)

let[@inline] of_int i = i land (sampled_bit lor random_bit)

let[@inline] to_int self = self

let[@inline] of_int32 i = of_int (Int32.to_int i)

let[@inline] to_int32 self = Int32.of_int self

let[@inline] is_sampled self = self land sampled_bit <> 0

let[@inline] is_random self = self land random_bit <> 0

let[@inline] set_ bit b self =
  if b then
    self lor bit
  else
    self land lnot bit

let[@inline] with_sampled b self = set_ sampled_bit b self

let[@inline] with_random b self = set_ random_bit b self

let pp out self = Format.fprintf out "%02x" self