diagnostics: Unable to set providers using EventPipeConfig

Probably this is not a bug, but me doing it wrong.

I’m using .NET 6.0.107.

I have an app:

var client = new HttpClient();

var response = await client.GetAsync("https://nuget.org");

Console.WriteLine(response.StatusCode);

I’d like to see a trace that includes the HTTP events.

I’ve set these variables:

DOTNET_EventPipeConfig=*
COMPlus_EventPipeOutputPath=/tmp/trace
COMPlus_EventPipeConfig=*
COMPlus_EnableEventPipe=1

I execute the app:

bin/Debug/net6.0/console

I now have a file at /tmp/trace.

I read it (on another shell that doesn’t have the envvars set) using:

using System;
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Etlx;
using Microsoft.Diagnostics.Tracing.Parsers;

namespace console
{
    class Program
    {

        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("You must specify a nettrace file.");
                return;
            }

            using (var traceLog = new TraceLog(TraceLog.CreateFromEventPipeDataFile(args[0])))
            {
                var traceSource = traceLog.Events.GetSource();

                traceSource.AllEvents += delegate (TraceEvent data) {
                    Console.WriteLine("{0}", data);
                };

                traceSource.Process();

           }
        }
    }
}

The output doesn’t have any HTTP events.

cc @noahfalk @dotnet/area-system-diagnostics-tracing @adamsitnik

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

Enabling all providers is an easy way to get everything, or to identify the ones you are really interested in.

It’s not uncommon to have to deal with a ton of trace data to debug a problem.