opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

[feature request] ConsoleExporter - Improve Metric output format

Open cijothomas opened this issue 5 months ago • 0 comments

Package

OpenTelemetry.Exporter.Console

Is your feature request related to a problem?

Metric Name: MyFruitCounter
(2025-07-17T15:41:35.8540540Z, 2025-07-17T15:41:35.8580300Z] color: red name: apple
Metric Type: LongSum

Value: 6
Instrumentation scope (Meter):
	Name: MyCompany.MyProduct.MyLibrary
	Version: 1.0
Resource associated with Metric:
	telemetry.sdk.name: opentelemetry
	telemetry.sdk.language: dotnet
	telemetry.sdk.version: 1.12.1-alpha.0.71
	service.name: unknown_service:getting-started-console
(2025-07-17T15:41:35.8540540Z, 2025-07-17T15:41:35.8580300Z] color: yellow name: lemon
Metric Type: LongSum

Value: 7
Instrumentation scope (Meter):
	Name: MyCompany.MyProduct.MyLibrary
	Version: 1.0
Resource associated with Metric:
	telemetry.sdk.name: opentelemetry
	telemetry.sdk.language: dotnet
	telemetry.sdk.version: 1.12.1-alpha.0.71
	service.name: unknown_service:getting-started-console
(2025-07-17T15:41:35.8540540Z, 2025-07-17T15:41:35.8580300Z] color: green name: apple
Metric Type: LongSum

Value: 2
Instrumentation scope (Meter):
	Name: MyCompany.MyProduct.MyLibrary
	Version: 1.0
Resource associated with Metric:
	telemetry.sdk.name: opentelemetry
	telemetry.sdk.language: dotnet
	telemetry.sdk.version: 1.12.1-alpha.0.71
	service.name: unknown_service:getting-started-console

The above shows an example output for Metrics exporter. It looks to be repeating Resource info and InstrumentationScope(Meter) information for each and every data point.

This can be improved!

  1. Resource can be printed just once, as it is fixed for entire exported items.
  2. InstrumentationScope can be printed once per Metric.

This'll make it much easier to follow the output. It maybe worth considering to adopt the same format used by Collector's debug output - that one is very human readable.

What is the expected behavior?

Description has the details.

Which alternative solutions or features have you considered?

None.

Additional context

No response

cijothomas avatar Jul 17 '25 15:07 cijothomas