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

StartFlushDaemon: add API with more control over flushing #307

Merged
merged 1 commit into from Mar 16, 2022

Conversation

pohly
Copy link

@pohly pohly commented Mar 16, 2022

/kind feature

What this PR does / why we need it:

Previously, periodic flushing was started automatically when writing to
buffered files for the first time. When writing to a Logger which buffers
internally, then using the same periodic flushing makes sense. In that case it
has to be started explicitly.

The new call grants the caller control over the flush interval. Kubernetes has
a parameter for that.

Special notes for your reviewer:

This will be used to fix a race condition that was found in Kubernetes' own periodic flushing.

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

The new StartFlushDaemon API call grants the klog user more control over the periodic flushing.

Previously, periodic flushing was started automatically when writing to
buffered files for the first time. When writing to a Logger which buffers
internally, then using the same periodic flushing makes sense. In that case it
has to be started explicitly.

The new call grants the caller control over the flush interval. Kubernetes has
a parameter for that.
@pohly
Copy link
Author

pohly commented Mar 16, 2022

/hold

Let's do a full test run with this code in Kubernetes: kubernetes/kubernetes#108725

StopFlushDaemon()
logging.flushD.run(interval)
}

Copy link
Author

@pohly pohly Mar 16, 2022

Choose a reason for hiding this comment

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

This gets used in Kubernetes like this:

kubernetes/kubernetes@1fda093

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 16, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 16, 2022
@dims
Copy link
Member

dims commented Mar 16, 2022

/assign @thockin @serathius

@pohly
Copy link
Author

pohly commented Mar 16, 2022

/hold cancel

Test in Kubernetes with usage of the new API call was successful.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 16, 2022
Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Seems OK to me.
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 16, 2022
@dims
Copy link
Member

dims commented Mar 16, 2022

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot merged commit 263155b into kubernetes:main Mar 16, 2022
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, pohly, thockin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants