package opentelemetry

  1. Overview
  2. Docs

Source file metrics_types.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
[@@@ocaml.warning "-27-30-39"]


type exemplar_value =
  | As_double of float
  | As_int of int64

and exemplar = {
  filtered_attributes : Common_types.key_value list;
  time_unix_nano : int64;
  value : exemplar_value;
  span_id : bytes;
  trace_id : bytes;
}

type number_data_point_value =
  | As_double of float
  | As_int of int64

and number_data_point = {
  attributes : Common_types.key_value list;
  start_time_unix_nano : int64;
  time_unix_nano : int64;
  value : number_data_point_value;
  exemplars : exemplar list;
  flags : int32;
}

type gauge = {
  data_points : number_data_point list;
}

type aggregation_temporality =
  | Aggregation_temporality_unspecified 
  | Aggregation_temporality_delta 
  | Aggregation_temporality_cumulative 

type sum = {
  data_points : number_data_point list;
  aggregation_temporality : aggregation_temporality;
  is_monotonic : bool;
}

type histogram_data_point = {
  attributes : Common_types.key_value list;
  start_time_unix_nano : int64;
  time_unix_nano : int64;
  count : int64;
  sum : float;
  bucket_counts : int64 list;
  explicit_bounds : float list;
  exemplars : exemplar list;
  flags : int32;
}

type histogram = {
  data_points : histogram_data_point list;
  aggregation_temporality : aggregation_temporality;
}

type exponential_histogram_data_point_buckets = {
  offset : int32;
  bucket_counts : int64 list;
}

type exponential_histogram_data_point = {
  attributes : Common_types.key_value list;
  start_time_unix_nano : int64;
  time_unix_nano : int64;
  count : int64;
  sum : float;
  scale : int32;
  zero_count : int64;
  positive : exponential_histogram_data_point_buckets option;
  negative : exponential_histogram_data_point_buckets option;
  flags : int32;
  exemplars : exemplar list;
}

type exponential_histogram = {
  data_points : exponential_histogram_data_point list;
  aggregation_temporality : aggregation_temporality;
}

type summary_data_point_value_at_quantile = {
  quantile : float;
  value : float;
}

type summary_data_point = {
  attributes : Common_types.key_value list;
  start_time_unix_nano : int64;
  time_unix_nano : int64;
  count : int64;
  sum : float;
  quantile_values : summary_data_point_value_at_quantile list;
  flags : int32;
}

type summary = {
  data_points : summary_data_point list;
}

type metric_data =
  | Gauge of gauge
  | Sum of sum
  | Histogram of histogram
  | Exponential_histogram of exponential_histogram
  | Summary of summary

and metric = {
  name : string;
  description : string;
  unit_ : string;
  data : metric_data;
}

type instrumentation_library_metrics = {
  instrumentation_library : Common_types.instrumentation_library option;
  metrics : metric list;
  schema_url : string;
}

type resource_metrics = {
  resource : Resource_types.resource option;
  instrumentation_library_metrics : instrumentation_library_metrics list;
  schema_url : string;
}

type metrics_data = {
  resource_metrics : resource_metrics list;
}

type data_point_flags =
  | Flag_none 
  | Flag_no_recorded_value 

let rec default_exemplar_value () : exemplar_value = As_double (0.)

and default_exemplar 
  ?filtered_attributes:((filtered_attributes:Common_types.key_value list) = [])
  ?time_unix_nano:((time_unix_nano:int64) = 0L)
  ?value:((value:exemplar_value) = As_double (0.))
  ?span_id:((span_id:bytes) = Bytes.create 0)
  ?trace_id:((trace_id:bytes) = Bytes.create 0)
  () : exemplar  = {
  filtered_attributes;
  time_unix_nano;
  value;
  span_id;
  trace_id;
}

let rec default_number_data_point_value () : number_data_point_value = As_double (0.)

and default_number_data_point 
  ?attributes:((attributes:Common_types.key_value list) = [])
  ?start_time_unix_nano:((start_time_unix_nano:int64) = 0L)
  ?time_unix_nano:((time_unix_nano:int64) = 0L)
  ?value:((value:number_data_point_value) = As_double (0.))
  ?exemplars:((exemplars:exemplar list) = [])
  ?flags:((flags:int32) = 0l)
  () : number_data_point  = {
  attributes;
  start_time_unix_nano;
  time_unix_nano;
  value;
  exemplars;
  flags;
}

let rec default_gauge 
  ?data_points:((data_points:number_data_point list) = [])
  () : gauge  = {
  data_points;
}

let rec default_aggregation_temporality () = (Aggregation_temporality_unspecified:aggregation_temporality)

let rec default_sum 
  ?data_points:((data_points:number_data_point list) = [])
  ?aggregation_temporality:((aggregation_temporality:aggregation_temporality) = default_aggregation_temporality ())
  ?is_monotonic:((is_monotonic:bool) = false)
  () : sum  = {
  data_points;
  aggregation_temporality;
  is_monotonic;
}

let rec default_histogram_data_point 
  ?attributes:((attributes:Common_types.key_value list) = [])
  ?start_time_unix_nano:((start_time_unix_nano:int64) = 0L)
  ?time_unix_nano:((time_unix_nano:int64) = 0L)
  ?count:((count:int64) = 0L)
  ?sum:((sum:float) = 0.)
  ?bucket_counts:((bucket_counts:int64 list) = [])
  ?explicit_bounds:((explicit_bounds:float list) = [])
  ?exemplars:((exemplars:exemplar list) = [])
  ?flags:((flags:int32) = 0l)
  () : histogram_data_point  = {
  attributes;
  start_time_unix_nano;
  time_unix_nano;
  count;
  sum;
  bucket_counts;
  explicit_bounds;
  exemplars;
  flags;
}

let rec default_histogram 
  ?data_points:((data_points:histogram_data_point list) = [])
  ?aggregation_temporality:((aggregation_temporality:aggregation_temporality) = default_aggregation_temporality ())
  () : histogram  = {
  data_points;
  aggregation_temporality;
}

let rec default_exponential_histogram_data_point_buckets 
  ?offset:((offset:int32) = 0l)
  ?bucket_counts:((bucket_counts:int64 list) = [])
  () : exponential_histogram_data_point_buckets  = {
  offset;
  bucket_counts;
}

let rec default_exponential_histogram_data_point 
  ?attributes:((attributes:Common_types.key_value list) = [])
  ?start_time_unix_nano:((start_time_unix_nano:int64) = 0L)
  ?time_unix_nano:((time_unix_nano:int64) = 0L)
  ?count:((count:int64) = 0L)
  ?sum:((sum:float) = 0.)
  ?scale:((scale:int32) = 0l)
  ?zero_count:((zero_count:int64) = 0L)
  ?positive:((positive:exponential_histogram_data_point_buckets option) = None)
  ?negative:((negative:exponential_histogram_data_point_buckets option) = None)
  ?flags:((flags:int32) = 0l)
  ?exemplars:((exemplars:exemplar list) = [])
  () : exponential_histogram_data_point  = {
  attributes;
  start_time_unix_nano;
  time_unix_nano;
  count;
  sum;
  scale;
  zero_count;
  positive;
  negative;
  flags;
  exemplars;
}

let rec default_exponential_histogram 
  ?data_points:((data_points:exponential_histogram_data_point list) = [])
  ?aggregation_temporality:((aggregation_temporality:aggregation_temporality) = default_aggregation_temporality ())
  () : exponential_histogram  = {
  data_points;
  aggregation_temporality;
}

let rec default_summary_data_point_value_at_quantile 
  ?quantile:((quantile:float) = 0.)
  ?value:((value:float) = 0.)
  () : summary_data_point_value_at_quantile  = {
  quantile;
  value;
}

let rec default_summary_data_point 
  ?attributes:((attributes:Common_types.key_value list) = [])
  ?start_time_unix_nano:((start_time_unix_nano:int64) = 0L)
  ?time_unix_nano:((time_unix_nano:int64) = 0L)
  ?count:((count:int64) = 0L)
  ?sum:((sum:float) = 0.)
  ?quantile_values:((quantile_values:summary_data_point_value_at_quantile list) = [])
  ?flags:((flags:int32) = 0l)
  () : summary_data_point  = {
  attributes;
  start_time_unix_nano;
  time_unix_nano;
  count;
  sum;
  quantile_values;
  flags;
}

let rec default_summary 
  ?data_points:((data_points:summary_data_point list) = [])
  () : summary  = {
  data_points;
}

let rec default_metric_data () : metric_data = Gauge (default_gauge ())

and default_metric 
  ?name:((name:string) = "")
  ?description:((description:string) = "")
  ?unit_:((unit_:string) = "")
  ?data:((data:metric_data) = Gauge (default_gauge ()))
  () : metric  = {
  name;
  description;
  unit_;
  data;
}

let rec default_instrumentation_library_metrics 
  ?instrumentation_library:((instrumentation_library:Common_types.instrumentation_library option) = None)
  ?metrics:((metrics:metric list) = [])
  ?schema_url:((schema_url:string) = "")
  () : instrumentation_library_metrics  = {
  instrumentation_library;
  metrics;
  schema_url;
}

let rec default_resource_metrics 
  ?resource:((resource:Resource_types.resource option) = None)
  ?instrumentation_library_metrics:((instrumentation_library_metrics:instrumentation_library_metrics list) = [])
  ?schema_url:((schema_url:string) = "")
  () : resource_metrics  = {
  resource;
  instrumentation_library_metrics;
  schema_url;
}

let rec default_metrics_data 
  ?resource_metrics:((resource_metrics:resource_metrics list) = [])
  () : metrics_data  = {
  resource_metrics;
}

let rec default_data_point_flags () = (Flag_none:data_point_flags)
OCaml

Innovation. Community. Security.