package opentelemetry

  1. Overview
  2. Docs

Source file trace_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
[@@@ocaml.warning "-27-30-39"]


type span_span_kind =
  | Span_kind_unspecified 
  | Span_kind_internal 
  | Span_kind_server 
  | Span_kind_client 
  | Span_kind_producer 
  | Span_kind_consumer 

type span_event = {
  time_unix_nano : int64;
  name : string;
  attributes : Common_types.key_value list;
  dropped_attributes_count : int32;
}

type span_link = {
  trace_id : bytes;
  span_id : bytes;
  trace_state : string;
  attributes : Common_types.key_value list;
  dropped_attributes_count : int32;
}

type status_status_code =
  | Status_code_unset 
  | Status_code_ok 
  | Status_code_error 

type status = {
  message : string;
  code : status_status_code;
}

type span = {
  trace_id : bytes;
  span_id : bytes;
  trace_state : string;
  parent_span_id : bytes;
  name : string;
  kind : span_span_kind;
  start_time_unix_nano : int64;
  end_time_unix_nano : int64;
  attributes : Common_types.key_value list;
  dropped_attributes_count : int32;
  events : span_event list;
  dropped_events_count : int32;
  links : span_link list;
  dropped_links_count : int32;
  status : status option;
}

type scope_spans = {
  scope : Common_types.instrumentation_scope option;
  spans : span list;
  schema_url : string;
}

type resource_spans = {
  resource : Resource_types.resource option;
  scope_spans : scope_spans list;
  schema_url : string;
}

type traces_data = {
  resource_spans : resource_spans list;
}

let rec default_span_span_kind () = (Span_kind_unspecified:span_span_kind)

let rec default_span_event 
  ?time_unix_nano:((time_unix_nano:int64) = 0L)
  ?name:((name:string) = "")
  ?attributes:((attributes:Common_types.key_value list) = [])
  ?dropped_attributes_count:((dropped_attributes_count:int32) = 0l)
  () : span_event  = {
  time_unix_nano;
  name;
  attributes;
  dropped_attributes_count;
}

let rec default_span_link 
  ?trace_id:((trace_id:bytes) = Bytes.create 0)
  ?span_id:((span_id:bytes) = Bytes.create 0)
  ?trace_state:((trace_state:string) = "")
  ?attributes:((attributes:Common_types.key_value list) = [])
  ?dropped_attributes_count:((dropped_attributes_count:int32) = 0l)
  () : span_link  = {
  trace_id;
  span_id;
  trace_state;
  attributes;
  dropped_attributes_count;
}

let rec default_status_status_code () = (Status_code_unset:status_status_code)

let rec default_status 
  ?message:((message:string) = "")
  ?code:((code:status_status_code) = default_status_status_code ())
  () : status  = {
  message;
  code;
}

let rec default_span 
  ?trace_id:((trace_id:bytes) = Bytes.create 0)
  ?span_id:((span_id:bytes) = Bytes.create 0)
  ?trace_state:((trace_state:string) = "")
  ?parent_span_id:((parent_span_id:bytes) = Bytes.create 0)
  ?name:((name:string) = "")
  ?kind:((kind:span_span_kind) = default_span_span_kind ())
  ?start_time_unix_nano:((start_time_unix_nano:int64) = 0L)
  ?end_time_unix_nano:((end_time_unix_nano:int64) = 0L)
  ?attributes:((attributes:Common_types.key_value list) = [])
  ?dropped_attributes_count:((dropped_attributes_count:int32) = 0l)
  ?events:((events:span_event list) = [])
  ?dropped_events_count:((dropped_events_count:int32) = 0l)
  ?links:((links:span_link list) = [])
  ?dropped_links_count:((dropped_links_count:int32) = 0l)
  ?status:((status:status option) = None)
  () : span  = {
  trace_id;
  span_id;
  trace_state;
  parent_span_id;
  name;
  kind;
  start_time_unix_nano;
  end_time_unix_nano;
  attributes;
  dropped_attributes_count;
  events;
  dropped_events_count;
  links;
  dropped_links_count;
  status;
}

let rec default_scope_spans 
  ?scope:((scope:Common_types.instrumentation_scope option) = None)
  ?spans:((spans:span list) = [])
  ?schema_url:((schema_url:string) = "")
  () : scope_spans  = {
  scope;
  spans;
  schema_url;
}

let rec default_resource_spans 
  ?resource:((resource:Resource_types.resource option) = None)
  ?scope_spans:((scope_spans:scope_spans list) = [])
  ?schema_url:((schema_url:string) = "")
  () : resource_spans  = {
  resource;
  scope_spans;
  schema_url;
}

let rec default_traces_data 
  ?resource_spans:((resource_spans:resource_spans list) = [])
  () : traces_data  = {
  resource_spans;
}
OCaml

Innovation. Community. Security.