Skip to content

Commit

Permalink
Suppress TaskParallelLibrary EventSource events.
Browse files Browse the repository at this point in the history
  • Loading branch information
karolz-ms committed Apr 18, 2017
1 parent 89e54d4 commit 307a52f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>Microsoft.Diagnostics.EventFlow.Inputs.Etw</AssemblyName>
<AssemblyOriginatorKeyFile>../../PublicKey.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<VersionPrefix>1.1.0</VersionPrefix>
<VersionPrefix>1.1.1</VersionPrefix>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Microsoft.Diagnostics.EventFlow.Inputs.Etw</PackageId>
<PackageTags>Microsoft;Diagnostics;EventFlow;Inputs;ETW;Event Tracing for Windows</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Session;
using Validation;
using Microsoft.Diagnostics.EventFlow.Utilities.Etw;

namespace Microsoft.Diagnostics.EventFlow.Inputs
{
Expand Down Expand Up @@ -73,7 +74,15 @@ public void Process(Action<EventData> onEvent)
if (!isProcessing)
{
isProcessing = true;
this.inner.Source.Dynamic.All += (traceEvent) => onEvent(traceEvent.ToEventData(this.healthReporter));
this.inner.Source.Dynamic.All += (traceEvent) =>
{
// Suppress events from TplEventSource--they are mostly interesting for debugging task processing and interaction,
// and not that useful for production tracing. However, TPL EventSource must be enabled to get hierarchical activity IDs.
if (!TplActivities.TplEventSourceGuid.Equals(traceEvent.ProviderGuid))
{
onEvent(traceEvent.ToEventData(this.healthReporter));
}
};
this.inner.Source.Process();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ public override void Dispose()

protected override void OnEventWritten(EventWrittenEventArgs eventArgs)
{
this.subject.OnNext(eventArgs.ToEventData(this.healthReporter, nameof(EventSourceInput)));
// Suppress events from TplEventSource--they are mostly interesting for debugging task processing and interaction,
// and not that useful for production tracing. However, TPL EventSource must be enabled to get hierarchical activity IDs.
if (!TplActivities.TplEventSourceGuid.Equals(eventArgs.EventSource.Guid))
{
this.subject.OnNext(eventArgs.ToEventData(this.healthReporter, nameof(EventSourceInput)));
}
}

protected override void OnEventSourceCreated(EventSource eventSource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Provides an input implementation for capturing diagnostics data sourced through System.Diagnostics.Tracing.EventSource infrastructure.</Description>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<VersionPrefix>1.1.0</VersionPrefix>
<VersionPrefix>1.1.1</VersionPrefix>
<Authors>Microsoft</Authors>
<TargetFrameworks>netstandard1.6;net46</TargetFrameworks>
<DelaySign>true</DelaySign>
Expand Down

0 comments on commit 307a52f

Please sign in to comment.