Skip to content

Commit

Permalink
Clean up minor code issues
Browse files Browse the repository at this point in the history
* fix comments
* un-privatize truncate_keyword_field_values
* remove commented out code
  • Loading branch information
willkg committed Jan 23, 2018
1 parent 6c5de13 commit c894a4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 5 additions & 4 deletions socorro/external/es/crashstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def remove_bad_keys(data):


def truncate_keyword_field_values(fields, data):
"""Truncates values of keyword fields greater than 10,000 characters
"""Truncates values of keyword fields greater than MAX_KEYWORD_FIELD_VALUE_SIZE
characters
Note: This modifies the data dict in-place and only looks at the top level.
Expand All @@ -94,7 +95,7 @@ def truncate_keyword_field_values(fields, data):
# Go through all the fields marked as keyword and truncate values
# if they're too large

for name, properties in fields.items():
for properties in fields.values():
field_name = properties.get('in_database_name')
storage = properties.get('storage_mapping')
if not field_name or not storage:
Expand Down Expand Up @@ -205,7 +206,7 @@ def save_raw_and_processed(self, raw_crash, dumps, processed_crash, crash_id):

# Capture crash data size metrics--do this only after we've cleaned up
# the crash data
self._capture_crash_metrics(raw_crash, processed_crash)
self.capture_crash_metrics(raw_crash, processed_crash)

crash_document = {
'crash_id': crash_id,
Expand Down Expand Up @@ -237,7 +238,7 @@ def reconstitute_datetimes(processed_crash):

processed_crash[a_key] = string_to_datetime(processed_crash[a_key])

def _capture_crash_metrics(self, raw_crash, processed_crash):
def capture_crash_metrics(self, raw_crash, processed_crash):
"""Capture metrics about crash data being saved to Elasticsearch"""
# NOTE(willkg): this is a hard-coded keyname to match what the statsdbenchmarkingwrapper
# produces for processor crashstorage classes. This is only used in that context, so we're
Expand Down
1 change: 0 additions & 1 deletion socorro/unittest/external/es/test_crashstorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
RawCrashRedactor,
truncate_keyword_field_values,
)
# from socorro.external.es.super_search_fields import FIELDS
from socorro.lib.datetimeutil import string_to_datetime
from socorro.unittest.external.es.base import (
ElasticsearchTestCase,
Expand Down

0 comments on commit c894a4f

Please sign in to comment.