package opentelemetry
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Core library for instrumentation and serialization for https://opentelemetry.io
Install
dune-project
Dependency
Authors
Maintainers
Sources
opentelemetry-0.90.tbz
sha256=c3989bb678f57e5276209d3c60afb29cdca33122288de55e591fbbe2e50a662c
sha512=ba8339256c9b2d8c99c8304991a3047f280a01e492add4cf82bf1d43dfa51e790366c09c6901c0501b8b8e1f810c6e128e33dd33542d785013407f642ade4eea
doc/src/opentelemetry.proto/status.ml.html
Source file status.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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158[@@@ocaml.warning "-23-27-30-39-44"] type status = { mutable _presence: Pbrt.Bitfield.t; (** presence for 2 fields *) mutable code : int32; mutable message : bytes; mutable details : bytes list; } let default_status (): status = { _presence=Pbrt.Bitfield.empty; code=0l; message=Bytes.create 0; details=[]; } (** {2 Make functions} *) let[@inline] status_has_code (self:status) : bool = (Pbrt.Bitfield.get self._presence 0) let[@inline] status_has_message (self:status) : bool = (Pbrt.Bitfield.get self._presence 1) let[@inline] status_set_code (self:status) (x:int32) : unit = self._presence <- (Pbrt.Bitfield.set self._presence 0); self.code <- x let[@inline] status_set_message (self:status) (x:bytes) : unit = self._presence <- (Pbrt.Bitfield.set self._presence 1); self.message <- x let[@inline] status_set_details (self:status) (x:bytes list) : unit = self.details <- x let copy_status (self:status) : status = { self with code = self.code } let make_status ?(code:int32 option) ?(message:bytes option) ?(details=[]) () : status = let _res = default_status () in (match code with | None -> () | Some v -> status_set_code _res v); (match message with | None -> () | Some v -> status_set_message _res v); status_set_details _res details; _res [@@@ocaml.warning "-23-27-30-39"] (** {2 Formatters} *) let rec pp_status fmt (v:status) = let pp_i fmt () = Pbrt.Pp.pp_record_field ~absent:(not (status_has_code v)) ~first:true "code" Pbrt.Pp.pp_int32 fmt v.code; Pbrt.Pp.pp_record_field ~absent:(not (status_has_message v)) ~first:false "message" Pbrt.Pp.pp_bytes fmt v.message; Pbrt.Pp.pp_record_field ~first:false "details" (Pbrt.Pp.pp_list Pbrt.Pp.pp_bytes) fmt v.details; in Pbrt.Pp.pp_brk pp_i fmt () [@@@ocaml.warning "-23-27-30-39"] (** {2 Protobuf Encoding} *) let rec encode_pb_status (v:status) encoder = if status_has_code v then ( Pbrt.Encoder.int32_as_varint v.code encoder; Pbrt.Encoder.key 1 Pbrt.Varint encoder; ); if status_has_message v then ( Pbrt.Encoder.bytes v.message encoder; Pbrt.Encoder.key 2 Pbrt.Bytes encoder; ); Pbrt.List_util.rev_iter_with (fun x encoder -> Pbrt.Encoder.bytes x encoder; Pbrt.Encoder.key 3 Pbrt.Bytes encoder; ) v.details encoder; () [@@@ocaml.warning "-23-27-30-39"] (** {2 Protobuf Decoding} *) let rec decode_pb_status d = let v = default_status () in let continue__= ref true in while !continue__ do match Pbrt.Decoder.key d with | None -> ( (* put lists in the correct order *) status_set_details v (List.rev v.details); ); continue__ := false | Some (1, Pbrt.Varint) -> begin status_set_code v (Pbrt.Decoder.int32_as_varint d); end | Some (1, pk) -> Pbrt.Decoder.unexpected_payload_message "status" 1 pk | Some (2, Pbrt.Bytes) -> begin status_set_message v (Pbrt.Decoder.bytes d); end | Some (2, pk) -> Pbrt.Decoder.unexpected_payload_message "status" 2 pk | Some (3, Pbrt.Bytes) -> begin status_set_details v ((Pbrt.Decoder.bytes d) :: v.details); end | Some (3, pk) -> Pbrt.Decoder.unexpected_payload_message "status" 3 pk | Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind done; (v : status) [@@@ocaml.warning "-23-27-30-39"] (** {2 Protobuf YoJson Encoding} *) let rec encode_json_status (v:status) = let assoc = ref [] in if status_has_code v then ( assoc := ("code", Pbrt_yojson.make_int (Int32.to_int v.code)) :: !assoc; ); if status_has_message v then ( assoc := ("message", Pbrt_yojson.make_bytes v.message) :: !assoc; ); assoc := ( let l = v.details |> List.map Pbrt_yojson.make_bytes in ("details", `List l) :: !assoc ); `Assoc !assoc [@@@ocaml.warning "-23-27-30-39"] (** {2 JSON Decoding} *) let rec decode_json_status d = let v = default_status () in let assoc = match d with | `Assoc assoc -> assoc | _ -> assert(false) in List.iter (function | ("code", json_value) -> status_set_code v (Pbrt_yojson.int32 json_value "status" "code") | ("message", json_value) -> status_set_message v (Pbrt_yojson.bytes json_value "status" "message") | ("details", `List l) -> begin status_set_details v @@ List.map (function | json_value -> Pbrt_yojson.bytes json_value "status" "details" ) l; end | (_, _) -> () (*Unknown fields are ignored*) ) assoc; ({ _presence = v._presence; code = v.code; message = v.message; details = v.details; } : status)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>