How to disable stacks for EventSource events?

330 views Asked by At

Using .Net Core 3.1

I've implemented my event source like this:

[EventSource(Name = "RequestStatistics-Events")]
public sealed class RequestEventsProvider : EventSource
{
    public RequestEventsProvider() : base(throwOnEventWriteErrors: false)
    {
    }

    [Event(1, Level = EventLevel.Informational, Opcode = EventOpcode.Info)]
    public void RequestProcessed(string requestPath, int responseCode, long processingTime)
    {
        WriteEvent(1, requestPath, responseCode, processingTime);
    }
}

Then I collect tracing with dotnet-trace like this:

dotnet-trace collect --providers RequestStatistics-Events -p 23544

Then I open tracelog in PerfView and see my events: Events collected with dotnet-trace

As you can see every event contains stack within. It creates additional overhead though it is absolutely useless in my scenario. How can I disable stack collection?

Another question is: is it possible to disable stacks for Microsoft-Diagnostics-DiagnosticSource provider? I saw something like this in PerfView logs:

Enabling Provider:Microsoft-Diagnostics-DiagnosticSource Level:Informational Keywords:0xfffffffffffff7ff Stacks:1 Values:...blabla...

and I,ve tried to run collection with "stacks" key-value pair:

Microsoft-Diagnostics-DiagnosticSource:0xfffffffffffff7ff:4:Stacks=0

but it didn't affect anything.

0

There are 0 answers