Skip to content
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

Add Prometheus monitoring endpoint #28

Merged
merged 4 commits into from
Apr 26, 2023
Merged

Add Prometheus monitoring endpoint #28

merged 4 commits into from
Apr 26, 2023

Conversation

dgl
Copy link
Contributor

@dgl dgl commented Oct 25, 2022

Add Prometheus monitoring endpoint

Adds an optional HTTP server, with a metrics endpoint available on /metrics. This allows for Prometheus compatible metrics to be collected; currently it adds no metrics specific to seccompagent, but those could be added later.

This adds a dependency on github.com/prometheus/client_golang, I've updated vendoring as a result (in a different commit, ideally don't squash merge this to keep the history clearer).

How to use

Run seccompagent with the monitor listen option set to a port.

Testing done

$ ./seccompagent -monitor-listen :9929
$ curl localhost:9929/metrics
[returns metrics]

Copy link
Member

@alban alban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have ideas of metrics to add?

cmd/seccompagent/seccompagent.go Outdated Show resolved Hide resolved
@dgl
Copy link
Contributor Author

dgl commented Jan 25, 2023

Sorry for the delay; I've now added a middleware to have include metrics on the syscalls made and a small histogram.

Note this is useful even without the middleware, just being able to monitor the process is running via metrics and the Go level metrics can be useful.

@stackedsax
Copy link

Hey there @alban, any other feedback for @dgl on this?

dgl added 4 commits April 24, 2023 21:10
Currently this has no specific metrics for seccompagent, aside from
Go built-in build info.
This adds an optional middleware to get Prometheus metrics for request
latencies as a histogram.
@rata rata requested a review from alban April 24, 2023 14:00
@rata
Copy link
Member

rata commented Apr 24, 2023

@alban can you please take a look again?

}).Error("Error in decoding syscall")
}

r := h(fd, req)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not measuring the duration of the syscall by the target process, but how long the seccomp agent takes to emulate the syscall (if such a handler is used for emulating the syscall).

I am curious about your use case and what syscall you emulate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main one is allowing mount, we have a few more changes (I will open PRs for those soon) to allow network filesystems and that's definitely a place where these metrics are useful.

Copy link
Member

@alban alban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

I am pondering removing the vendor directory from git. But that's unrelated to this PR.

@alban alban merged commit 7a1914b into kinvolk:main Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants