title: Best practices to Fire and Forget an async method to send non essential metric
body: <p>Waiting for a non-essential metrics to be sent makes no sense to me, as it adds latency (waiting for the server's response) on each call to the back-end dotnet core service, which might happen multiple times per client call. Still, logging an error on failure is important (I do not need to throw it though, as the metric's failure should not impact the service).</p>
  
  <p>I found multiple ways of doing so. Here is the method to be called in a FireAndForget manner:</p>
  
  <pre><code>public async Task FireAndForget()
  {
      try{ await sendTheMetric(); } // Try catch on the await, to log exceptions
      catch(Exception e){ logger.debug(e) }
  }
  </code></pre>
  
  <p>Method 1: Remove the await.</p>
  
  <pre><code>FireAndForget(); // No await in front of the call
  </code></pre>
  
  <p>Method 2: Seems similar to method 1 to me, as we do not await the Task.Factory.StartNew call.</p>
  
  <pre><code>Task.Factory.StartNew(async () =&gt; await MyAsyncTask());
  </code></pre>
  
  <p>Method 3: Enqueue on the ThreadPool as a workItem.</p>
  
  <pre><code>ThreadPool.QueueUserWorkItem(async o =&gt; await FireAndForget());
  </code></pre>
  
  <p>I have a hard time finding which one I should use for a Fire and forget call to send a non-essential metric. My goal is to not add latency to each calls to my service each time a metric is sent. Logging an error when the metrics fails to be sent is important, but it should never re-throw. The thread context is not important for the execution of the task. The task should always, or at least almost always, be completed.</p>
  
  <p>Which one is the best practice for for requirements? Or are they all the same?</p>
  
  <p>Note: I did not include <code>async void</code>, as it seems risky (if an exception occurs, it might crash, as no Task will wrap it).</p>