open-telemetry / opentelemetry-dotnet

The OpenTelemetry .NET Client
https://opentelemetry.io
Apache License 2.0
3.19k stars 755 forks source link

Add a top-level `UseDebugExporter()` convenience method. #5671

Open martinjt opened 4 months ago

martinjt commented 4 months ago

Package

OpenTelemetry.Exporter.Console

Is your feature request related to a problem?

No response

What is the expected behavior?

I think we should have a new API for adding debug exporting across all signals.


builder.Services.AddOpenTelemetry()
    .UseDebugExporter()

This would add the Console exporter for each of the signals.

I think this also makes it clear that this is for "debug" and not a console output of data.

It's also inline with the new UseOtlpExporter() that was added at the top level.

Which alternative solutions or features have you considered?

We can keep doing what we have been, and using the individual console exporter lines, this is mainly a convenience and also something to bring it inline with the OTLP exporter as the 2 most commonly used for both production and getting started usecases.

Additional context

No response

KennethHoff commented 3 months ago

Shouldn't this be called UseConsoleExporter? It's presumably not using the Debug.* API.

CodeBlanch commented 3 months ago

I am supportive of a cross-cutting UseConsoleExporter extension! I intended to add a lot more cross-cutting things but my efforts have been stalled by #5325. Without a way for .NET Framework/non-host users to use those extensions it didn't seem like a great investment. But it looks like we'll be able to get that API done soon (just waiting for 1.9.0 to go out before adding anything).

Vision: https://github.com/open-telemetry/opentelemetry-dotnet/pull/5262#discussion_r1468170598

On there it is called "AddConsoleExporter" but that was before we settled on "Use" for the OTLP one.