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: allow custom journal fields #2708

Merged
merged 12 commits into from
Sep 5, 2023

Conversation

Finomnis
Copy link
Contributor

@Finomnis Finomnis commented Sep 1, 2023

Motivation

It's currently not possible to customize how messages will get send to journald.

This became aparent in #2425, where first a specific API got designed, but then it was decided that users should not get restricted in only a subset of fields, but should be able to simply choose by themselves what fields get set with what values.

So in a sense, this is the successor/rework of #2425.

Solution

Allow custom fields to be set in tracing-journald.

Open Questions

  • How should we deal with fields that also get supplied by other options? For example, setting SYSLOG_IDENTIFIER here and also setting .with_syslog_identifier() will send said field twice, potentially with differing values. Is that a problem?
    • Answer: No, this is not a problem.

`custom_field` implied that the user could set this to anything;
instead, the fields here have to be valid journal fields.
@Finomnis Finomnis marked this pull request as draft September 1, 2023 14:36
tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
@Ralith
Copy link
Collaborator

Ralith commented Sep 1, 2023

For example, setting SYSLOG_IDENTIFIER here and also setting .with_syslog_identifier() will send said field twice, potentially with differing values. Is that a problem?

This is harmless. We don't need to go way out of our way to prevent the user from deliberately sending strange things to journald.

@Finomnis Finomnis requested a review from Ralith September 3, 2023 20:48
@Finomnis Finomnis marked this pull request as ready for review September 3, 2023 20:49
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, thanks!

tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
tracing-journald/src/lib.rs Outdated Show resolved Hide resolved
@Finomnis Finomnis requested a review from Ralith September 3, 2023 23:16
@Finomnis
Copy link
Contributor Author

Finomnis commented Sep 5, 2023

@Ralith What now? Waiting for more reviewers?

@Ralith
Copy link
Collaborator

Ralith commented Sep 5, 2023

Yep, this LGTM so I expect @hawkw will merge once they have time to skim it.

@Finomnis
Copy link
Contributor Author

Finomnis commented Sep 5, 2023

@Ralith Had to fix the doctest, might need a CI retrigger

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.

overall, this looks good to me. i think we ought to make sure the behavior with duplicate fields is stated in the docs, though!

tracing-journald/src/lib.rs Show resolved Hide resolved
@Finomnis Finomnis requested a review from hawkw September 5, 2023 20:00
@hawkw hawkw enabled auto-merge (squash) September 5, 2023 20:05
@hawkw hawkw merged commit 672dfdf into tokio-rs:master Sep 5, 2023
56 checks passed
@Finomnis Finomnis deleted the custom_fields branch September 5, 2023 20:14
@Finomnis
Copy link
Contributor Author

Finomnis commented Sep 5, 2023

@hawkw Thanks :)
Any idea already when the next official release of tracing-journald that includes this will happen?

@hawkw
Copy link
Member

hawkw commented Sep 5, 2023

@Finomnis I'm hoping to get a bunch of releases out in the near future, hopefully today or tomorrow. Feel free to ping me if it doesn't happen!

@Finomnis
Copy link
Contributor Author

@hawkw Ping :)

@Finomnis
Copy link
Contributor Author

Finomnis commented Sep 25, 2023

@hawkw Ping again :) Any news? (Also pinging @Ralith in case @hawkw is busy)

davidbarsky pushed a commit that referenced this pull request Sep 26, 2023
## Motivation

It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

## Solution

Allow custom fields to be set in tracing-journald.

## Open Questions

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
## Motivation

It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

## Solution

Allow custom fields to be set in tracing-journald.

## Open Questions

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
## Motivation

It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

## Solution

Allow custom fields to be set in tracing-journald.

## Open Questions

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

Allow custom fields to be set in tracing-journald.

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

Allow custom fields to be set in tracing-journald.

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

Allow custom fields to be set in tracing-journald.

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
davidbarsky pushed a commit that referenced this pull request Sep 29, 2023
It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

Allow custom fields to be set in tracing-journald.

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
hawkw pushed a commit that referenced this pull request Oct 1, 2023
It's currently not possible to customize how messages will get send to journald.

This became apparent in #2425, where first a specific API got designed, but then
it was decided that users should not get restricted in only a subset of fields,
but should be able to simply choose by themselves what fields get set with what
values.

So in a sense, this is the successor/rework of #2425.

Allow custom fields to be set in tracing-journald.

- [x] How should we deal with fields that also get supplied by other options?
  For example, setting `SYSLOG_IDENTIFIER` here and also setting
  `.with_syslog_identifier()` will send said field twice, potentially with
  differing values. Is that a problem?
    - Answer: No, this is not a problem.

Closes #2425
@Finomnis
Copy link
Contributor Author

Finomnis commented Oct 9, 2023

@hawkw I guess you are planning to release this as tracing-journald 0.3.1. Any feeling for when this might potentially happen?

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.

4 participants