def _do_preprocess_event(cache_key, data, start_time, event_id, process_task, project): from sentry.lang.native.processing import should_process_with_symbolicator if cache_key and data is None: data = event_processing_store.get(cache_key) if data is None: metrics.incr("events.failed", tags={ "reason": "cache", "stage": "pre" }, skip_internal=False) error_logger.error("preprocess.failed.empty", extra={"cache_key": cache_key}) return original_data = data data = CanonicalKeyDict(data) project_id = data["project"] set_current_project(project_id) if project is None: project = Project.objects.get_from_cache(id=project_id) else: assert project.id == project_id, (project.id, project_id) from_reprocessing = process_task is process_event_from_reprocessing with metrics.timer( "tasks.store.preprocess_event.organization.get_from_cache"): project._organization_cache = Organization.objects.get_from_cache( id=project.organization_id) if should_process_with_symbolicator(data): reprocessing2.backup_unprocessed_event(project=project, data=original_data) submit_symbolicate(project, from_reprocessing, cache_key, event_id, start_time, original_data) return if should_process(data): reprocessing2.backup_unprocessed_event(project=project, data=original_data) submit_process( project, from_reprocessing, cache_key, event_id, start_time, data_has_changed=False, ) return submit_save_event(project, from_reprocessing, cache_key, event_id, start_time, original_data)
def _do_preprocess_event( cache_key: str, data: Optional[Event], start_time: Optional[int], event_id: Optional[str], process_task: Callable[[Optional[str], Optional[int], Optional[str], bool], None], project: Optional[Project], ) -> None: from sentry.lang.native.processing import should_process_with_symbolicator from sentry.tasks.symbolication import should_demote_symbolication, submit_symbolicate if cache_key and data is None: data = processing.event_processing_store.get(cache_key) if data is None: metrics.incr("events.failed", tags={ "reason": "cache", "stage": "pre" }, skip_internal=False) error_logger.error("preprocess.failed.empty", extra={"cache_key": cache_key}) return original_data = data data = CanonicalKeyDict(data) project_id = data["project"] set_current_event_project(project_id) if project is None: project = Project.objects.get_from_cache(id=project_id) else: assert project.id == project_id, (project.id, project_id) from_reprocessing = process_task is process_event_from_reprocessing with metrics.timer( "tasks.store.preprocess_event.organization.get_from_cache"): project.set_cached_field_value( "organization", Organization.objects.get_from_cache(id=project.organization_id)) if should_process_with_symbolicator(data): reprocessing2.backup_unprocessed_event(project=project, data=original_data) is_low_priority = should_demote_symbolication(project_id) submit_symbolicate( is_low_priority, from_reprocessing, cache_key, event_id, start_time, original_data, ) return if should_process(data): submit_process( project, from_reprocessing, cache_key, event_id, start_time, data_has_changed=False, ) return submit_save_event(project_id, from_reprocessing, cache_key, event_id, start_time, original_data)