Skip to content

Microsoft.AspNet.CorrelationIdTracker module for tracking multi-tier activities

License

Notifications You must be signed in to change notification settings

aspnet/Microsoft.AspNet.TelemetryCorrelation

Repository files navigation

Telemetry correlation http module

NuGet

Telemetry correlation http module enables cross tier telemetry tracking.

Usage

  1. Install NuGet for your app.

  2. Enable diagnostics source listener using code below. Note, some telemetry vendors like Azure Application Insights will enable it automatically.

    public class NoopDiagnosticsListener : IObserver<KeyValuePair<string, object>>
    {
        public void OnCompleted() { }
    
        public void OnError(Exception error) { }
    
        public void OnNext(KeyValuePair<string, object> evnt)
        {
        }
    }
    
    public class NoopSubscriber : IObserver<DiagnosticListener>
    {
        public void OnCompleted() { }
    
        public void OnError(Exception error) { }
    
        public void OnNext(DiagnosticListener listener)
        {
            if (listener.Name == "Microsoft.AspNet.TelemetryCorrelation" || listener.Name == "System.Net.Http" )
            {
                listener.Subscribe(new NoopDiagnosticsListener());
            }
        }
    }
  3. Double check that http module was registered in web.config for your app.

Once enabled - this http module will:

  • Reads correlation http headers
  • Start/Stops Activity for the http request
  • Ensure the Activity ambient state is transferred thru the IIS callbacks

See http protocol specifications for details.

This http module is used by Application Insights. See documentation and code.

About

Microsoft.AspNet.CorrelationIdTracker module for tracking multi-tier activities

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages