title: Hangfire problem when running two methods inside the Enqueue
body: <p>I have an extension to enqueue my view models pointing to an implementation of an interface IBackgroundJob</p>
  <p>this are my extensions methods</p>
  <pre><code>private static readonly ActivitySource activitySource = new(&quot;MC.Hangfire.Extensions&quot;);
  
  public static string Enqueue&lt;T&gt;(this T job, IBackgroundJobClient client)
  {
      return client.Enqueue&lt;IBackgroundJob&lt;T&gt;&gt;(ps =&gt; ps.AddTelemetry(null).EnqueueJob(null, job, JobCancellationToken.Null));
  }
  
  public static IBackgroundJob&lt;T&gt; AddTelemetry&lt;T&gt;(this IBackgroundJob&lt;T&gt; job, PerformContext context)
  {
      using var activity = activitySource.StartActivity($&quot;Start Job {typeof(T).FullName} id {context.BackgroundJob.Id}&quot;, ActivityKind.Server);
      activity?.SetTag(&quot;JobId&quot;, context.BackgroundJob.Id);
      activity?.SetTag(&quot;JobJson&quot;, Newtonsoft.Json.JsonConvert.SerializeObject(job));
      activity?.SetTag(&quot;Job&quot;, Newtonsoft.Json.JsonConvert.SerializeObject(context.BackgroundJob.Job));
      return job;
  }
  </code></pre>
  <p>My problem is that the EnqueueJob method is called, but the AddTelemetry method is not called before, how can I Add the telemetry information before calling all of my jobs, but in the context of the jobs, and of course not adding this code in all of my enqueue methods?</p>
  <p>I'm looking for the Hangfire filters, but I think that there should be a way to inject the filter with the DI of the ASP.NET core application</p>
  <p>I created this issue on github because I think that the problem with instrumentation is a little deeper in the code</p>
  <p><a href="https://github.com/HangfireIO/Hangfire/issues/2017" rel="nofollow noreferrer">https://github.com/HangfireIO/Hangfire/issues/2017</a></p>