-
Notifications
You must be signed in to change notification settings - Fork 486
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 new ebpf
integration
#1478
Add new ebpf
integration
#1478
Conversation
d1c9f28
to
63df638
Compare
//go:build linux && ebpf_enabled | ||
// +build linux,ebpf_enabled |
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.
IMO for now I'd ready have stuff like this be opt out (i.e., the default behavior is to build everything and you use tags to disable specific things).
Can the tag be !noebpf
? We use nodocker
and nonetwork
for disabling specific types of tests.
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 issue which prompted the opt-in tag is that the Linux agent builds would fail unless some specific system packages are installed (due to the Go->eBPF bindings dependency, which in turn requires specific kernel versions).
$ go build . # on linux system without support for bcc
# github.com/iovisor/gobpf/bcc
../../vendor/github.com/iovisor/gobpf/bcc/module.go:32:10: fatal error: 'bcc/bcc_common.h' file not found
#include <bcc/bcc_common.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
I'm not sure what's an elegant way to handle this. Bundling the required C headers, and somewhat complicating our build pipeline?
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 can update tools/seego/Dockerfile (it has apt, it's Debian-based) to install dependencies. We do this already in the main Dockerfile to install systemd headers, and extending the build image to include our specific changes would be the way to do this IMO.
I think we can assume the kernel version is new enough, the platforms we'll be mainly building on should have kernels newer than ones from 2017.
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 see. We'll also need to add the dependencies when linting.
My main concern here is that people who build from source on Linux, might be confused when go build
fails with that cryptic message. On one hand, they would already need the systemd headers as you mentioned, but I'm not sure that bcc is also something they'd expect to need if they're not using eBPF.
I'll try to find a way to make it work and report back :)
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.
That's fair :) We can document it in our contribution guide (we should probably be mentioning systemd there too but we're not at the moment). Do you think that would be helpful enough?
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.
If we're keeping track of build dependencies in the contribution guide we should probably make sure we link to that from our README, too.
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.
Yeah, that would make sense ^^
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 added a small note about these two dependencies on our contribution guide 323fb00.
Do we still want to have a noebpf
flag to make it easier for people to contribute?
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.
LGTM, the integration seems fine % my nits and comment about finding a way to build this by default in our CI setup.
exp, err := exporter.New(ebpf_config.Config{Programs: e.cfg.Programs}) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to create ebpf exporter with input config: %s", err) | ||
} | ||
|
||
err = exp.Attach() | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to attach ebpf exporter: %s", err) | ||
} |
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.
Will it cause any problems if two of these are created? We should make sure this still works with /-/reload
support.
(We guarantee that Run
will only be called once per config, but NewIntegration
may be called while the previous instance is still running)
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.
No, I don't think that there will be any issues.
I tested on a Linux VPS, changing various bits of configuration, enabling/disabling the integration and reloading each time; it seemed to work nicely.
This PR has been automatically marked as stale because it has not had any activity in the past 30 days. |
Commenting here to un-stale. I want to check if any new ebpf packaging has been contributed upstream, especially after we changed to a new Debian base image. |
46456ec
to
49d73fd
Compare
323fb00
to
b77c16e
Compare
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
…helper Signed-off-by: Paschalis Tsilias <paschalist0@gmail.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
…go tbh" This reverts commit 5f755e8.
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
fc61215
to
63f2d62
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.
Looks good to me
This reverts commit 6b5313a.
This reverts commit 6b5313a. Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
This reverts commit 6b5313a.
PR Description
This PR adds a v2 integration based on cloudflare's ebpf_exporter.
One limitation of the specific exporter is that it doesn't support uprobes/uretprobes. While I was able to fork the exporter and patch in support for those, I thought we'd keep this simple for the time being and create a first version which worked as-is.
The user configures a number of ebpf "programs", which are then attached to the correct place in the kernel. The exporter reads and decodes values from an eBPF map, exposing them as Prometheus metrics.
Which issue(s) this PR fixes
No issue, this came out of the Hackathon :)
Notes to the Reviewer
If you agree with the general premise and idea, I can start working on adding documentation, tests, etc.
Do you think there should be behind an additional
ebpf_enabled
build tag? The current PRfailsfailed because it couldn't build the gobpf dependency on the Linux image that we run golangci-lint on. I don't think we should add ebpf/bcc bindings into our linting step, just to stop it from complaining, so an extra build tag might be a solution here.I thought we'd start with a v2 integration outright, as a way to encourage more people to start using them. How do you feel about this?
PR Checklist