Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdoutlog: Do not print timestamps when WithoutTimestamps is set #5175

Closed
Tracked by #5055
XSAM opened this issue Apr 7, 2024 · 3 comments · Fixed by #5241
Closed
Tracked by #5055

stdoutlog: Do not print timestamps when WithoutTimestamps is set #5175

XSAM opened this issue Apr 7, 2024 · 3 comments · Fixed by #5241
Assignees
Labels
area:logs Part of OpenTelemetry logs pkg:exporter:otlp Related to the OTLP exporter package
Milestone

Comments

@XSAM
Copy link
Member

XSAM commented Apr 7, 2024

Shouldn't these be

	Timestamp                 *time.Time
	ObservedTimestamp         *time.Time

To nicely handle WithoutTimestamps?

Here is why: https://go.dev/play/p/-a5jI4jOXSK

AFAIK this would be a different behaviour that we have for stdoutmetric and stdouttrace.

We can handle it via a separate issue and PR as we may have different opinions.

Originally posted by @pellared in #5172 (comment)

This was referenced Apr 7, 2024
@pellared pellared changed the title Print null for the zero-value timestamp in output of the stdout exporter stdoutlog: Do not print timestamps when WithoutTimestamps is set Apr 8, 2024
@pellared
Copy link
Member

pellared commented Apr 8, 2024

I have forgotten to mention that omitempty should be added e.g.

Timestamp         *time.Time `json:",omitempty"`
ObservedTimestamp *time.Time `json:",omitempty"`

@pellared pellared added area:logs Part of OpenTelemetry logs pkg:exporter:otlp Related to the OTLP exporter package labels Apr 8, 2024
@XSAM XSAM self-assigned this Apr 12, 2024
@XSAM
Copy link
Member Author

XSAM commented Apr 15, 2024

I am hesitant to implement this, as the data has been used in the stdoutmetric and stdouttrace is exported structure. Changing these structures would bring break changes.

// StartTime is when the timeseries was started. (optional)
StartTime time.Time `json:",omitempty"`
// Time is the time when the timeseries was recorded. (optional)
Time time.Time `json:",omitempty"`

StartTime time.Time
EndTime time.Time

If we only implement this only for stdoutlog, then the behavior is different from what we have for stdoutmetric and stdouttrace, which is strange.

@pellared
Copy link
Member

Changing these structures would bring break changes.

From https://pkg.go.dev/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric:

The exporter is intended to be used for testing and debugging, it is not meant for production use. Additionally, it does not provide an interchange format for OpenTelemetry that is supported with any stability or compatibility guarantees.

I would not consider it breaking.

But I also to not have a strong opinion to have this issue addressed.

It would be good to have other opinions and maybe discuss it during SIG meeting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logs Part of OpenTelemetry logs pkg:exporter:otlp Related to the OTLP exporter package
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants