Skip to content

Listening to event counters make full events to be written to the EventPipe #112415

Open
@verdie-g

Description

@verdie-g

Description

A side-car app is listening to all well-known EventCounters of the main app using a similar code as this

Dictionary<string, string> eventCounterArguments = new() { ["EventCounterIntervalSec"] = "10" };
string[] providerNames = ["System.Runtime", "Microsoft.AspNetCore.Hosting", "Microsoft-AspNetCore-Server-Kestrel", "System.Net.Http", "System.Net.Sockets", "System.Net.NameResolution"];
var providers = providerNames
    .Select(n => new EventPipeProvider(n, EventLevel.Informational, 0, eventCounterArguments))
    .ToArray();
EventPipeSessionConfiguration config = new(providers, requestRundown: false, requestStacks: false);

DiagnosticsClient diagnosticsClient = new(pid);
var session = await diagnosticsClient.StartEventPipeSessionAsync(config, CancellationToken.None);
EventPipeEventSource source = new(session.EventStream);
source.Dynamic.All += evt =>
{
    if (evt.EventName == "EventCounters")
    {
        // ...
    }
};

I'm expecting that it would enable some code path that increment some counters and periodic counter events to be sent to the pipe. But in this perf flamegraph, you can see that outgoing HTTP requests seem to write an event which is not expected.
flamegraph
Same issue with incoming requests
Image

Is there a way to only listen to HTTP counters without the full HTTP events?

Configuration

  • Linux x64
  • CentOS 8
  • .NET 8

Regression?

Unknown.

Data

The full flamegraph contains too much sensitive info.

Workaround

We could use the OTEL metrics that I think expose the same data but we are years away from that in my company.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tracing-coreclrquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions