-
Notifications
You must be signed in to change notification settings - Fork 10
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
WIP: New design #27
base: main
Are you sure you want to change the base?
WIP: New design #27
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vimalk78 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 |
PR needs rebase. 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. |
RUN make build | ||
|
||
#FROM registry.access.redhat.com/ubi8 | ||
FROM centos:centos8 |
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.
is this the only way we can install "strace" and "strace-cmd
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.
This was added for debugging purpose only, will remove it.
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* | ||
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* | ||
#RUN echo 'kernel.yama.ptrace_scope = 0' >> /etc/sysctl.conf | ||
RUN yum -y install strace |
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.
is there a reason we can not collapse these statements?
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.
This was added for debugging purpose only, will remove it.
@@ -0,0 +1,7 @@ | |||
* | |||
!Makefile |
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.
Doesn't this mean to ignore the Makefile when copying?... same woth go.mod and go.sum. Don't we need these to build the image?
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.
The first line says ignore all files, except the following lines which start with !
So the entries in this file are the files which get added.
set of watch flags are used for directories and files. | ||
|
||
Watches for folders: | ||
- `IN_CREATE`: watch is triggered when a file or direcory is created in this directory. |
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.
spelling
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.
changed
as one returned in step 1. Once this happens, there are no more events received for file changes. the loop essentially halts. | ||
|
||
#### Workaround | ||
Save the watch desctiptor for files, and compare the new watch descriptor with earlier one, if same add watch again will the returned watch descriptor is different. |
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.
...add until(?) the returned watch...
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.
changed
// a new container directory got created, add a watch for this directory | ||
glog.V(3).Infof("A new container got created. container: %q", newdir) | ||
} | ||
must(n.WatchDir(newdir)) |
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.
This fails the entire process if the watch fails right? Is there no recovery from here from that which we know?
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.
Best is to restart the process
// ignore files which are not log files | ||
if strings.HasSuffix(logfile, ".log") { | ||
glog.V(3).Infof("a new log file got created: %q\n", logfile) | ||
must(n.WatchLogFile(logfile)) |
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.
Same question here
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.
Best is to restart the process
case e.IsDelete(): | ||
if e.path != "" { | ||
if e.IsDir() { | ||
// a directory got created in a directory |
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.
update or remove comment
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.
updated
case <-tickerCh: | ||
/**/ | ||
sizemtx.Lock() | ||
glog.V(0).Infof("sizes(%d): %s\nEventsSent: %d, EventsHandled: %d\n", len(Sizes), func(m map[string]int64) string { |
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.
This looks like we should bump the verbosity since Marshalling is likely an expensive operation. Should the marshal actually have a if block around the actual work so it only happens when v>X
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.
This is for debugging purpose only, will remove this once metrics are added.
n.mtx.RUnlock() | ||
|
||
l := strings.Join(wl, ",\n") | ||
glog.V(0).Infof("Watching paths: \n%s\nTotal watches: %d\n", l, len(wl)) |
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.
same here. seems expensive
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.
This is like a running log of paths being watched and is also for debugging purpose. It is getting printed once every tick, which can be made configurable, and log level changed to 3.
@vimalk78 I've been poking around. You don't need to create a separate watch for every file. A watch on a directory will also be notified about events to files in that directory, with the file name in the event. That may solve your mystery with running into the same watch descriptor and hanging - perhaps you are running out of watch descriptors. Watching files only will reduce the number greatly. That does create a problem with ONESHOT - while you're not watching the directory you could miss file create/delete events. Possibly you can solve that by having 2 watches per directory. One is only for create/delete and is not ONESHOT. Here's a demos:
|
@vimalk78: The following tests failed, say
Full PR test history. Your PR dashboard. 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. |
This PR attempts to rewrite the log-metrics-file-exporter with a new design.
Earlier design used linux inotify via package
github.com/fsnotify/fsnotify
, which abstarcts inotify callbacks with its own defined values. Also adding aIN_MODIFY
watch on a log file generates too many events which very quickly leads to overflow error.New design directly uses
golang.org/x/sys/unix
package to use inotify for better control, and usesIN_ONESHOT
flag to reduce the number of events generated when log files are written. Please see DESIGN.md for details./cc @jcantrill @alanconway
/hold