-
Notifications
You must be signed in to change notification settings - Fork 40k
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
JSON output streams #104873
JSON output streams #104873
Conversation
/remove-sig api-machinery |
I'm undecided. We add new fields here without a clear indication of their stability level and I am wondering whether we should be doing this better somehow. That they appear in Let's finish the review of this change (coding style, naming) but not merge quite yet, so: /hold |
@thockin: do you have an opinion whether the approach from 4ca3a97 (= embed arbitrary, logging backend specific parameters) is better than the one from fae0253 (= hard-code support for JSON in the LoggingConfiguration, regardless whether that backend is registered)? The commit messages explain both. You probably looked at the overall change, which is using the approach with hard-coding because that is the more recent commit. I'll squash once I know which approach is preferred. |
I will almost always take a strongly-typed solution over a map. In this case, I have a hard time making up reasons why a map would be reasonable - we're not going to add a dozen formats, right? |
Probably not. It's mostly a conceptual issue: But I guess that's okay. In practice, there will only be binaries with "text+json" and those where "json" hasn't been enabled yet, which should become fewer over time. The |
Let's keep the discussion around versioning of the struct separate, i.e. proceed with merging this PR. To ensure that there's no confusion about the stability level of the new command line flags and configuration fields, I added an I did not insert I rebased because the registry refactoring was merged earlier in a separate PR, so now this PR became a bit simpler because it only needs to change the /hold cancel |
19098e8
to
d64da23
Compare
d64da23
to
56c2b58
Compare
The Quantity type itself cannot be used because the Set method has the wrong signature. Embedding Quantity inside a new QuantityValue type makes it possible to inherit most of the methods while overriding the Set method.
56c2b58
to
6f1b990
Compare
@pohly: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest Unrelated test flake. |
This implements the replacement of klog output to different files per level with optionally splitting JSON output into two streams: one for info messages on stdout, one for error messages on stderr. The info messages can get buffered to increase performance. Because stdout and stderr might be merged by the consumer, the info stream gets flushed before writing an error, to ensure that the order of messages is preserved. This also ensures that the following code pattern doesn't leak info messages: klog.ErrorS(err, ...) os.Exit(1) Commands explicitly have to flush before exiting via logs.FlushLogs. Most already do. But buffered info messages can still get lost during an unexpected program termination, therefore buffering is off by default. The new options get added to the v1alpha1 LoggingConfiguration with new command line flags. Because it is an alpha field, changing it inside the v1beta kubelet config should be okay as long as the fields are clearly marked as alpha.
6f1b990
to
b22263d
Compare
Thanks! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 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 |
What type of PR is this?
/kind feature
/kind api-change
What this PR does / why we need it:
Split-routing and buffering increase the scalability of logging. See also kubernetes/enhancements#2912 (comment) and other comments in that PR.
Special notes for your reviewer:
Includes #105480
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
New command line flags:
New options for kubelet config: