Module: Sentiero::Store::ErrorStore

Included in:
Sentiero::Store
Defined in:
lib/sentiero/store/error_store.rb

Overview

The error-tracking store contract: problems, occurrences, and server events.

Keying convention: raw stored records (occurrences, server events) are string-keyed Hashes, exactly as they arrived from JSON; computed summaries (problems) are symbol-keyed.

Instance Method Summary collapse

Instance Method Details

#count_occurrences(problem_id, after: nil) ⇒ Object

Default materializes rows via get_occurrences so custom stores keep working; built-in backends override with direct counts.



37
38
39
# File 'lib/sentiero/store/error_store.rb', line 37

def count_occurrences(problem_id, after: nil)
  get_occurrences(problem_id, after: after).size
end

#get_occurrences(problem_id, after: nil, limit: nil) ⇒ Object

Returns string-keyed occurrence records as stored (plus assigned "id"), ascending by timestamp; after is an exclusive timestamp cursor.

Raises:

  • (NoMethodError)


31
32
33
# File 'lib/sentiero/store/error_store.rb', line 31

def get_occurrences(problem_id, after: nil, limit: nil)
  raise NoMethodError, "#{self.class}#get_occurrences not implemented"
end

#get_problem(problem_id) ⇒ Object

Returns the symbol-keyed problem summary, or nil when unknown.

Raises:

  • (NoMethodError)


25
26
27
# File 'lib/sentiero/store/error_store.rb', line 25

def get_problem(problem_id)
  raise NoMethodError, "#{self.class}#get_problem not implemented"
end

#get_server_event(event_id) ⇒ Object

Raises:

  • (NoMethodError)


55
56
57
# File 'lib/sentiero/store/error_store.rb', line 55

def get_server_event(event_id)
  raise NoMethodError, "#{self.class}#get_server_event not implemented"
end

#list_problems(project:, limit:, offset: 0, status: nil, sort_by: nil, search: nil, since: nil, until_time: nil) ⇒ Object

since/until_time (epoch seconds) bound the listing by each problem's last_seen, inclusive on both ends.

Raises:

  • (NoMethodError)


20
21
22
# File 'lib/sentiero/store/error_store.rb', line 20

def list_problems(project:, limit:, offset: 0, status: nil, sort_by: nil, search: nil, since: nil, until_time: nil)
  raise NoMethodError, "#{self.class}#list_problems not implemented"
end

#list_server_events(project:, limit:, name: nil, level: nil, session_id: nil, after: nil) ⇒ Object

Returns string-keyed server-event records as stored (plus assigned "id"), ascending by timestamp; after is an exclusive timestamp cursor.

Raises:

  • (NoMethodError)


51
52
53
# File 'lib/sentiero/store/error_store.rb', line 51

def list_server_events(project:, limit:, name: nil, level: nil, session_id: nil, after: nil)
  raise NoMethodError, "#{self.class}#list_server_events not implemented"
end

#occurrences_for_session(session_id, limit: nil) ⇒ Object

Raises:

  • (NoMethodError)


59
60
61
# File 'lib/sentiero/store/error_store.rb', line 59

def occurrences_for_session(session_id, limit: nil)
  raise NoMethodError, "#{self.class}#occurrences_for_session not implemented"
end

#save_occurrence(occurrence) ⇒ Object

Records the occurrence and upserts its Problem (keyed by "fingerprint"): bump count, extend last_seen, preserve first_seen, refresh message, reopen if "resolved". Returns the problem id (== fingerprint).

Raises:

  • (NoMethodError)


14
15
16
# File 'lib/sentiero/store/error_store.rb', line 14

def save_occurrence(occurrence)
  raise NoMethodError, "#{self.class}#save_occurrence not implemented"
end

#save_server_event(event) ⇒ Object

Raises:

  • (NoMethodError)


45
46
47
# File 'lib/sentiero/store/error_store.rb', line 45

def save_server_event(event)
  raise NoMethodError, "#{self.class}#save_server_event not implemented"
end

#server_events_for_session(session_id, limit: nil) ⇒ Object

Raises:

  • (NoMethodError)


63
64
65
# File 'lib/sentiero/store/error_store.rb', line 63

def server_events_for_session(session_id, limit: nil)
  raise NoMethodError, "#{self.class}#server_events_for_session not implemented"
end

#session_ids_for_problem(problem_id, limit: nil) ⇒ Object

Raises:

  • (NoMethodError)


67
68
69
# File 'lib/sentiero/store/error_store.rb', line 67

def session_ids_for_problem(problem_id, limit: nil)
  raise NoMethodError, "#{self.class}#session_ids_for_problem not implemented"
end

#update_problem_status(problem_id, status) ⇒ Object

Raises:

  • (NoMethodError)


41
42
43
# File 'lib/sentiero/store/error_store.rb', line 41

def update_problem_status(problem_id, status)
  raise NoMethodError, "#{self.class}#update_problem_status not implemented"
end