Skip to content

Instantly share code, notes, and snippets.

@nsu
Created July 29, 2015 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsu/8e4aec17ff76fa5661ea to your computer and use it in GitHub Desktop.
Save nsu/8e4aec17ff76fa5661ea to your computer and use it in GitHub Desktop.
Generic postgres crashstorage for Socorro
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from socorro.external.postgresql.crashstorage import PostgreSQLCrashStorage
class GenericPostgreSQLCrashStorage(PostgreSQLCrashStorage):
def _save_processed_transaction(self, connection, processed_crash):
# Don't generate reports or worry about plugins. Just save the processed crash
self._save_processed_crash(connection, processed_crash)
#--------------------------------------------------------------------------
def save_processed(self, processed_crash):
# _save_procesed_crash expects the 'date_processed' key.
# Set one if our crash doesn't explicitly have one
if not 'date_processed' in processed_crash:
processed_crash['date_processed'] = processed_crash["startedDateTime"]
self.transaction(self._save_processed_transaction, processed_crash)
@twobraids
Copy link

On seeing this, I realize that the PG crashstore is lossy. It does not save the binary dump used by the stackwalker. If you ever need to reprocess a crash, you'll be out of luck. You can either add a dump table to PG (not recommended as they're big and can easily overwhelm PG), save those to some other persistent storage system, or live with out them.

I'm currently travelling to Columbus, OH where I'm speaking at PyOhio. Immediately thereafter, I'm going on vacation for 10 days.

@twobraids
Copy link

oh, but you're not using a crashmover, so the processor is reading form the collector storage. I had you use the FSPermanentStorage class (or an alias for it), so your binary dumps will be preserved there in the file system. While you don't have an easy route to reprocessing, at least you're not losing the binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment