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

tracing-journald: Write literal string values to journal #1714

Merged
merged 1 commit into from Nov 20, 2021
Merged

tracing-journald: Write literal string values to journal #1714

merged 1 commit into from Nov 20, 2021

Conversation

swsnr
Copy link
Contributor

@swsnr swsnr commented Nov 10, 2021

See #1710: Do not write strings in Debug representation.

Motivation

As discussed in #1710 writing strings literally makes tracing-journald behave like other journal clients, and allows 3rd party journal readers to extract the original value from the journal without having to "un"-parse the Debug representation of Rust strings.

@swsnr swsnr requested review from davidbarsky, hawkw and a team as code owners November 10, 2021 18:20
@swsnr
Copy link
Contributor Author

swsnr commented Nov 10, 2021

@Ralith Would you mind to take a look? I'm not entirely happy with this code, but I'm not sure how to make it better, short of a refactoring of all these put_ functions 🤔

tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
@swsnr swsnr changed the title Write literal string values to jounral tracing-journald: Write literal string values to journal Nov 11, 2021
@swsnr swsnr requested review from Ralith and removed request for a team November 11, 2021 19:23
Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

LGTM aside from one cosmetic issue

tracing-journald/tests/journal.rs Outdated Show resolved Hide resolved
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

this looks good to me, beyond the outdated comment that @Ralith commented on; I think we should probably just remove that.

tracing-journald/tests/journal.rs Outdated Show resolved Hide resolved
tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
@swsnr swsnr requested review from hawkw and Ralith November 15, 2021 20:13
Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Thanks!

@swsnr
Copy link
Contributor Author

swsnr commented Nov 20, 2021

@hawkw I've rebased onto master and address all remaining change requests; would you mind to take another look? 😊

@hawkw hawkw merged commit 01f93a7 into tokio-rs:master Nov 20, 2021
@swsnr swsnr deleted the 1710-journald-display-strings branch November 20, 2021 22:56
hawkw pushed a commit that referenced this pull request Dec 2, 2021
See #1710: Do not write strings in Debug representation.

## Motivation

As discussed in #1710 writing strings literally makes tracing-journald
behave like other journal clients, and allows 3rd party journal readers
to extract the original value from the journal without having to
"un"-parse the Debug representation of Rust strings.

Fixes #1710.
@hawkw hawkw mentioned this pull request Dec 2, 2021
hawkw pushed a commit that referenced this pull request Dec 3, 2021
See #1710: Do not write strings in Debug representation.

## Motivation

As discussed in #1710 writing strings literally makes tracing-journald
behave like other journal clients, and allows 3rd party journal readers
to extract the original value from the journal without having to
"un"-parse the Debug representation of Rust strings.

Fixes #1710.
hawkw pushed a commit that referenced this pull request Dec 19, 2021
See #1710: Do not write strings in Debug representation.

## Motivation

As discussed in #1710 writing strings literally makes tracing-journald
behave like other journal clients, and allows 3rd party journal readers
to extract the original value from the journal without having to
"un"-parse the Debug representation of Rust strings.

Fixes #1710.
hawkw pushed a commit that referenced this pull request Dec 19, 2021
See #1710: Do not write strings in Debug representation.

## Motivation

As discussed in #1710 writing strings literally makes tracing-journald
behave like other journal clients, and allows 3rd party journal readers
to extract the original value from the journal without having to
"un"-parse the Debug representation of Rust strings.

Fixes #1710.
hawkw pushed a commit that referenced this pull request Dec 20, 2021
See #1710: Do not write strings in Debug representation.

## Motivation

As discussed in #1710 writing strings literally makes tracing-journald
behave like other journal clients, and allows 3rd party journal readers
to extract the original value from the journal without having to
"un"-parse the Debug representation of Rust strings.

Fixes #1710.
hawkw added a commit that referenced this pull request Dec 30, 2021
# 0.2.1 (December 29, 2021)

This release improves how `tracing-journald` communicates with `journald`,
including the handling of large payloads.

### Added

- Use an unconnected socket, so that logging can resume after a `journald`
  restart ([#1758])

### Fixed

- Fixed string values being written using `fmt::Debug` ([#1714])
- Fixed `EMSGSIZE` when log entries exceed a certain size ([#1744])

A huge thank-you to new contributor @lunaryorn, for contributing all of the
changes in this release!

[#1714]: #1714
[#1744]: #1744
[#1758]: #1758
hawkw added a commit that referenced this pull request Dec 30, 2021
# 0.2.1 (December 29, 2021)

This release improves how `tracing-journald` communicates with `journald`,
including the handling of large payloads.

### Added

- Use an unconnected socket, so that logging can resume after a `journald`
  restart ([#1758])

### Fixed

- Fixed string values being written using `fmt::Debug` ([#1714])
- Fixed `EMSGSIZE` when log entries exceed a certain size ([#1744])

A huge thank-you to new contributor @lunaryorn, for contributing all of the
changes in this release!

[#1714]: #1714
[#1744]: #1744
[#1758]: #1758
Comment on lines +334 to +336
/// `value` must not contain an internal newline.
///
/// For a "newline-safe" variant, see `put_field_length_encoded`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Revisiting these comments, is this correct? We're using length-prefixing, so per https://systemd.io/JOURNAL_NATIVE_PROTOCOL/ internal newlines in the value are fine. put_field_length_encoded uses exactly the same encoding, it just doesn't require the length to be known in advance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps not. It really looks as if both function are the same…but I only took a superficial look 🤔

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.

None yet

3 participants