@instrumented_task(name='sentry.tasks.store.save_event', queue='events.save_event')
def save_event(cache_key=None, data=None, start_time=None, **kwargs):
 from sentry.event_manager import EventManager
 if cache_key:
  data = default_cache.get(cache_key)
 if (data is None):
  metrics.incr('events.failed', tags={'reason': 'cache', 'stage': 'post'})
  return
 project = data.pop('project')
 Raven.tags_context({'project': project})
 try:
  manager = EventManager(data)
  manager.save(project)
 finally:
  if cache_key:
   default_cache.delete(cache_key)
  if start_time:
   metrics.timing('events.time-to-process', (time() - start_time), instance=data['platform'])

@ instrumented_task ( name = 'sentry.tasks.store.save_event' , queue = 'events.save_event' ) def save_event ( cache_key = None , data = None , start_time = None , ** kwargs ) : from sentry . event_manager import EventManager if cache_key : data = default_cache . get ( cache_key ) if ( data is None ) : metrics . incr ( 'events.failed' , tags = { 'reason' : 'cache' , 'stage' : 'post' } ) return project = data . pop ( 'project' ) Raven . tags_context ( { 'project' : project } ) try : manager = EventManager ( data ) manager . save ( project ) finally : if cache_key : default_cache . delete ( cache_key ) if start_time : metrics . timing ( 'events.time-to-process' , ( time ( ) - start_time ) , instance = data [ 'platform' ] )
saves an event to the database .