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

Upgrade dskit and improve log.InitLogger function #2799

Closed
wants to merge 1 commit into from

Conversation

duricanikolic
Copy link

@duricanikolic duricanikolic commented Aug 17, 2023

What this PR does:
This PR upgrades dskit and uses dskit's log package for the creation of the global logger.
For the main in the dskit see grafana/dskit#359.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@CLAassistant
Copy link

CLAassistant commented Aug 17, 2023

CLA assistant check
All committers have signed the CLA.

@duricanikolic duricanikolic force-pushed the yuri/dskit-log-update branch 2 times, most recently from 6a1a4f7 to 058cbff Compare August 17, 2023 14:35
@duricanikolic duricanikolic force-pushed the yuri/dskit-log-update branch from 058cbff to bae7aa7 Compare August 17, 2023 15:07
@duricanikolic duricanikolic self-assigned this Aug 17, 2023
Copy link
Contributor

@zalegrala zalegrala 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. Just one question about the stack depth change.

// add support for level based logging
logger = level.NewFilter(logger, LevelFilter(cfg.LogLevel.String()))
// use UTC timestamps and skip 5 stack frames.
logger = kitlog.With(logger, "ts", kitlog.DefaultTimestampUTC, "caller", kitlog.Caller(5))
Copy link
Contributor

Choose a reason for hiding this comment

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

What does it mean to change the call stack depth here? Do we now report a different line is doing the logging?

Copy link
Author

@duricanikolic duricanikolic Aug 19, 2023

Choose a reason for hiding this comment

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

Hi @zalegrala,
The reason for that is the implementation of dslog.NewGoKitWithWriter(), that is now used to create the actual logger, and that replaces the “manual” creation that was used before.
I did a manual test to check the outcome and it prints the same source and line it used to print before my change.
I will prepare a Unit test that ensures the right thing is printed once I am back from PTO. I will also replace the usage of RateLimitedLogger with the one from dskit.

@github-actions
Copy link
Contributor

This PR has been automatically marked as stale because it has not had any activity in the past 60 days.
The next time this stale check runs, the stale label will be removed if there is new activity. This pull request will be closed in 15 days if there is no new activity.
Please apply keepalive label to exempt this Pull Request.

@github-actions github-actions bot added the stale Used for stale issues / PRs label Oct 19, 2023
@github-actions github-actions bot closed this Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Used for stale issues / PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants