Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown data store event class #467

Open
wsanchez opened this issue Aug 21, 2021 · 2 comments
Open

Unknown data store event class #467

wsanchez opened this issue Aug 21, 2021 · 2 comments

Comments

@wsanchez
Copy link
Member

wsanchez commented Aug 21, 2021

Sample log error:

2021-08-17T17:12:46+0000 [ims.application._eventsource.DataStoreEventSourceLogObserver#critical] Unknown data store event class <class 'ims.model._entry.ReportEntry'> sent event: {'storeWriteClass': <class 'ims.model._entry.ReportEntry'>, 'reportEntry': ReportEntry(<REDACTED>), 'log_logger': <Logger 'ims.store.mysql._store.DataStore'>, 'log_level': <LogLevel=info>, 'log_namespace': 'ims.store.mysql._store.DataStore', 'log_source': DataStore(hostName=<REDACTED>, hostPort=3306, database=<REDACTED>, username=<REDACTED>, password=<REDACTED>, _state=DataStore._State(db=<ims.store.mysql._store.ReconnectingConnectionPool object at 0x7f18d9843f70>)), 'log_format': 'Created report entry: {reportEntry}', 'log_time': 1629220366.7323208}

Types include:

  • ims.model._entry.ReportEntry
  • ims.model._report.IncidentReport
@srabraham
Copy link
Member

The issue is that the code is only set up to send out EventSource messages for Incidents; not for IncidentReports, ReportEntries, etc. There would need to be additional elifs in the code below to fix that.

if eventClass is None:
# Not a data store event
return None
elif eventClass is Incident:
incident = loggerEvent.get("incident", None)
if incident is None:
incidentNumber = loggerEvent.get("incidentNumber", None)
else:
incidentNumber = incident.number
if incidentNumber is None:
self._log.critical(
"Unable to determine incident number from store event: "
"{event}",
event=loggerEvent,
)
return None
message = dict(incident_number=incidentNumber)
else:
self._log.critical(
"Unknown data store event class {eventClass} "
"sent event: {event}",
eventClass=eventClass,
event=loggerEvent,
)
return None

@srabraham
Copy link
Member

Related: #113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants