Skip to content

Commit 8d57f30

Browse files
committed
udpate generated proto code
1 parent 45c035f commit 8d57f30

File tree

10 files changed

+376
-33
lines changed

10 files changed

+376
-33
lines changed

src/proto/common.ml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ type instrumentation_scope = {
3333
mutable dropped_attributes_count : int32;
3434
}
3535

36+
type entity_ref = {
37+
mutable _presence: Pbrt.Bitfield.t;
38+
(** tracking presence for 2 fields *)
39+
mutable schema_url : string;
40+
mutable type_ : string;
41+
mutable id_keys : string list;
42+
mutable description_keys : string list;
43+
}
44+
3645
let default_any_value (): any_value = String_value ("")
3746

3847
let default_array_value (): array_value =
@@ -61,6 +70,15 @@ let default_instrumentation_scope (): instrumentation_scope =
6170
dropped_attributes_count=0l;
6271
}
6372

73+
let default_entity_ref (): entity_ref =
74+
{
75+
_presence=Pbrt.Bitfield.empty;
76+
schema_url="";
77+
type_="";
78+
id_keys=[];
79+
description_keys=[];
80+
}
81+
6482

6583
(** {2 Make functions} *)
6684

@@ -151,6 +169,38 @@ let make_instrumentation_scope
151169
| Some v -> set_instrumentation_scope_dropped_attributes_count _res v);
152170
_res
153171

172+
let[@inline] has_entity_ref_schema_url (self:entity_ref) : bool = (Pbrt.Bitfield.get self._presence 0)
173+
let[@inline] has_entity_ref_type_ (self:entity_ref) : bool = (Pbrt.Bitfield.get self._presence 1)
174+
175+
let[@inline] set_entity_ref_schema_url (self:entity_ref) (x:string) : unit =
176+
self._presence <- (Pbrt.Bitfield.set self._presence 0); self.schema_url <- x
177+
let[@inline] set_entity_ref_type_ (self:entity_ref) (x:string) : unit =
178+
self._presence <- (Pbrt.Bitfield.set self._presence 1); self.type_ <- x
179+
let[@inline] set_entity_ref_id_keys (self:entity_ref) (x:string list) : unit =
180+
self.id_keys <- x
181+
let[@inline] set_entity_ref_description_keys (self:entity_ref) (x:string list) : unit =
182+
self.description_keys <- x
183+
184+
let copy_entity_ref (self:entity_ref) : entity_ref =
185+
{ self with schema_url = self.schema_url }
186+
187+
let make_entity_ref
188+
?(schema_url:string option)
189+
?(type_:string option)
190+
~(id_keys:string list)
191+
~(description_keys:string list)
192+
() : entity_ref =
193+
let _res = default_entity_ref () in
194+
(match schema_url with
195+
| None -> ()
196+
| Some v -> set_entity_ref_schema_url _res v);
197+
(match type_ with
198+
| None -> ()
199+
| Some v -> set_entity_ref_type_ _res v);
200+
set_entity_ref_id_keys _res id_keys;
201+
set_entity_ref_description_keys _res description_keys;
202+
_res
203+
154204
[@@@ocaml.warning "-23-27-30-39"]
155205

156206
(** {2 Formatters} *)
@@ -197,6 +247,17 @@ let rec pp_instrumentation_scope fmt (v:instrumentation_scope) =
197247
in
198248
Pbrt.Pp.pp_brk pp_i fmt ()
199249

250+
let rec pp_entity_ref fmt (v:entity_ref) =
251+
let pp_i fmt () =
252+
Pbrt.Pp.pp_record_field ~first:true "schema_url" Pbrt.Pp.pp_string fmt v.schema_url;
253+
if not (Pbrt.Bitfield.get v._presence 0) then Format.pp_print_string fmt "(* absent *)";
254+
Pbrt.Pp.pp_record_field ~first:false "type_" Pbrt.Pp.pp_string fmt v.type_;
255+
if not (Pbrt.Bitfield.get v._presence 1) then Format.pp_print_string fmt "(* absent *)";
256+
Pbrt.Pp.pp_record_field ~first:false "id_keys" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.id_keys;
257+
Pbrt.Pp.pp_record_field ~first:false "description_keys" (Pbrt.Pp.pp_list Pbrt.Pp.pp_string) fmt v.description_keys;
258+
in
259+
Pbrt.Pp.pp_brk pp_i fmt ()
260+
200261
[@@@ocaml.warning "-23-27-30-39"]
201262

202263
(** {2 Protobuf Encoding} *)
@@ -272,6 +333,25 @@ let rec encode_pb_instrumentation_scope (v:instrumentation_scope) encoder =
272333
);
273334
()
274335

336+
let rec encode_pb_entity_ref (v:entity_ref) encoder =
337+
if (Pbrt.Bitfield.get v._presence 0) then (
338+
Pbrt.Encoder.string v.schema_url encoder;
339+
Pbrt.Encoder.key 1 Pbrt.Bytes encoder;
340+
);
341+
if (Pbrt.Bitfield.get v._presence 1) then (
342+
Pbrt.Encoder.string v.type_ encoder;
343+
Pbrt.Encoder.key 2 Pbrt.Bytes encoder;
344+
);
345+
Pbrt.List_util.rev_iter_with (fun x encoder ->
346+
Pbrt.Encoder.string x encoder;
347+
Pbrt.Encoder.key 3 Pbrt.Bytes encoder;
348+
) v.id_keys encoder;
349+
Pbrt.List_util.rev_iter_with (fun x encoder ->
350+
Pbrt.Encoder.string x encoder;
351+
Pbrt.Encoder.key 4 Pbrt.Bytes encoder;
352+
) v.description_keys encoder;
353+
()
354+
275355
[@@@ocaml.warning "-23-27-30-39"]
276356

277357
(** {2 Protobuf Decoding} *)
@@ -385,3 +465,37 @@ let rec decode_pb_instrumentation_scope d =
385465
| Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
386466
done;
387467
(v : instrumentation_scope)
468+
469+
let rec decode_pb_entity_ref d =
470+
let v = default_entity_ref () in
471+
let continue__= ref true in
472+
while !continue__ do
473+
match Pbrt.Decoder.key d with
474+
| None -> (
475+
(* put lists in the correct order *)
476+
set_entity_ref_description_keys v (List.rev v.description_keys);
477+
set_entity_ref_id_keys v (List.rev v.id_keys);
478+
); continue__ := false
479+
| Some (1, Pbrt.Bytes) -> begin
480+
set_entity_ref_schema_url v (Pbrt.Decoder.string d);
481+
end
482+
| Some (1, pk) ->
483+
Pbrt.Decoder.unexpected_payload "Message(entity_ref), field(1)" pk
484+
| Some (2, Pbrt.Bytes) -> begin
485+
set_entity_ref_type_ v (Pbrt.Decoder.string d);
486+
end
487+
| Some (2, pk) ->
488+
Pbrt.Decoder.unexpected_payload "Message(entity_ref), field(2)" pk
489+
| Some (3, Pbrt.Bytes) -> begin
490+
set_entity_ref_id_keys v ((Pbrt.Decoder.string d) :: v.id_keys);
491+
end
492+
| Some (3, pk) ->
493+
Pbrt.Decoder.unexpected_payload "Message(entity_ref), field(3)" pk
494+
| Some (4, Pbrt.Bytes) -> begin
495+
set_entity_ref_description_keys v ((Pbrt.Decoder.string d) :: v.description_keys);
496+
end
497+
| Some (4, pk) ->
498+
Pbrt.Decoder.unexpected_payload "Message(entity_ref), field(4)" pk
499+
| Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
500+
done;
501+
(v : entity_ref)

src/proto/common.mli

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ type instrumentation_scope = private {
4040
mutable dropped_attributes_count : int32;
4141
}
4242

43+
type entity_ref = private {
44+
mutable _presence: Pbrt.Bitfield.t;
45+
(** tracking presence for 2 fields *)
46+
mutable schema_url : string;
47+
mutable type_ : string;
48+
mutable id_keys : string list;
49+
mutable description_keys : string list;
50+
}
51+
4352

4453
(** {2 Basic values} *)
4554

@@ -58,6 +67,9 @@ val default_key_value : unit -> key_value
5867
val default_instrumentation_scope : unit -> instrumentation_scope
5968
(** [default_instrumentation_scope ()] is a new empty value for type [instrumentation_scope] *)
6069

70+
val default_entity_ref : unit -> entity_ref
71+
(** [default_entity_ref ()] is a new empty value for type [entity_ref] *)
72+
6173

6274
(** {2 Make functions} *)
6375

@@ -134,6 +146,35 @@ val has_instrumentation_scope_dropped_attributes_count : instrumentation_scope -
134146
val set_instrumentation_scope_dropped_attributes_count : instrumentation_scope -> int32 -> unit
135147
(** set field dropped_attributes_count in instrumentation_scope *)
136148

149+
val make_entity_ref :
150+
?schema_url:string ->
151+
?type_:string ->
152+
id_keys:string list ->
153+
description_keys:string list ->
154+
unit ->
155+
entity_ref
156+
(** [make_entity_ref … ()] is a builder for type [entity_ref] *)
157+
158+
val copy_entity_ref : entity_ref -> entity_ref
159+
160+
val has_entity_ref_schema_url : entity_ref -> bool
161+
(** presence of field "schema_url" in [entity_ref] *)
162+
163+
val set_entity_ref_schema_url : entity_ref -> string -> unit
164+
(** set field schema_url in entity_ref *)
165+
166+
val has_entity_ref_type_ : entity_ref -> bool
167+
(** presence of field "type_" in [entity_ref] *)
168+
169+
val set_entity_ref_type_ : entity_ref -> string -> unit
170+
(** set field type_ in entity_ref *)
171+
172+
val set_entity_ref_id_keys : entity_ref -> string list -> unit
173+
(** set field id_keys in entity_ref *)
174+
175+
val set_entity_ref_description_keys : entity_ref -> string list -> unit
176+
(** set field description_keys in entity_ref *)
177+
137178

138179
(** {2 Formatters} *)
139180

@@ -152,6 +193,9 @@ val pp_key_value : Format.formatter -> key_value -> unit
152193
val pp_instrumentation_scope : Format.formatter -> instrumentation_scope -> unit
153194
(** [pp_instrumentation_scope v] formats v *)
154195

196+
val pp_entity_ref : Format.formatter -> entity_ref -> unit
197+
(** [pp_entity_ref v] formats v *)
198+
155199

156200
(** {2 Protobuf Encoding} *)
157201

@@ -170,6 +214,9 @@ val encode_pb_key_value : key_value -> Pbrt.Encoder.t -> unit
170214
val encode_pb_instrumentation_scope : instrumentation_scope -> Pbrt.Encoder.t -> unit
171215
(** [encode_pb_instrumentation_scope v encoder] encodes [v] with the given [encoder] *)
172216

217+
val encode_pb_entity_ref : entity_ref -> Pbrt.Encoder.t -> unit
218+
(** [encode_pb_entity_ref v encoder] encodes [v] with the given [encoder] *)
219+
173220

174221
(** {2 Protobuf Decoding} *)
175222

@@ -187,3 +234,6 @@ val decode_pb_key_value : Pbrt.Decoder.t -> key_value
187234

188235
val decode_pb_instrumentation_scope : Pbrt.Decoder.t -> instrumentation_scope
189236
(** [decode_pb_instrumentation_scope decoder] decodes a [instrumentation_scope] binary value from [decoder] *)
237+
238+
val decode_pb_entity_ref : Pbrt.Decoder.t -> entity_ref
239+
(** [decode_pb_entity_ref decoder] decodes a [entity_ref] binary value from [decoder] *)

src/proto/logs.ml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type severity_number =
2929

3030
type log_record = {
3131
mutable _presence: Pbrt.Bitfield.t;
32-
(** tracking presence for 8 fields *)
32+
(** tracking presence for 9 fields *)
3333
mutable time_unix_nano : int64;
3434
mutable observed_time_unix_nano : int64;
3535
mutable severity_number : severity_number;
@@ -40,6 +40,7 @@ type log_record = {
4040
mutable flags : int32;
4141
mutable trace_id : bytes;
4242
mutable span_id : bytes;
43+
mutable event_name : string;
4344
}
4445

4546
type scope_logs = {
@@ -81,6 +82,7 @@ let default_log_record (): log_record =
8182
flags=0l;
8283
trace_id=Bytes.create 0;
8384
span_id=Bytes.create 0;
85+
event_name="";
8486
}
8587

8688
let default_scope_logs (): scope_logs =
@@ -118,6 +120,7 @@ let[@inline] has_log_record_dropped_attributes_count (self:log_record) : bool =
118120
let[@inline] has_log_record_flags (self:log_record) : bool = (Pbrt.Bitfield.get self._presence 5)
119121
let[@inline] has_log_record_trace_id (self:log_record) : bool = (Pbrt.Bitfield.get self._presence 6)
120122
let[@inline] has_log_record_span_id (self:log_record) : bool = (Pbrt.Bitfield.get self._presence 7)
123+
let[@inline] has_log_record_event_name (self:log_record) : bool = (Pbrt.Bitfield.get self._presence 8)
121124

122125
let[@inline] set_log_record_time_unix_nano (self:log_record) (x:int64) : unit =
123126
self._presence <- (Pbrt.Bitfield.set self._presence 0); self.time_unix_nano <- x
@@ -139,6 +142,8 @@ let[@inline] set_log_record_trace_id (self:log_record) (x:bytes) : unit =
139142
self._presence <- (Pbrt.Bitfield.set self._presence 6); self.trace_id <- x
140143
let[@inline] set_log_record_span_id (self:log_record) (x:bytes) : unit =
141144
self._presence <- (Pbrt.Bitfield.set self._presence 7); self.span_id <- x
145+
let[@inline] set_log_record_event_name (self:log_record) (x:string) : unit =
146+
self._presence <- (Pbrt.Bitfield.set self._presence 8); self.event_name <- x
142147

143148
let copy_log_record (self:log_record) : log_record =
144149
{ self with time_unix_nano = self.time_unix_nano }
@@ -154,6 +159,7 @@ let make_log_record
154159
?(flags:int32 option)
155160
?(trace_id:bytes option)
156161
?(span_id:bytes option)
162+
?(event_name:string option)
157163
() : log_record =
158164
let _res = default_log_record () in
159165
(match time_unix_nano with
@@ -184,6 +190,9 @@ let make_log_record
184190
(match span_id with
185191
| None -> ()
186192
| Some v -> set_log_record_span_id _res v);
193+
(match event_name with
194+
| None -> ()
195+
| Some v -> set_log_record_event_name _res v);
187196
_res
188197

189198
let[@inline] has_scope_logs_schema_url (self:scope_logs) : bool = (Pbrt.Bitfield.get self._presence 0)
@@ -307,6 +316,8 @@ let rec pp_log_record fmt (v:log_record) =
307316
if not (Pbrt.Bitfield.get v._presence 6) then Format.pp_print_string fmt "(* absent *)";
308317
Pbrt.Pp.pp_record_field ~first:false "span_id" Pbrt.Pp.pp_bytes fmt v.span_id;
309318
if not (Pbrt.Bitfield.get v._presence 7) then Format.pp_print_string fmt "(* absent *)";
319+
Pbrt.Pp.pp_record_field ~first:false "event_name" Pbrt.Pp.pp_string fmt v.event_name;
320+
if not (Pbrt.Bitfield.get v._presence 8) then Format.pp_print_string fmt "(* absent *)";
310321
in
311322
Pbrt.Pp.pp_brk pp_i fmt ()
312323

@@ -414,6 +425,10 @@ let rec encode_pb_log_record (v:log_record) encoder =
414425
Pbrt.Encoder.bytes v.span_id encoder;
415426
Pbrt.Encoder.key 10 Pbrt.Bytes encoder;
416427
);
428+
if (Pbrt.Bitfield.get v._presence 8) then (
429+
Pbrt.Encoder.string v.event_name encoder;
430+
Pbrt.Encoder.key 12 Pbrt.Bytes encoder;
431+
);
417432
()
418433

419434
let rec encode_pb_scope_logs (v:scope_logs) encoder =
@@ -554,6 +569,11 @@ let rec decode_pb_log_record d =
554569
end
555570
| Some (10, pk) ->
556571
Pbrt.Decoder.unexpected_payload "Message(log_record), field(10)" pk
572+
| Some (12, Pbrt.Bytes) -> begin
573+
set_log_record_event_name v (Pbrt.Decoder.string d);
574+
end
575+
| Some (12, pk) ->
576+
Pbrt.Decoder.unexpected_payload "Message(log_record), field(12)" pk
557577
| Some (_, payload_kind) -> Pbrt.Decoder.skip d payload_kind
558578
done;
559579
(v : log_record)

src/proto/logs.mli

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type severity_number =
3636

3737
type log_record = private {
3838
mutable _presence: Pbrt.Bitfield.t;
39-
(** tracking presence for 8 fields *)
39+
(** tracking presence for 9 fields *)
4040
mutable time_unix_nano : int64;
4141
mutable observed_time_unix_nano : int64;
4242
mutable severity_number : severity_number;
@@ -47,6 +47,7 @@ type log_record = private {
4747
mutable flags : int32;
4848
mutable trace_id : bytes;
4949
mutable span_id : bytes;
50+
mutable event_name : string;
5051
}
5152

5253
type scope_logs = private {
@@ -109,6 +110,7 @@ val make_log_record :
109110
?flags:int32 ->
110111
?trace_id:bytes ->
111112
?span_id:bytes ->
113+
?event_name:string ->
112114
unit ->
113115
log_record
114116
(** [make_log_record … ()] is a builder for type [log_record] *)
@@ -169,6 +171,12 @@ val has_log_record_span_id : log_record -> bool
169171
val set_log_record_span_id : log_record -> bytes -> unit
170172
(** set field span_id in log_record *)
171173

174+
val has_log_record_event_name : log_record -> bool
175+
(** presence of field "event_name" in [log_record] *)
176+
177+
val set_log_record_event_name : log_record -> string -> unit
178+
(** set field event_name in log_record *)
179+
172180
val make_scope_logs :
173181
?scope:Common.instrumentation_scope ->
174182
log_records:log_record list ->

0 commit comments

Comments
 (0)