Class: Shipeasy::Admin::Generated::ErrorRecord

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/shipeasy_admin/models/error_record.rb

Overview

A tracked production error — one row per distinct issue, keyed by fingerprint. Rows are never created by hand: an ingestion path (worker log drain / the see() SDK reporter) folds each occurrence into the matching row, bumping count and lastSeenAt. The admin surface only lists them, reads one, and flips status. Field names are camelCase (the D1 row projected through Drizzle). Many columns are nullable because the reporting source may not supply them.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ ErrorRecord

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
# File 'lib/shipeasy_admin/models/error_record.rb', line 199

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Shipeasy::Admin::Generated::ErrorRecord` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Shipeasy::Admin::Generated::ErrorRecord`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'project_id')
    self.project_id = attributes[:'project_id']
  else
    self.project_id = nil
  end

  if attributes.key?(:'fingerprint')
    self.fingerprint = attributes[:'fingerprint']
  else
    self.fingerprint = nil
  end

  if attributes.key?(:'caused_by_fingerprint')
    self.caused_by_fingerprint = attributes[:'caused_by_fingerprint']
  end

  if attributes.key?(:'message')
    self.message = attributes[:'message']
  else
    self.message = nil
  end

  if attributes.key?(:'error_type')
    self.error_type = attributes[:'error_type']
  end

  if attributes.key?(:'stack')
    self.stack = attributes[:'stack']
  end

  if attributes.key?(:'source')
    self.source = attributes[:'source']
  end

  if attributes.key?(:'url')
    self.url = attributes[:'url']
  end

  if attributes.key?(:'seen_urls')
    self.seen_urls = attributes[:'seen_urls']
  end

  if attributes.key?(:'subject')
    self.subject = attributes[:'subject']
  end

  if attributes.key?(:'outcome')
    self.outcome = attributes[:'outcome']
  end

  if attributes.key?(:'side')
    self.side = attributes[:'side']
  end

  if attributes.key?(:'env')
    self.env = attributes[:'env']
  end

  if attributes.key?(:'kind')
    self.kind = attributes[:'kind']
  end

  if attributes.key?(:'last_extras_json')
    self.last_extras_json = attributes[:'last_extras_json']
  end

  if attributes.key?(:'sdk_version')
    self.sdk_version = attributes[:'sdk_version']
  end

  if attributes.key?(:'count')
    self.count = attributes[:'count']
  else
    self.count = nil
  end

  if attributes.key?(:'status')
    self.status = attributes[:'status']
  else
    self.status = nil
  end

  if attributes.key?(:'first_seen_at')
    self.first_seen_at = attributes[:'first_seen_at']
  else
    self.first_seen_at = nil
  end

  if attributes.key?(:'last_seen_at')
    self.last_seen_at = attributes[:'last_seen_at']
  else
    self.last_seen_at = nil
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  else
    self.created_at = nil
  end

  if attributes.key?(:'updated_at')
    self.updated_at = attributes[:'updated_at']
  else
    self.updated_at = nil
  end
end

Instance Attribute Details

#caused_by_fingerprintObject

Fingerprint of the issue this one descends from — set when see() reported the same error (re-throw) or its { cause } (wrap) at an inner boundary first. Points at another error's fingerprint in the same project (soft reference, no FK). null for a root issue.



29
30
31
# File 'lib/shipeasy_admin/models/error_record.rb', line 29

def caused_by_fingerprint
  @caused_by_fingerprint
end

#countObject

Number of folded occurrences for this fingerprint.



71
72
73
# File 'lib/shipeasy_admin/models/error_record.rb', line 71

def count
  @count
end

#created_atObject

ISO-8601 timestamp the row was created.



83
84
85
# File 'lib/shipeasy_admin/models/error_record.rb', line 83

def created_at
  @created_at
end

#envObject

Published env the reporting SDK ran against (e.g. dev, staging, prod). null if unknown.



59
60
61
# File 'lib/shipeasy_admin/models/error_record.rb', line 59

def env
  @env
end

#error_typeObject

Error class/name, e.g. TypeError. null when the source didn't supply one.



35
36
37
# File 'lib/shipeasy_admin/models/error_record.rb', line 35

def error_type
  @error_type
end

#fingerprintObject

Stable dedupe key (hash of errorType + normalized message + consequence). Unique per project — every occurrence with the same fingerprint folds into this one row.



26
27
28
# File 'lib/shipeasy_admin/models/error_record.rb', line 26

def fingerprint
  @fingerprint
end

#first_seen_atObject

ISO-8601 timestamp of the first folded occurrence.



77
78
79
# File 'lib/shipeasy_admin/models/error_record.rb', line 77

def first_seen_at
  @first_seen_at
end

#idObject

Stable opaque error id.



20
21
22
# File 'lib/shipeasy_admin/models/error_record.rb', line 20

def id
  @id
end

#kindObject

see() error kind. null when the source didn't classify the occurrence.



62
63
64
# File 'lib/shipeasy_admin/models/error_record.rb', line 62

def kind
  @kind
end

#last_extras_jsonObject

Latest occurrence's sanitized extras, JSON-encoded. null if none.



65
66
67
# File 'lib/shipeasy_admin/models/error_record.rb', line 65

def last_extras_json
  @last_extras_json
end

#last_seen_atObject

ISO-8601 timestamp of the most recent folded occurrence. Rows are ordered by this, descending.



80
81
82
# File 'lib/shipeasy_admin/models/error_record.rb', line 80

def last_seen_at
  @last_seen_at
end

#messageObject

Error message text.



32
33
34
# File 'lib/shipeasy_admin/models/error_record.rb', line 32

def message
  @message
end

#outcomeObject

Consequence outcome — see subject. null if no consequence was reported.



53
54
55
# File 'lib/shipeasy_admin/models/error_record.rb', line 53

def outcome
  @outcome
end

#project_idObject

Project this issue belongs to.



23
24
25
# File 'lib/shipeasy_admin/models/error_record.rb', line 23

def project_id
  @project_id
end

#sdk_versionObject

@shipeasy/sdk version of the latest occurrence, or null.



68
69
70
# File 'lib/shipeasy_admin/models/error_record.rb', line 68

def sdk_version
  @sdk_version
end

#seen_urlsObject

Distinct, id-normalized route templates this issue has surfaced on, as a JSON-encoded string array (e.g. [\"https://app/dashboard/#/gates\"]). UUIDs / numeric ids / opaque tokens are collapsed to # so the same route under different ids counts once. null if none recorded.



47
48
49
# File 'lib/shipeasy_admin/models/error_record.rb', line 47

def seen_urls
  @seen_urls
end

#sideObject

Which SDK side reported it — client or server. null if unknown.



56
57
58
# File 'lib/shipeasy_admin/models/error_record.rb', line 56

def side
  @side
end

#sourceObject

Where it surfaced — Worker name (shipeasy, shipeasy-worker) or sdk-client / sdk-server. null if unknown.



41
42
43
# File 'lib/shipeasy_admin/models/error_record.rb', line 41

def source
  @source
end

#stackObject

Stack trace of the latest occurrence, or null if none was captured.



38
39
40
# File 'lib/shipeasy_admin/models/error_record.rb', line 38

def stack
  @stack
end

#statusObject

Triage state. open is the default; a resolved error reopens automatically (ingestion-side) if it recurs; ignored is sticky until flipped back here.



74
75
76
# File 'lib/shipeasy_admin/models/error_record.rb', line 74

def status
  @status
end

#subjectObject

Consequence subject — <errorType> causes the <subject> to <outcome>. null if no consequence was reported.



50
51
52
# File 'lib/shipeasy_admin/models/error_record.rb', line 50

def subject
  @subject
end

#updated_atObject

ISO-8601 timestamp of the last mutation (e.g. a status flip).



86
87
88
# File 'lib/shipeasy_admin/models/error_record.rb', line 86

def updated_at
  @updated_at
end

#urlObject

Latest occurrence's raw URL (with ids intact), or null.



44
45
46
# File 'lib/shipeasy_admin/models/error_record.rb', line 44

def url
  @url
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



140
141
142
# File 'lib/shipeasy_admin/models/error_record.rb', line 140

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



145
146
147
# File 'lib/shipeasy_admin/models/error_record.rb', line 145

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



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
# File 'lib/shipeasy_admin/models/error_record.rb', line 111

def self.attribute_map
  {
    :'id' => :'id',
    :'project_id' => :'projectId',
    :'fingerprint' => :'fingerprint',
    :'caused_by_fingerprint' => :'causedByFingerprint',
    :'message' => :'message',
    :'error_type' => :'errorType',
    :'stack' => :'stack',
    :'source' => :'source',
    :'url' => :'url',
    :'seen_urls' => :'seenUrls',
    :'subject' => :'subject',
    :'outcome' => :'outcome',
    :'side' => :'side',
    :'env' => :'env',
    :'kind' => :'kind',
    :'last_extras_json' => :'lastExtrasJson',
    :'sdk_version' => :'sdkVersion',
    :'count' => :'count',
    :'status' => :'status',
    :'first_seen_at' => :'firstSeenAt',
    :'last_seen_at' => :'lastSeenAt',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/shipeasy_admin/models/error_record.rb', line 559

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/shipeasy_admin/models/error_record.rb', line 179

def self.openapi_nullable
  Set.new([
    :'caused_by_fingerprint',
    :'error_type',
    :'stack',
    :'source',
    :'url',
    :'seen_urls',
    :'subject',
    :'outcome',
    :'side',
    :'env',
    :'kind',
    :'last_extras_json',
    :'sdk_version',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/shipeasy_admin/models/error_record.rb', line 150

def self.openapi_types
  {
    :'id' => :'String',
    :'project_id' => :'String',
    :'fingerprint' => :'String',
    :'caused_by_fingerprint' => :'String',
    :'message' => :'String',
    :'error_type' => :'String',
    :'stack' => :'String',
    :'source' => :'String',
    :'url' => :'String',
    :'seen_urls' => :'String',
    :'subject' => :'String',
    :'outcome' => :'String',
    :'side' => :'String',
    :'env' => :'String',
    :'kind' => :'String',
    :'last_extras_json' => :'String',
    :'sdk_version' => :'String',
    :'count' => :'Integer',
    :'status' => :'String',
    :'first_seen_at' => :'String',
    :'last_seen_at' => :'String',
    :'created_at' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'lib/shipeasy_admin/models/error_record.rb', line 516

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      project_id == o.project_id &&
      fingerprint == o.fingerprint &&
      caused_by_fingerprint == o.caused_by_fingerprint &&
      message == o.message &&
      error_type == o.error_type &&
      stack == o.stack &&
      source == o.source &&
      url == o.url &&
      seen_urls == o.seen_urls &&
      subject == o.subject &&
      outcome == o.outcome &&
      side == o.side &&
      env == o.env &&
      kind == o.kind &&
      last_extras_json == o.last_extras_json &&
      sdk_version == o.sdk_version &&
      count == o.count &&
      status == o.status &&
      first_seen_at == o.first_seen_at &&
      last_seen_at == o.last_seen_at &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


546
547
548
# File 'lib/shipeasy_admin/models/error_record.rb', line 546

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



552
553
554
# File 'lib/shipeasy_admin/models/error_record.rb', line 552

def hash
  [id, project_id, fingerprint, caused_by_fingerprint, message, error_type, stack, source, url, seen_urls, subject, outcome, side, env, kind, last_extras_json, sdk_version, count, status, first_seen_at, last_seen_at, created_at, updated_at].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/shipeasy_admin/models/error_record.rb', line 328

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @project_id.nil?
    invalid_properties.push('invalid value for "project_id", project_id cannot be nil.')
  end

  if @fingerprint.nil?
    invalid_properties.push('invalid value for "fingerprint", fingerprint cannot be nil.')
  end

  if @message.nil?
    invalid_properties.push('invalid value for "message", message cannot be nil.')
  end

  if @count.nil?
    invalid_properties.push('invalid value for "count", count cannot be nil.')
  end

  if @count < 1
    invalid_properties.push('invalid value for "count", must be greater than or equal to 1.')
  end

  if @status.nil?
    invalid_properties.push('invalid value for "status", status cannot be nil.')
  end

  if @first_seen_at.nil?
    invalid_properties.push('invalid value for "first_seen_at", first_seen_at cannot be nil.')
  end

  if @last_seen_at.nil?
    invalid_properties.push('invalid value for "last_seen_at", last_seen_at cannot be nil.')
  end

  if @created_at.nil?
    invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
  end

  if @updated_at.nil?
    invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/shipeasy_admin/models/error_record.rb', line 581

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/shipeasy_admin/models/error_record.rb', line 380

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @id.nil?
  return false if @project_id.nil?
  return false if @fingerprint.nil?
  return false if @message.nil?
  kind_validator = EnumAttributeValidator.new('String', ["caught", "uncaught", "unhandled_rejection", "network", "violation"])
  return false unless kind_validator.valid?(@kind)
  return false if @count.nil?
  return false if @count < 1
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["open", "resolved", "ignored"])
  return false unless status_validator.valid?(@status)
  return false if @first_seen_at.nil?
  return false if @last_seen_at.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end