bugsnag-maze-runner 6.27.0 → 7.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/download-logs +14 -16
- data/bin/maze-runner +53 -15
- data/bin/upload-app +6 -6
- data/lib/features/steps/breadcrumb_steps.rb +44 -14
- data/lib/features/steps/error_reporting_steps.rb +16 -0
- data/lib/features/steps/network_steps.rb +66 -6
- data/lib/features/steps/payload_steps.rb +23 -0
- data/lib/features/steps/request_assertion_steps.rb +87 -8
- data/lib/features/steps/runner_steps.rb +22 -0
- data/lib/features/steps/session_tracking_steps.rb +1 -1
- data/lib/features/steps/trace_steps.rb +206 -0
- data/lib/features/support/internal_hooks.rb +31 -84
- data/lib/maze/api/appium/file_manager.rb +29 -0
- data/lib/maze/aws_public_ip.rb +53 -0
- data/lib/maze/checks/assert_check.rb +9 -31
- data/lib/maze/client/appium/base_client.rb +131 -0
- data/lib/maze/client/appium/bb_client.rb +102 -0
- data/lib/maze/client/appium/bb_devices.rb +127 -0
- data/lib/maze/client/appium/bs_client.rb +91 -0
- data/lib/maze/client/appium/bs_devices.rb +141 -0
- data/lib/maze/client/appium/bs_legacy_client.rb +31 -0
- data/lib/maze/client/appium/local_client.rb +67 -0
- data/lib/maze/client/appium.rb +23 -0
- data/lib/maze/client/bb_api_client.rb +102 -0
- data/lib/maze/client/bb_client_utils.rb +181 -0
- data/lib/maze/client/bs_client_utils.rb +168 -0
- data/lib/maze/client/selenium/base_client.rb +15 -0
- data/lib/maze/client/selenium/bb_browsers.yml +188 -0
- data/lib/maze/client/selenium/bb_client.rb +38 -0
- data/lib/maze/client/selenium/bs_browsers.yml +257 -0
- data/lib/maze/client/selenium/bs_client.rb +89 -0
- data/lib/maze/client/selenium/local_client.rb +16 -0
- data/lib/maze/client/selenium.rb +16 -0
- data/lib/maze/configuration.rb +18 -10
- data/lib/maze/docker.rb +40 -1
- data/lib/maze/driver/appium.rb +5 -24
- data/lib/maze/driver/browser.rb +12 -26
- data/lib/maze/errors.rb +32 -0
- data/lib/maze/generator.rb +55 -0
- data/lib/maze/helper.rb +7 -3
- data/lib/maze/hooks/appium_hooks.rb +29 -190
- data/lib/maze/hooks/browser_hooks.rb +2 -55
- data/lib/maze/hooks/error_code_hook.rb +49 -0
- data/lib/maze/hooks/hooks.rb +2 -2
- data/lib/maze/http_request.rb +21 -0
- data/lib/maze/logger.rb +16 -3
- data/lib/maze/maze_output.rb +88 -0
- data/lib/maze/option/parser.rb +17 -22
- data/lib/maze/option/processor.rb +21 -34
- data/lib/maze/option/validator.rb +38 -67
- data/lib/maze/option.rb +16 -18
- data/lib/maze/plugins/cucumber_report_plugin.rb +1 -1
- data/lib/maze/plugins/error_code_plugin.rb +21 -0
- data/lib/maze/request_list.rb +10 -5
- data/lib/maze/request_repeater.rb +49 -0
- data/lib/maze/retry_handler.rb +4 -13
- data/lib/maze/schemas/OtelTraceSchema.json +390 -0
- data/lib/maze/schemas/trace_schema.rb +7 -0
- data/lib/maze/schemas/trace_validator.rb +98 -0
- data/lib/maze/server.rb +74 -30
- data/lib/maze/servlets/base_servlet.rb +10 -5
- data/lib/maze/servlets/command_servlet.rb +10 -7
- data/lib/maze/servlets/log_servlet.rb +2 -2
- data/lib/maze/servlets/reflective_servlet.rb +12 -11
- data/lib/maze/servlets/servlet.rb +47 -8
- data/lib/maze/servlets/temp.rb +0 -0
- data/lib/maze/servlets/trace_servlet.rb +13 -0
- data/lib/maze.rb +2 -2
- data/lib/utils/deep_merge.rb +17 -0
- data/lib/utils/selenium_money_patch.rb +17 -0
- metadata +101 -21
- data/lib/maze/bitbar_devices.rb +0 -84
- data/lib/maze/bitbar_utils.rb +0 -112
- data/lib/maze/browser_stack_devices.rb +0 -160
- data/lib/maze/browser_stack_utils.rb +0 -164
- data/lib/maze/browsers_bs.yml +0 -220
- data/lib/maze/browsers_cbt.yml +0 -100
- data/lib/maze/capabilities.rb +0 -126
- data/lib/maze/driver/resilient_appium.rb +0 -51
- data/lib/maze/sauce_labs_utils.rb +0 -96
- data/lib/maze/smart_bear_utils.rb +0 -71
@@ -0,0 +1,390 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"$ref": "#/definitions/TracesData",
|
4
|
+
"definitions": {
|
5
|
+
"TracesData": {
|
6
|
+
"properties": {
|
7
|
+
"resourceSpans": {
|
8
|
+
"items": {
|
9
|
+
"$ref": "#/definitions/opentelemetry.proto.trace.v1.ResourceSpans"
|
10
|
+
},
|
11
|
+
"type": "array",
|
12
|
+
"description": "An array of ResourceSpans. For data coming from a single resource this array will typically contain one element. Intermediary nodes that receive data from multiple origins typically batch the data before forwarding further and in that case this array will contain multiple elements."
|
13
|
+
}
|
14
|
+
},
|
15
|
+
"additionalProperties": false,
|
16
|
+
"type": "object",
|
17
|
+
"title": "Traces Data",
|
18
|
+
"description": "TracesData represents the traces data that can be stored in a persistent storage, OR can be embedded by other protocols that transfer OTLP traces data but do not implement the OTLP protocol. The main difference between this message and collector protocol is that in this message there will not be any \"control\" or \"metadata\" specific to OTLP protocol. When new fields are added into this message, the OTLP request MUST be updated as well."
|
19
|
+
},
|
20
|
+
"opentelemetry.proto.common.v1.AnyValue": {
|
21
|
+
"properties": {
|
22
|
+
"stringValue": {
|
23
|
+
"type": "string"
|
24
|
+
},
|
25
|
+
"boolValue": {
|
26
|
+
"type": "boolean"
|
27
|
+
},
|
28
|
+
"intValue": {
|
29
|
+
"type": "string"
|
30
|
+
},
|
31
|
+
"doubleValue": {
|
32
|
+
"type": "number"
|
33
|
+
},
|
34
|
+
"arrayValue": {
|
35
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.ArrayValue",
|
36
|
+
"additionalProperties": false
|
37
|
+
},
|
38
|
+
"kvlistValue": {
|
39
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.KeyValueList",
|
40
|
+
"additionalProperties": false
|
41
|
+
},
|
42
|
+
"bytesValue": {
|
43
|
+
"type": "string",
|
44
|
+
"format": "binary",
|
45
|
+
"binaryEncoding": "base64"
|
46
|
+
}
|
47
|
+
},
|
48
|
+
"additionalProperties": false,
|
49
|
+
"type": "object",
|
50
|
+
"title": "Any Value",
|
51
|
+
"description": "AnyValue is used to represent any type of attribute value. AnyValue may contain a primitive value such as a string or integer or it may contain an arbitrary nested object containing arrays, key-value lists and primitives."
|
52
|
+
},
|
53
|
+
"opentelemetry.proto.common.v1.ArrayValue": {
|
54
|
+
"properties": {
|
55
|
+
"values": {
|
56
|
+
"items": {
|
57
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.AnyValue"
|
58
|
+
},
|
59
|
+
"type": "array",
|
60
|
+
"description": "Array of values. The array may be empty (contain 0 elements)."
|
61
|
+
}
|
62
|
+
},
|
63
|
+
"additionalProperties": false,
|
64
|
+
"type": "object",
|
65
|
+
"title": "Array Value",
|
66
|
+
"description": "ArrayValue is a list of AnyValue messages. We need ArrayValue as a message since oneof in AnyValue does not allow repeated fields."
|
67
|
+
},
|
68
|
+
"opentelemetry.proto.common.v1.InstrumentationScope": {
|
69
|
+
"properties": {
|
70
|
+
"name": {
|
71
|
+
"type": "string",
|
72
|
+
"description": "An empty instrumentation scope name means the name is unknown."
|
73
|
+
},
|
74
|
+
"version": {
|
75
|
+
"type": "string"
|
76
|
+
},
|
77
|
+
"attributes": {
|
78
|
+
"items": {
|
79
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.KeyValue"
|
80
|
+
},
|
81
|
+
"type": "array"
|
82
|
+
},
|
83
|
+
"droppedAttributesCount": {
|
84
|
+
"type": "integer"
|
85
|
+
}
|
86
|
+
},
|
87
|
+
"additionalProperties": false,
|
88
|
+
"type": "object",
|
89
|
+
"title": "Instrumentation Scope",
|
90
|
+
"description": "InstrumentationScope is a message representing the instrumentation scope information such as the fully qualified name and version."
|
91
|
+
},
|
92
|
+
"opentelemetry.proto.common.v1.KeyValue": {
|
93
|
+
"properties": {
|
94
|
+
"key": {
|
95
|
+
"type": "string"
|
96
|
+
},
|
97
|
+
"value": {
|
98
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.AnyValue",
|
99
|
+
"additionalProperties": false
|
100
|
+
}
|
101
|
+
},
|
102
|
+
"additionalProperties": false,
|
103
|
+
"type": "object",
|
104
|
+
"title": "Key Value",
|
105
|
+
"description": "KeyValue is a key-value pair that is used to store Span attributes, Link attributes, etc."
|
106
|
+
},
|
107
|
+
"opentelemetry.proto.common.v1.KeyValueList": {
|
108
|
+
"properties": {
|
109
|
+
"values": {
|
110
|
+
"items": {
|
111
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.KeyValue"
|
112
|
+
},
|
113
|
+
"type": "array",
|
114
|
+
"description": "A collection of key/value pairs of key-value pairs. The list may be empty (may contain 0 elements). The keys MUST be unique (it is not allowed to have more than one value with the same key)."
|
115
|
+
}
|
116
|
+
},
|
117
|
+
"additionalProperties": false,
|
118
|
+
"type": "object",
|
119
|
+
"title": "Key Value List",
|
120
|
+
"description": "KeyValueList is a list of KeyValue messages. We need KeyValueList as a message since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches are semantically equivalent."
|
121
|
+
},
|
122
|
+
"opentelemetry.proto.resource.v1.Resource": {
|
123
|
+
"properties": {
|
124
|
+
"attributes": {
|
125
|
+
"items": {
|
126
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.KeyValue"
|
127
|
+
},
|
128
|
+
"type": "array",
|
129
|
+
"description": "Set of attributes that describe the resource. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key)."
|
130
|
+
},
|
131
|
+
"droppedAttributesCount": {
|
132
|
+
"type": "integer",
|
133
|
+
"description": "dropped_attributes_count is the number of dropped attributes. If the value is 0, then no attributes were dropped."
|
134
|
+
}
|
135
|
+
},
|
136
|
+
"additionalProperties": false,
|
137
|
+
"type": "object",
|
138
|
+
"title": "Resource",
|
139
|
+
"description": "Resource information."
|
140
|
+
},
|
141
|
+
"opentelemetry.proto.trace.v1.ResourceSpans": {
|
142
|
+
"properties": {
|
143
|
+
"resource": {
|
144
|
+
"$ref": "#/definitions/opentelemetry.proto.resource.v1.Resource",
|
145
|
+
"additionalProperties": false,
|
146
|
+
"description": "The resource for the spans in this message. If this field is not set then no resource info is known."
|
147
|
+
},
|
148
|
+
"scopeSpans": {
|
149
|
+
"items": {
|
150
|
+
"$ref": "#/definitions/opentelemetry.proto.trace.v1.ScopeSpans"
|
151
|
+
},
|
152
|
+
"type": "array",
|
153
|
+
"description": "A list of ScopeSpans that originate from a resource."
|
154
|
+
},
|
155
|
+
"schemaUrl": {
|
156
|
+
"type": "string",
|
157
|
+
"description": "This schema_url applies to the data in the \"resource\" field. It does not apply to the data in the \"scope_spans\" field which have their own schema_url field."
|
158
|
+
}
|
159
|
+
},
|
160
|
+
"additionalProperties": false,
|
161
|
+
"type": "object",
|
162
|
+
"title": "Resource Spans",
|
163
|
+
"description": "A collection of ScopeSpans from a Resource."
|
164
|
+
},
|
165
|
+
"opentelemetry.proto.trace.v1.ScopeSpans": {
|
166
|
+
"properties": {
|
167
|
+
"scope": {
|
168
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.InstrumentationScope",
|
169
|
+
"additionalProperties": false,
|
170
|
+
"description": "The instrumentation scope information for the spans in this message. Semantically when InstrumentationScope isn't set, it is equivalent with an empty instrumentation scope name (unknown)."
|
171
|
+
},
|
172
|
+
"spans": {
|
173
|
+
"items": {
|
174
|
+
"$ref": "#/definitions/opentelemetry.proto.trace.v1.Span"
|
175
|
+
},
|
176
|
+
"type": "array",
|
177
|
+
"description": "A list of Spans that originate from an instrumentation scope."
|
178
|
+
},
|
179
|
+
"schemaUrl": {
|
180
|
+
"type": "string",
|
181
|
+
"description": "This schema_url applies to all spans and span events in the \"spans\" field."
|
182
|
+
}
|
183
|
+
},
|
184
|
+
"additionalProperties": false,
|
185
|
+
"type": "object",
|
186
|
+
"title": "Scope Spans",
|
187
|
+
"description": "A collection of Spans produced by an InstrumentationScope."
|
188
|
+
},
|
189
|
+
"opentelemetry.proto.trace.v1.Span": {
|
190
|
+
"properties": {
|
191
|
+
"traceId": {
|
192
|
+
"type": "string",
|
193
|
+
"description": "A unique identifier for a trace. All spans from the same trace share the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes is considered invalid. This field is semantically required. Receiver should generate new random trace_id if empty or invalid trace_id was received. This field is required.",
|
194
|
+
"format": "hex",
|
195
|
+
"pattern": "^[0-9a-fA-F]{32}$"
|
196
|
+
},
|
197
|
+
"spanId": {
|
198
|
+
"type": "string",
|
199
|
+
"description": "A unique identifier for a span within a trace, assigned when the span is created. The ID is an 8-byte array. An ID with all zeroes is considered invalid. This field is semantically required. Receiver should generate new random span_id if empty or invalid span_id was received. This field is required.",
|
200
|
+
"format": "hex",
|
201
|
+
"pattern": "^[0-9a-fA-F]{16}$"
|
202
|
+
},
|
203
|
+
"traceState": {
|
204
|
+
"type": "string",
|
205
|
+
"description": "trace_state conveys information about request position in multiple distributed tracing graphs. It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header See also https://github.com/w3c/distributed-tracing for more details about this field."
|
206
|
+
},
|
207
|
+
"parentSpanId": {
|
208
|
+
"type": "string",
|
209
|
+
"description": "The `span_id` of this span's parent span. If this is a root span, then this field must be empty. The ID is an 8-byte array.",
|
210
|
+
"format": "hex",
|
211
|
+
"pattern": "^[0-9a-fA-F]{16}$"
|
212
|
+
},
|
213
|
+
"name": {
|
214
|
+
"type": "string",
|
215
|
+
"description": "A description of the span's operation. For example, the name can be a qualified method name or a file name and a line number where the operation is called. A best practice is to use the same display name at the same call point in an application. This makes it easier to correlate spans in different traces. This field is semantically required to be set to non-empty string. Empty value is equivalent to an unknown span name. This field is required."
|
216
|
+
},
|
217
|
+
"kind": {
|
218
|
+
"enum": [
|
219
|
+
"SPAN_KIND_UNSPECIFIED",
|
220
|
+
0,
|
221
|
+
"SPAN_KIND_INTERNAL",
|
222
|
+
1,
|
223
|
+
"SPAN_KIND_SERVER",
|
224
|
+
2,
|
225
|
+
"SPAN_KIND_CLIENT",
|
226
|
+
3,
|
227
|
+
"SPAN_KIND_PRODUCER",
|
228
|
+
4,
|
229
|
+
"SPAN_KIND_CONSUMER",
|
230
|
+
5
|
231
|
+
],
|
232
|
+
"oneOf": [
|
233
|
+
{
|
234
|
+
"type": "string"
|
235
|
+
},
|
236
|
+
{
|
237
|
+
"type": "integer"
|
238
|
+
}
|
239
|
+
],
|
240
|
+
"title": "Span Kind",
|
241
|
+
"description": "SpanKind is the type of span. Can be used to specify additional relationships between spans in addition to a parent/child relationship."
|
242
|
+
},
|
243
|
+
"startTimeUnixNano": {
|
244
|
+
"type": "string",
|
245
|
+
"description": "start_time_unix_nano is the start time of the span. On the client side, this is the time kept by the local machine where the span execution starts. On the server side, this is the time when the server's application handler starts running. Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. This field is semantically required and it is expected that end_time \u003e= start_time."
|
246
|
+
},
|
247
|
+
"endTimeUnixNano": {
|
248
|
+
"type": "string",
|
249
|
+
"description": "end_time_unix_nano is the end time of the span. On the client side, this is the time kept by the local machine where the span execution ends. On the server side, this is the time when the server application handler stops running. Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. This field is semantically required and it is expected that end_time \u003e= start_time."
|
250
|
+
},
|
251
|
+
"attributes": {
|
252
|
+
"items": {
|
253
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.KeyValue"
|
254
|
+
},
|
255
|
+
"type": "array",
|
256
|
+
"description": "attributes is a collection of key/value pairs. Note, global attributes like server name can be set using the resource API. Examples of attributes: \"/http/user_agent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36\" \"/http/server_latency\": 300 \"abc.com/myattribute\": true \"abc.com/score\": 10.239 The OpenTelemetry API specification further restricts the allowed value types: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key)."
|
257
|
+
},
|
258
|
+
"droppedAttributesCount": {
|
259
|
+
"type": "integer",
|
260
|
+
"description": "dropped_attributes_count is the number of attributes that were discarded. Attributes can be discarded because their keys are too long or because there are too many attributes. If this value is 0, then no attributes were dropped."
|
261
|
+
},
|
262
|
+
"events": {
|
263
|
+
"items": {
|
264
|
+
"$ref": "#/definitions/opentelemetry.proto.trace.v1.Span.Event"
|
265
|
+
},
|
266
|
+
"type": "array",
|
267
|
+
"description": "events is a collection of Event items."
|
268
|
+
},
|
269
|
+
"droppedEventsCount": {
|
270
|
+
"type": "integer",
|
271
|
+
"description": "dropped_events_count is the number of dropped events. If the value is 0, then no events were dropped."
|
272
|
+
},
|
273
|
+
"links": {
|
274
|
+
"items": {
|
275
|
+
"$ref": "#/definitions/opentelemetry.proto.trace.v1.Span.Link"
|
276
|
+
},
|
277
|
+
"type": "array",
|
278
|
+
"description": "links is a collection of Links, which are references from this span to a span in the same or different trace."
|
279
|
+
},
|
280
|
+
"droppedLinksCount": {
|
281
|
+
"type": "integer",
|
282
|
+
"description": "dropped_links_count is the number of dropped links after the maximum size was enforced. If this value is 0, then no links were dropped."
|
283
|
+
},
|
284
|
+
"status": {
|
285
|
+
"$ref": "#/definitions/opentelemetry.proto.trace.v1.Status",
|
286
|
+
"additionalProperties": false,
|
287
|
+
"description": "An optional final status for this span. Semantically when Status isn't set, it means span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0)."
|
288
|
+
}
|
289
|
+
},
|
290
|
+
"additionalProperties": false,
|
291
|
+
"type": "object",
|
292
|
+
"title": "Span",
|
293
|
+
"description": "A Span represents a single operation performed by a single component of the system. The next available field id is 17."
|
294
|
+
},
|
295
|
+
"opentelemetry.proto.trace.v1.Span.Event": {
|
296
|
+
"properties": {
|
297
|
+
"timeUnixNano": {
|
298
|
+
"type": "string",
|
299
|
+
"description": "time_unix_nano is the time the event occurred."
|
300
|
+
},
|
301
|
+
"name": {
|
302
|
+
"type": "string",
|
303
|
+
"description": "name of the event. This field is semantically required to be set to non-empty string."
|
304
|
+
},
|
305
|
+
"attributes": {
|
306
|
+
"items": {
|
307
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.KeyValue"
|
308
|
+
},
|
309
|
+
"type": "array",
|
310
|
+
"description": "attributes is a collection of attribute key/value pairs on the event. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key)."
|
311
|
+
},
|
312
|
+
"droppedAttributesCount": {
|
313
|
+
"type": "integer",
|
314
|
+
"description": "dropped_attributes_count is the number of dropped attributes. If the value is 0, then no attributes were dropped."
|
315
|
+
}
|
316
|
+
},
|
317
|
+
"additionalProperties": false,
|
318
|
+
"type": "object",
|
319
|
+
"title": "Event",
|
320
|
+
"description": "Event is a time-stamped annotation of the span, consisting of user-supplied text description and key-value pairs."
|
321
|
+
},
|
322
|
+
"opentelemetry.proto.trace.v1.Span.Link": {
|
323
|
+
"properties": {
|
324
|
+
"traceId": {
|
325
|
+
"type": "string",
|
326
|
+
"description": "A unique identifier of a trace that this linked span is part of. The ID is a 16-byte array.",
|
327
|
+
"format": "hex",
|
328
|
+
"pattern": "^[0-9a-fA-F]{32}$"
|
329
|
+
},
|
330
|
+
"spanId": {
|
331
|
+
"type": "string",
|
332
|
+
"description": "A unique identifier for the linked span. The ID is an 8-byte array.",
|
333
|
+
"format": "hex",
|
334
|
+
"pattern": "^[0-9a-fA-F]{16}$"
|
335
|
+
},
|
336
|
+
"traceState": {
|
337
|
+
"type": "string",
|
338
|
+
"description": "The trace_state associated with the link."
|
339
|
+
},
|
340
|
+
"attributes": {
|
341
|
+
"items": {
|
342
|
+
"$ref": "#/definitions/opentelemetry.proto.common.v1.KeyValue"
|
343
|
+
},
|
344
|
+
"type": "array",
|
345
|
+
"description": "attributes is a collection of attribute key/value pairs on the link. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key)."
|
346
|
+
},
|
347
|
+
"droppedAttributesCount": {
|
348
|
+
"type": "integer",
|
349
|
+
"description": "dropped_attributes_count is the number of dropped attributes. If the value is 0, then no attributes were dropped."
|
350
|
+
}
|
351
|
+
},
|
352
|
+
"additionalProperties": false,
|
353
|
+
"type": "object",
|
354
|
+
"title": "Link",
|
355
|
+
"description": "A pointer from the current span to another span in the same trace or in a different trace. For example, this can be used in batching operations, where a single batch handler processes multiple requests from different traces or when the handler receives a request from a different project."
|
356
|
+
},
|
357
|
+
"opentelemetry.proto.trace.v1.Status": {
|
358
|
+
"properties": {
|
359
|
+
"message": {
|
360
|
+
"type": "string",
|
361
|
+
"description": "A developer-facing human readable error message."
|
362
|
+
},
|
363
|
+
"code": {
|
364
|
+
"enum": [
|
365
|
+
"STATUS_CODE_UNSET",
|
366
|
+
0,
|
367
|
+
"STATUS_CODE_OK",
|
368
|
+
1,
|
369
|
+
"STATUS_CODE_ERROR",
|
370
|
+
2
|
371
|
+
],
|
372
|
+
"oneOf": [
|
373
|
+
{
|
374
|
+
"type": "string"
|
375
|
+
},
|
376
|
+
{
|
377
|
+
"type": "integer"
|
378
|
+
}
|
379
|
+
],
|
380
|
+
"title": "Status Code",
|
381
|
+
"description": "For the semantics of status codes see https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status"
|
382
|
+
}
|
383
|
+
},
|
384
|
+
"additionalProperties": false,
|
385
|
+
"type": "object",
|
386
|
+
"title": "Status",
|
387
|
+
"description": "The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs."
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../helper'
|
4
|
+
|
5
|
+
module Maze
|
6
|
+
module Schemas
|
7
|
+
|
8
|
+
# Contains a set of pre-defined validations for ensuring traces are correct
|
9
|
+
class TraceValidator
|
10
|
+
|
11
|
+
# Whether the trace passed the validation, one of true, false, or nil (not run)
|
12
|
+
# @returns [Boolean|nil] Whether the validation was successful
|
13
|
+
attr_reader :success
|
14
|
+
attr_reader :errors
|
15
|
+
|
16
|
+
# Creates the validator
|
17
|
+
#
|
18
|
+
# @param body [Hash] The body of the trace to validate
|
19
|
+
def initialize(body)
|
20
|
+
@body = body
|
21
|
+
@success = nil
|
22
|
+
@errors = []
|
23
|
+
end
|
24
|
+
|
25
|
+
# Runs the validation against the trace given
|
26
|
+
def validate
|
27
|
+
@success = true
|
28
|
+
# Shortcut the validation if the body is empty for initial P gathering reasons
|
29
|
+
return if @body.keys.eql?(['resourceSpans']) && @body['resourceSpans'].empty?
|
30
|
+
|
31
|
+
regex_comparison('resourceSpans.0.scopeSpans.0.spans.0.spanId', '^[A-Fa-f0-9]{16}$')
|
32
|
+
regex_comparison('resourceSpans.0.scopeSpans.0.spans.0.traceId', '^[A-Fa-f0-9]{32}$')
|
33
|
+
element_int_in_range('resourceSpans.0.scopeSpans.0.spans.0.kind', 0..5)
|
34
|
+
regex_comparison('resourceSpans.0.scopeSpans.0.spans.0.startTimeUnixNano', '^[0-9]+$')
|
35
|
+
regex_comparison('resourceSpans.0.scopeSpans.0.spans.0.endTimeUnixNano', '^[0-9]+$')
|
36
|
+
element_contains('resourceSpans.0.resource.attributes', 'deployment.environment')
|
37
|
+
element_contains('resourceSpans.0.resource.attributes', 'telemetry.sdk.name')
|
38
|
+
element_contains('resourceSpans.0.resource.attributes', 'telemetry.sdk.version')
|
39
|
+
element_a_greater_or_equal_element_b(
|
40
|
+
'resourceSpans.0.scopeSpans.0.spans.0.endTimeUnixNano',
|
41
|
+
'resourceSpans.0.scopeSpans.0.spans.0.startTimeUnixNano'
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def regex_comparison(path, regex)
|
46
|
+
element_value = Maze::Helper.read_key_path(@body, path)
|
47
|
+
expected = Regexp.new(regex)
|
48
|
+
unless expected.match(element_value)
|
49
|
+
@success = false
|
50
|
+
@errors << "Element '#{path}' was expected to match the regex '#{regex}', but was '#{element_value}'"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def element_int_in_range(path, range)
|
55
|
+
element_value = Maze::Helper.read_key_path(@body, path)
|
56
|
+
if element_value.nil? || !element_value.kind_of?(Integer)
|
57
|
+
@success = false
|
58
|
+
@errors << "Element '#{path}' was expected to be an integer, was '#{element_value}'"
|
59
|
+
return
|
60
|
+
end
|
61
|
+
unless range.include?(element_value)
|
62
|
+
@success = false
|
63
|
+
@errors << "Element '#{path}':'#{element_value}' was expected to be in the range '#{range}'"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def element_contains(path, key_value, value_type=nil, possible_values=nil)
|
68
|
+
container = Maze::Helper.read_key_path(@body, path)
|
69
|
+
if container.nil? || !container.kind_of?(Array)
|
70
|
+
@success = false
|
71
|
+
@errors << "Element '#{path}' was expected to be an array, was '#{container}'"
|
72
|
+
return
|
73
|
+
end
|
74
|
+
element = container.find { |value| value['key'].eql?(key_value) }
|
75
|
+
unless element
|
76
|
+
@success = false
|
77
|
+
@errors << "Element '#{path}' did not contain a value with the key '#{key_value}'"
|
78
|
+
return
|
79
|
+
end
|
80
|
+
if value_type && possible_values
|
81
|
+
unless element['value'] && element['value'][value_type] && possible_values.include?(element['value'][value_type])
|
82
|
+
@success = false
|
83
|
+
@errors << "Element '#{path}':'#{element}' did not contain a value of '#{value_type}' from '#{possible_values}'"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def element_a_greater_or_equal_element_b(path_a, path_b)
|
89
|
+
element_a = Maze::Helper.read_key_path(@body, path_a)
|
90
|
+
element_b = Maze::Helper.read_key_path(@body, path_b)
|
91
|
+
unless element_a && element_b && element_a >= element_b
|
92
|
+
@success = false
|
93
|
+
@errors << "Element '#{path_a}':'#{element_a}' was expected to be greater than or equal to '#{path_b}':'#{element_b}'"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/lib/maze/server.rb
CHANGED
@@ -9,44 +9,63 @@ require_relative './request_list'
|
|
9
9
|
module Maze
|
10
10
|
# Receives and stores requests through a WEBrick HTTPServer
|
11
11
|
class Server
|
12
|
+
ALLOWED_HTTP_VERBS = %w[OPTIONS GET POST PUT DELETE HEAD TRACE PATCH CONNECT]
|
13
|
+
DEFAULT_RESPONSE_DELAY = 0
|
14
|
+
DEFAULT_SAMPLING_PROBABILITY = 1
|
15
|
+
DEFAULT_STATUS_CODE = 200
|
12
16
|
|
13
17
|
class << self
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
attr_writer :response_delay_ms
|
18
|
+
# Sets the response delay generator.
|
19
|
+
#
|
20
|
+
# @param generator [Maze::Generator] The new generator
|
21
|
+
def set_response_delay_generator(generator)
|
22
|
+
@response_delay_generator&.close
|
23
|
+
@response_delay_generator = generator
|
24
|
+
end
|
22
25
|
|
23
|
-
#
|
24
|
-
|
26
|
+
# Sets the sampling probability generator.
|
27
|
+
#
|
28
|
+
# @param generator [Maze::Generator] The new generator
|
29
|
+
def set_sampling_probability_generator(generator)
|
30
|
+
@sampling_probability_generator&.close
|
31
|
+
@sampling_probability_generator = generator
|
32
|
+
end
|
25
33
|
|
26
|
-
#
|
27
|
-
|
34
|
+
# Sets the status code generator for the HTTP verb given. If no verb is given then the
|
35
|
+
# generator will be shared across all allowable HTTP verbs.
|
36
|
+
#
|
37
|
+
# @param generator [Maze::Generator] The new generator
|
38
|
+
# @param verb [String] HTTP verb
|
39
|
+
def set_status_code_generator(generator, verb = nil)
|
40
|
+
@status_code_generators ||= {}
|
41
|
+
Array(verb || ALLOWED_HTTP_VERBS).each do |verb|
|
42
|
+
old = @status_code_generators[verb]
|
43
|
+
@status_code_generators[verb] = generator
|
44
|
+
|
45
|
+
# Close the old generator unless it's still being used by another verb
|
46
|
+
old&.close unless @status_code_generators.value?(old)
|
47
|
+
end
|
48
|
+
end
|
28
49
|
|
29
50
|
# The intended HTTP status code on a successful request
|
30
51
|
#
|
31
|
-
# @
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
52
|
+
# @param verb [String] HTTP verb for which the status code is wanted
|
53
|
+
#
|
54
|
+
# @return [Integer] The HTTP status code for the verb given
|
55
|
+
def status_code(verb)
|
56
|
+
if @status_code_generators[verb].nil? || @status_code_generators[verb].closed?
|
57
|
+
DEFAULT_STATUS_CODE
|
58
|
+
else
|
59
|
+
@status_code_generators[verb].next
|
60
|
+
end
|
36
61
|
end
|
37
62
|
|
38
|
-
def
|
39
|
-
@
|
63
|
+
def sampling_probability
|
64
|
+
@sampling_probability_generator.next
|
40
65
|
end
|
41
66
|
|
42
67
|
def response_delay_ms
|
43
|
-
|
44
|
-
@response_delay_ms = 0 if reset_response_delay
|
45
|
-
delay
|
46
|
-
end
|
47
|
-
|
48
|
-
def reset_response_delay
|
49
|
-
@reset_response_delay ||= false
|
68
|
+
@response_delay_generator.next
|
50
69
|
end
|
51
70
|
|
52
71
|
# Provides dynamic access to request lists by name
|
@@ -64,6 +83,8 @@ module Maze
|
|
64
83
|
builds
|
65
84
|
when 'log', 'logs'
|
66
85
|
logs
|
86
|
+
when 'trace', 'traces'
|
87
|
+
traces
|
67
88
|
when 'upload', 'uploads'
|
68
89
|
uploads
|
69
90
|
when 'sourcemap', 'sourcemaps'
|
@@ -89,6 +110,13 @@ module Maze
|
|
89
110
|
@sessions ||= RequestList.new
|
90
111
|
end
|
91
112
|
|
113
|
+
# A list of trace requests received
|
114
|
+
#
|
115
|
+
# @return [RequestList] Received error requests
|
116
|
+
def traces
|
117
|
+
@traces ||= RequestList.new
|
118
|
+
end
|
119
|
+
|
92
120
|
# A list of build requests received
|
93
121
|
#
|
94
122
|
# @return [RequestList] Received build requests
|
@@ -145,9 +173,6 @@ module Maze
|
|
145
173
|
# Starts the WEBrick server in a separate thread
|
146
174
|
def start
|
147
175
|
attempts = 0
|
148
|
-
$logger.info 'Starting mock server'
|
149
|
-
@command_uuid = SecureRandom.uuid
|
150
|
-
$logger.info "Fixture commands UUID: #{@command_uuid}"
|
151
176
|
loop do
|
152
177
|
|
153
178
|
@thread = Thread.new do
|
@@ -161,7 +186,7 @@ module Maze
|
|
161
186
|
|
162
187
|
# Mount a block to respond to all requests with status:200
|
163
188
|
server.mount_proc '/' do |_request, response|
|
164
|
-
$logger.
|
189
|
+
$logger.debug 'Received request on server root, responding with 200'
|
165
190
|
response.header['Access-Control-Allow-Origin'] = '*'
|
166
191
|
response.body = 'Maze runner received request'
|
167
192
|
response.status = 200
|
@@ -173,9 +198,11 @@ module Maze
|
|
173
198
|
server.mount '/builds', Servlets::Servlet, :builds
|
174
199
|
server.mount '/uploads', Servlets::Servlet, :uploads
|
175
200
|
server.mount '/sourcemap', Servlets::Servlet, :sourcemaps
|
201
|
+
server.mount '/traces', Servlets::TraceServlet, :traces, Maze::Schemas::TRACE_SCHEMA
|
176
202
|
server.mount '/react-native-source-map', Servlets::Servlet, :sourcemaps
|
177
203
|
server.mount '/command', Servlets::CommandServlet
|
178
204
|
server.mount '/logs', Servlets::LogServlet
|
205
|
+
server.mount '/reflect', Servlets::ReflectiveServlet
|
179
206
|
server.start
|
180
207
|
rescue StandardError => e
|
181
208
|
$logger.warn "Failed to start mock server: #{e.message}"
|
@@ -202,6 +229,23 @@ module Maze
|
|
202
229
|
@thread&.kill if @thread&.alive?
|
203
230
|
@thread = nil
|
204
231
|
end
|
232
|
+
|
233
|
+
def reset!
|
234
|
+
# Reset generators
|
235
|
+
set_response_delay_generator(Maze::Generator.new [DEFAULT_RESPONSE_DELAY].cycle)
|
236
|
+
set_status_code_generator(Maze::Generator.new [DEFAULT_STATUS_CODE].cycle)
|
237
|
+
set_sampling_probability_generator(Maze::Generator.new [DEFAULT_SAMPLING_PROBABILITY].cycle)
|
238
|
+
|
239
|
+
# Clear request lists
|
240
|
+
errors.clear
|
241
|
+
sessions.clear
|
242
|
+
builds.clear
|
243
|
+
uploads.clear
|
244
|
+
sourcemaps.clear
|
245
|
+
traces.clear
|
246
|
+
logs.clear
|
247
|
+
invalid_requests.clear
|
248
|
+
end
|
205
249
|
end
|
206
250
|
end
|
207
251
|
end
|