EventProvider ActivityId in a call context using A

2019-08-05 19:34发布

问题:

I am using the EventProvider to write events that eventually get written to Appfabric. It generally follows the EventProvider implementation as specified here.

I am using this from with in a WCF service. The service calls other methods asynchronously, so the logic of service operates on multiple threads. As I understand the E2EActivityId of events use Trace.CorrelationManager.ActivityId which is stored in Thread's TLS. I tried setting the EventProvider.SetActivityId(ref ..) method before making the call to write event, but that did not work.

So I am not able to group all the events from a single WCF operation context.

Is there any way to group calls?

回答1:

I had the same issue. I solved it by adding a probably new attribute named activityTracing="true" to the element endToEndTracing. I'm using AppFabric 1.1 on a Windows Server 2012, .net 4.5.

To make a long story short I post my config here

     <!-- AppFabric Config -->
  <system.serviceModel>
    <diagnostics etwProviderId="830b12d1-bb5b-4887-aa3f-ab508fd4c8ba">
      <endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true" />
    </diagnostics>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <etwTracking profileName="EndToEndMonitoring Tracking Profile" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <microsoft.applicationServer>
    <monitoring>
      <default enabled="true" connectionStringName="ApplicationServerMonitoringConnectionString" monitoringLevel="EndToEndMonitoring" />
    </monitoring>
  </microsoft.applicationServer>


标签: c# wcf appfabric