-
Notifications
You must be signed in to change notification settings - Fork 155
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
Kubernetes 1.24: contextual logging blog post #304
Kubernetes 1.24: contextual logging blog post #304
Conversation
/hold Because of #281 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor suggestion, no blockers.
Group](https://github.com/kubernetes/community/blob/master/wg-structured-logging/README.md) | ||
has added new capabilities to the logging infrastructure in Kubernetes | ||
1.24. This blog post explains how developers can take advantage of those to | ||
make log output more useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: put a call for "and you can join us and help" here too, not just at the bottom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, will change it.
|
||
Now `<` and `>` markers and indention are used to ensure that splitting at a | ||
klog header at the start of a line is reliable and the output remains readable | ||
for humans: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so ... what happens if the message text contains a ">" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought they were indented differently - let me double check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the value uses \t and the end marker a single space.
This isn't visible when looking at the diff, but renders okay when looking at the full file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I see, so the delimiters are really "<\n" and "^>".
Probably does not need to be added to the blog post, then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or to be very precise, =<\n
and ^ >
(one space) with ^\t
for the lines in the middle 😅
Agreed, this doesn't need to be in the blog post.
|
||
## Next steps | ||
|
||
The Structured Logging WG is always looking for new contributors. The migration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should have a link here to https://github.com/kubernetes/community/tree/master/wg-structured-logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jberkus, pohly 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 |
6c3fd4a
to
409eabb
Compare
Comments addressed, please take another look. |
409eabb
to
5607a77
Compare
I have force-pushed an update to address the review feedback from kubernetes/website#32656 (review) |
/lgtm from me |
5607a77
to
30e7b6c
Compare
The markup was wrong in at least one place and line breaks in link text looked odd, at least on GitHub. I've reformatted those. When this lands in the blog, paragraphs will get reflown, right? I thought GitHub also did that, but apparently not. |
Bear in mind that due to #281 this needs to be approved and LGTMed and then on the day of publication (not before), unheld. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a few, small / not-merge-blocking, bits of feedback.
[Kubernetes uses it now](https://github.com/kubernetes/kubernetes/commit/17e3c555c5115f8c9176bae10ba45baa04d23a7b), | ||
or get invoked stand-alone. | ||
|
||
We are in the process of moving the tool into a [new repository](https://github.com/kubernetes/klog/issues/312) because it isn't |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are in the process of moving the tool into a [new repository](https://github.com/kubernetes/klog/issues/312) because it isn't | |
We are in the process of [moving the tool]((https://github.com/kubernetes/klog/issues/312) | |
into a new Git repository, because it isn't |
Previous link text suggested it would be a link to the new repo, but actually wasn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepted with minor syntax fix.
- [`FromContext`](https://pkg.go.dev/k8s.io/klog/v2#FromContext): from a | ||
`context` parameter, with fallback to the global logger | ||
- [`Background`](https://pkg.go.dev/k8s.io/klog/v2#Background): the global | ||
fallback, with no intention to support contextual logging | ||
- [`TODO`](https://pkg.go.dev/k8s.io/klog/v2#TODO): the global fallback, but | ||
only as a temporary solution until the function gets extended to accept | ||
a logger through its parameters | ||
- [`SetLoggerWithOptions`](https://pkg.go.dev/k8s.io/klog/v2#SetLoggerWithOptions): | ||
changes the fallback logger; when called with | ||
[`ContextualLogger(true)`](https://pkg.go.dev/k8s.io/klog/v2#ContextualLogger), | ||
the logger is ready to be called directly, in which case logging will be done | ||
without going through klog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could use a definition list if you want to. See https://www.markdownguide.org/extended-syntax/#definition-lists for syntax that CommonMark is happy with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion, I keep forgetting that definition lists sometimes work in Markdown. Changed.
The `example` prefix and `foo="bar"` were added by the caller of the function | ||
which logs the `runtime` message and `duration="1m0s"` value. | ||
|
||
An example for a unit test with per-test output is [included in klog](https://github.com/kubernetes/klog/blob/v2.60.1/ktesting/example/example_test.go). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also write, eg:
An example for a unit test with per-test output is [included in klog](https://github.com/kubernetes/klog/blob/v2.60.1/ktesting/example/example_test.go). | |
The sample code for klog includes an an | |
[example](https://github.com/kubernetes/klog/blob/v2.60.1/ktesting/example/example_test.go) | |
for a unit test with per-test output. |
which uses the active voice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepted with fix for "an an".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yep. Thanks.
Contextual logging is an enhancement that landed as alpha in Kubernetes 1.24. Because it targets primarily developers of Kubernetes at this point, publishing it under https://k8s.dev/blog on the same day as it also gets published on the main blog (see kubernetes/website#32656) makes sense.
6d42cbf
to
11c75c2
Compare
We wouldn't merge it now. We should get the approvals and reviews in place so that an unhold on the day of publication is all ready to go. |
We wouldn't merge it now. We should get the approvals and reviews in place so that an unhold on the day of publication is all ready to go. Changes since #304 (comment) look minor. |
Is kubernetes/website#32656 level with the article text as reviewed here? |
Not yet, but as this seems to be the final version now I'll copy it over. |
/hold cancel Let's publish... |
Contextual logging is an enhancement that landed as alpha in Kubernetes
1.24. Because it targets primarily developers of Kubernetes at this point,
publishing it under https://k8s.dev/blog on the same day as it also gets
published on the main blog (see
kubernetes/website#32656) makes sense.