Skip to content

bugfix: add newline in stdout exporter#6848

Merged
jack-berg merged 4 commits intoopen-telemetry:mainfrom
zeitlinger:stdout-newline
Nov 5, 2024
Merged

bugfix: add newline in stdout exporter#6848
jack-berg merged 4 commits intoopen-telemetry:mainfrom
zeitlinger:stdout-newline

Conversation

@zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Nov 4, 2024

fixes #6836

@zeitlinger zeitlinger requested a review from a team as a code owner November 4, 2024 11:10
@codecov
Copy link

codecov bot commented Nov 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.49%. Comparing base (ef03239) to head (a732cbf).
Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6848      +/-   ##
============================================
- Coverage     90.49%   90.49%   -0.01%     
- Complexity     6599     6600       +1     
============================================
  Files           731      731              
  Lines         19738    19742       +4     
  Branches       1938     1938              
============================================
+ Hits          17862    17865       +3     
  Misses         1285     1285              
- Partials        591      592       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

private static String toPattern(String expected) {
Map<String, String> replacePatterns = new HashMap<>();
replacePatterns.put("timestamp", "[0-9]+(\\.[0-9]+)?");
String timestampPattern = "[0-9]+(\\.[0-9]+)?";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fixing a flaky test, because nanos are omitted if 0

@zeitlinger
Copy link
Member Author

@jack-berg can you take a look?

}

/** Marshals into the {@link JsonGenerator} in proto JSON format and adds a newline. */
public final void writeJsonWithNewline(JsonGenerator output) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this code call output.writeRaw('\n') or should StreamJsonWriter? Seems like an implementation detail of StreamJsonWriter to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried calling from StreamJsonWriter, but this method closes the generator, so it fails

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jack-berg can you check again?

Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jack-berg jack-berg merged commit a6b3302 into open-telemetry:main Nov 5, 2024
@zeitlinger zeitlinger deleted the stdout-newline branch November 6, 2024 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResourceLogs emitted by experimental-otlp/stdout lack line breaks being incompatible with the OTelCol otlpjson connector

2 participants