-
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
pkg/kubelet/logs: Add container log size metric #70749
Conversation
/assign @derekwaynecarr i am wondering why we would not put some of this logic in cri stats provider so we can avoid listing containers all over code base, i need to take a deeper look to know pros/cons. |
pkg/kubelet/logs/metrics.go
Outdated
} | ||
podMetadata := pod.GetMetadata() | ||
|
||
ch <- prometheus.MustNewConstMetric(descLogSize, prometheus.GaugeValue, float64(info.Size()), podMetadata.GetNamespace(), podMetadata.GetName(), container.GetMetadata().GetName(), id) |
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.
small nit: would you mind putting this across multiple lines? Thanks.
I did indeed find something in the cri stats provider so I will rework this PR to reuse that logic. |
d798814
to
553a574
Compare
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 structural change, otherwise this is good for me.
pkg/kubelet/kubelet.go
Outdated
@@ -711,6 +712,8 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration, | |||
runtimeService, | |||
imageService, | |||
stats.NewLogMetricsService()) | |||
|
|||
prometheus.MustRegister(klet.StatsProvider.Collector()) |
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.
typically, we have put registration of collectors under kubelet/metrics/metrics.go, see the Register function there.
Can you move this under initializeModules
where it calls metrics.Register
and pass in the additional collector?
/retest |
/test pull-kubernetes-local-e2e-containerized |
/milestone v1.13 /priority important-soon |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brancz, derekwaynecarr 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
What this PR does / why we need it:
Unless an additional DaemonSet that has the same permissions as the kubelet is deployed there is currently no way to monitor the size and thus the amount of logs written by a Kubernetes cluster's pods/containers.
Special notes for your reviewer:
This is not technically a feature, but more of a small enhancement for monitoring logs, in my opinion it should be fine to merge for 1.13 as long as it merges until code-freeze.
Does this PR introduce a user-facing change?:
Not an end-user facing change, but an additional metrics to be used for monitoring by cluster admins.
/sig instrumentation
@kubernetes/sig-instrumentation-pr-reviews
@kubernetes/sig-node-pr-reviews