parameters: (call_name, group_name)
return_statement: return wrap
docstring: Custom event that we publish to New Relic for distributed scenario
docstring_summary: Custom event that we publish to New Relic for distributed scenario
docstring_tokens: Custom event that we publish to New Relic for distributed scenario
function: def distributedEvent(call_name, group_name):
      """
      Custom event that we publish to New Relic for distributed scenario
      """
  
      def wrap(func):
          @functools.wraps(func)
          def wrapper(obj, service, *args, **kwargs):
              event_params = {
                  "service": type(service).__name__,
                  "call": call_name,
                  "group": group_name,
                  "status": "ok",
              }
  
              start_time = timeit.default_timer()
              result = None
              try:
                  result = func(obj, *args, **kwargs)
              except Exception as e:
                  event_params["status"] = "failed"
                  event_params.update({"exception": e})
                  raise
  
              duration = timeit.default_timer() - start_time
              event_params.update({"duration": duration})
  
              # Send the custom event to newrelic !
              record_custom_event("distributed", event_params)
  
              return result
  
          return wrapper
  
      return wrap
function_tokens: def distributedEvent ( call_name , group_name ) : def wrap ( func ) : @ functools . wraps ( func ) def wrapper ( obj , service , * args , * * kwargs ) : event_params = { "service" : type ( service ) . __name__ , "call" : call_name , "group" : group_name , "status" : "ok" , } start_time = timeit . default_timer ( ) result = None try : result = func ( obj , * args , * * kwargs ) except Exception as e : event_params [ "status" ] = "failed" event_params . update ( { "exception" : e } ) raise duration = timeit . default_timer ( ) - start_time event_params . update ( { "duration" : duration } ) # Send the custom event to newrelic ! record_custom_event ( "distributed" , event_params ) return result return wrapper return wrap