opentelemetry-go-contrib icon indicating copy to clipboard operation
opentelemetry-go-contrib copied to clipboard

Unable to disable pretty print when the console exporter is used

Open jpkrohling opened this issue 9 months ago • 2 comments
trafficstars

Description

When working on the example for config, I wasn't able to find a way to set "pretty print" to false for the console exporter. Example config:

logger_provider:
  processors:
    - simple:
        exporter:
          console: {}

Running the example yields this:

{
        "Timestamp": "2025-02-18T10:48:37.615276653+01:00",
        "ObservedTimestamp": "2025-02-18T10:48:37.615278311+01:00",
        "Severity": 9,
        "SeverityText": "",
        "Body": {
                "Type": "String",
                "Value": "Starting the config example"
        },
        "Attributes": [],
        "TraceID": "00000000000000000000000000000000",
        "SpanID": "0000000000000000",
        "TraceFlags": "00",
        "Resource": [
                {
                        "Key": "service.name",
                        "Value": {
                                "Type": "STRING",
                                "Value": "my-service-name"
                        }
                },
                {
                        "Key": "service.version",
                        "Value": {
                                "Type": "STRING",
                                "Value": "0.0.1-dev"
                        }
                }
        ],
        "Scope": {
                "Name": "go.opentelemetry.io/contrib/examples/config",
                "Version": "v0.3.0",
                "SchemaURL": "",
                "Attributes": {}
        },
        "DroppedAttributes": 0
}

This isn't usable other than for debugging OTel-config itself, disabling pretty-print won't likely make it MUCH better, but will at least show one record per line.

jpkrohling avatar Feb 18 '25 09:02 jpkrohling

For my own understanding, could you explain the use case for disabling pretty print? It sounds like there is a desire to have a single entry per line - what problem would that solve? Is it so that it's easy to visually count how many records have been exported by eye, while debugging?

mattsains avatar Feb 18 '25 21:02 mattsains

Is it so that it's easy to visually count how many records have been exported by eye, while debugging?

This. While the entries themselves are useless, I'd like to at least easily see which log entries were emitted, and counting them is the first step.

jpkrohling avatar Feb 20 '25 11:02 jpkrohling

I opened an issue to discuss this in the configuration working group, added it to the agenda for the next meeting.

codeboten avatar Sep 25 '25 17:09 codeboten

This was discussed at the Sept 29 working group meeting. The OTLP file exporter defined in the specification is likely the right tool to use here instead of the console exporter. This should be closed.

codeboten avatar Sep 29 '25 15:09 codeboten