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

Use constants for structured logging field names #252

Open
jannfis opened this issue Dec 10, 2024 · 0 comments
Open

Use constants for structured logging field names #252

jannfis opened this issue Dec 10, 2024 · 0 comments
Labels
good first issue Good for newcomers kind/task Tasks, chores, etc optimization Optimization of existing feature
Milestone

Comments

@jannfis
Copy link
Collaborator

jannfis commented Dec 10, 2024

Is your task related to a problem? Please describe.

We use structured logging to help log ingestion tools filter information. However, the names we use for the structured fields are given as string literals and are inconsistent, all over the place, and leave much room for more inconsistency in the future. We probably also use some fields that are either redundant, or not required. Then, we use a stupid idiom of having a log() function per package that returns a logrus entry we use as a starting point for logging.

Describe the solution you'd like

We should go through all packages and see a) whether all field names make sense and remove those that don't and b) replace the package's log() function by using a more central function (in its own package).

We should replace the string literals for fields by centrally defined constants to define the available and valid field names for structured logging. This will help gaining some consistency and will improve user experience.

The available fields should be pointed to in the logging section of the contributor's documentation, along with a note that people must not use string literals for fields but rather introduce a new constant.

Describe alternatives you've considered

Additional context

@jannfis jannfis added kind/task Tasks, chores, etc good first issue Good for newcomers optimization Optimization of existing feature labels Dec 10, 2024
@jannfis jannfis added this to the v0.2.0 milestone Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/task Tasks, chores, etc optimization Optimization of existing feature
Projects
None yet
Development

No branches or pull requests

1 participant