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
Go implementation log file exporter jira ticket log 1188 #979
Go implementation log file exporter jira ticket log 1188 #979
Conversation
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.
/hold
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/go-symlink-logfiles-watcher/Docker/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/go-symlink-logfiles-watcher/hack/build-component-image.sh
Outdated
Show resolved
Hide resolved
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
//Get new watcher | ||
w := &FileWatcher { | ||
metrics: prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
Name: "gofilewatcher_input_status_total_bytes_logged", |
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.
Another one for @blockloop to weigh in. There are some specific promtail conventions about the order of bytes, total etc. The fluentd metric name also should be consistent wit hthis.
internal/cmd/go-symlink-logfiles-watcher/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,17 @@ | |||
FROM openshift/origin-release:golang-1.15 AS build |
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.
Do we want a single image with two entrypoints, or two images? I was assuming two images, since we will deploy this as part of the fluentd DaemonSet not with the CLO.
Final re-naming! @pmoogi-redhat Executable: Metrics:
|
12c3aae
to
4cf01db
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.
Just a few minor renaming diffs now that we've decided on the metric names finally. Otherwise this is good to go.
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
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.
please make sure to format before pushing changes make fmt
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
|
||
func TestWatchesRealFiles(t *testing.T) { | ||
f := NewFixture(t) | ||
assert, require := assert.New(t), require.New(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.
Can this be moved into the fixture to reduce code dup
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.
@alanconway seeking your advice here.
e, err := w.watcher.Event() | ||
if err != nil { | ||
log.Error(err, "Watcher.Event returning err") | ||
os.Exit(1) |
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 don't know of any recoverable reason for an inotify FD to be closed by the kernel. The inotify object exists indepenently of any files or directories that it is watching.
We could try to re-establish the watch with timed backoff - we don't want to go into a hard CPU spin.
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
internal/cmd/logs-files-metric-exporter/symlink-logfiles-watcher.go
Outdated
Show resolved
Hide resolved
//Get new watcher | ||
w := &FileWatcher { | ||
metrics: prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
Name: "logs_files_metric_exporter_input_status_bytes_logged_total", |
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.
Locked: log_logged_bytes_total
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.
Please run make fmt
before commiting
55db0b0
to
6908a87
Compare
/approve |
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.
Please run make fmt
before sumitting
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.
Made some suggestions about handling the regexp, otherwise looks good.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pmoogi-redhat The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
pkg/k8shandler/fluentd.go
Outdated
@@ -337,6 +354,26 @@ func (clusterRequest *ClusterLoggingRequest) createOrUpdateFluentdSecret() error | |||
return nil | |||
} | |||
|
|||
func newLogMetricExporterContainer() v1.Container { | |||
resources := v1.ResourceRequirements{} |
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.
@alanconway I left this blank when I provided the PR, but how should we pass in resources here. I'm not fond of opening up the API, but maybe we need to allow a backdoor for setting mem and cpu, maybe via annotations?
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 could add a "MetricExporterSpec" to the API, I don't think that would be too bad. The API already has componet-specific requirements (FluentdSpec) so it's not making it any worse.
Alternatively we could split the Fluentd requirements - e.g. give 90% to fluentd and 10% to the exporter. We'd need to do some benchmarks to make sure that's a reasonable split but we should be doing CPU/Mem benehmarks anyway so it's useful work.
The backdoor approach means our collector is using resources that the user doesn't know about, which is not ideal.
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 would lean towards just adding to the API. This is something to clean up in the "API v2" effort when we get smarter about scaling and resource use, but it's not worse than whats already there.
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.
@pmoogi-redhat this means we need to add soming like https://github.com/openshift/cluster-logging-operator/blob/master/pkg/apis/logging/v1/clusterlogging_types.go#L35 with the resource requirements. Make sure it additionally includes the comments as these are used for the code generation
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.
@jcantrill @alanconway added changes to support LogFileMetricExportedSpec - please review my changes done in
modified: apis/logging/v1/clusterlogging_types.go
modified: k8shandler/defaults.go
modified: k8shandler/fluentd.go
Hoping above is sufficient for specifying individually resources for LogFileMetricExporter.
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.
@vimalk78 please review as well
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.
@alanconway incorporated your regex based parsing k8 filename suggestion. please see.
@pmoogi-redhat This all looks good. Add unit tests for |
e75e742
to
ac012ab
Compare
/retest |
/test lint |
1 similar comment
/test lint |
/test e2e-gcp |
1 similar comment
/test e2e-gcp |
ac012ab
to
dc12c4f
Compare
/test e2e-gcp |
9098833
to
92d982c
Compare
/test functional |
/test e2e-gcp |
1 similar comment
/test e2e-gcp |
92d982c
to
029dc99
Compare
/test functional |
/test e2e-gcp |
1 similar comment
/test e2e-gcp |
029dc99
to
5935ef3
Compare
/test e2e-gcp |
…pec to expose metric log_logged_bytes_total Delete Makefile.vimal.fix - clean up this Makefile Reverted back to quay.io hosted fluentd image and added comment in fluentd.go Changed back clo pull policy to IfNotPresent merge issue clean up in bundle and manifest csv with https scheme for log-file-metric-exporter + other review comments changes fixed https support issues fixed merge issue in fluentd.go fix to be tested Using fluentdContainer.SecurityContext quay.io hosted ci image for log-file-metric-exporter added in bundle/manifests/cluster-logging.v5.2.0.clusterserviceversion.yaml manifests/5.2/cluster-logging.v5.2.0.clusterserviceversion.yaml taking out /bin/sh -c wrapper from cmd for log-file-metric-exporter taken out dead code on exporterContainer cleanup unnecessary Volume like /usr/local/bin - not required to be mounted varlogcontainers volumemount fix exporterContainer.Command fix - flat string of command line found not working so fixed by providing slice of strings for each argv
5935ef3
to
e43f772
Compare
/test lint |
@pmoogi-redhat: The following test 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. |
/test lint |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alanconway, jcantrill, pmoogi-redhat 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 |
#979 - PR merged on golang based file watcher named as log-file-metric-exporter. It watches log files registered into its watcher object. It publishes log_logged_bytes_total for these log files. |
…-log-file-exporter-JIRA-ticket-LOG-1188 Go implementation log file exporter jira ticket log 1188
Description
Summary
Implement an independent process to monitor CRIO container log file rotations that can be used to publish total_bytes_logged metrics in prometheus format. The motivation for moving away from a Ruby implementation is Ruby is not efficient in tracking file rotations. Also collectors can change over time so making metric computation outside of fluentd for logging total_bytes_logged is more preferred.
Exposes metric endpoint that is consumable by Prometheus at port :2112
Exposes metric of total_bytes_logged
/cc @alanconway @jcantrill
/assign @jcantrill
Links
Got in_tail and prometheus plugin changes which enable total_bytes_collected metric computed and published in prometheus plugin