-
Notifications
You must be signed in to change notification settings - Fork 94
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
Donating ebpf based instrumentation #4
Conversation
Please make sure to follow the attribution guidelines. All source code files should carry the corresponding copyright notice. If you copied any files from other open-source projects that they need to carry the attribution notice. Also, is ebpf-based/vmlinux.h generated or it is a copy from somewhere else? If generated please include generation instruction, if copied it needs an attribution. |
Added. I followed the same licenses that cilium (another eBPF based CNCF project) use for their Go code / eBPF programs. |
@edeNFed Thank you. To help with the review, can you please tell which files are derived/copied from elsewhere and which files are authored by yourself? For files that are derived/copied we will need to know their original licenses, since not every license is allowed. For files that you are the author are you the sole author or you are contributing this on behalf of other authors / on behalf of a company? |
@tigrannajaryan The files in @open-telemetry/go-instrumentation-approvers would love to get a review for this PR. |
The
Any ideas? |
Those files are needed for easy linkage during compilation. I am not sure if this makes the decision easier but I guess we can download them during the compilation script instead of having a copy in this repo. Anyway, I think there should be a way to use those files as other eBPF based projects in the CNCF (cilium for example) are also dependent on them. |
It is not about "storing" the code but the fact that the library is linked. Reference: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
That does not guarantee that these repositories are OK from legal perspective 😉 For instance, AFAIK, MIT requires adding a copywrite notice / EULA. |
My "perfectionist ego" forced me to create open-telemetry/community#1280 to track the issue from the OTel organization perspective. I hope nobody is going to hate me for it 😉 I think we should consider deferring the licensing "issue" I brought (we can create an issue for it). At this point of time I think it is fine to use |
BSD is explicitly allowed by Otel provided that the notice is retained which it is is, so we are good: https://github.com/open-telemetry/community/blob/main/CONTRIBUTING.md#copyright-notices |
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.
@edeNFed, this is a really cool project. Separating each library the way you have done gives it a neat modular-manager design that makes this easily extensible in the future.
I left some comments for future ideas but I am +1 to merging this if there's nothing blocking us (mainly because I want to get my hands dirty and start contributing myself!)
cli/main.go
Outdated
"github.com/open-telemetry/opentelemetry-go-instrumentation/pkg/process" | ||
) | ||
|
||
func main() { |
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.
follow-up: help/usage text would be useful
pkg/process/args.go
Outdated
return nil | ||
} | ||
|
||
func ParseTargetArgs() *TargetArgs { |
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.
any consideration for command line flags? Or at least a centralized struct for storing the various required arguments (process exe, collector endpoint, service name)
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.
Good idea, the current implementation tries to follow: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md
pkg/instrumentors/manager.go
Outdated
insts := []Instrumentor{ | ||
grpc.New(), | ||
grpcServer.New(), | ||
httpServer.New(), | ||
gorillaMux.New(), | ||
} |
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 like how modular this is, it looks like it will make adding support for new libraries fairly easy in the future. wonder if this could eventually be made customizable rather than hard-coded for people to support their own libraries
pkg/inject/injector.go
Outdated
} | ||
|
||
func (i *Injector) getFieldOffset(libName string, libVersion string, structName string, fieldName string) (uint64, bool) { | ||
for _, l := range i.data.Data { |
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.
From the docs:
Luckily for us, there is a way to analyze the target binary and extract the required offsets, by using DWARF. The DWARF debug information is generated by the compiler and is stored inside the binary.
Notice that one of our design goals is to support stripped Go binaries - meaning binaries that do not contain debug information. In order to support stripped binaries and to create a stable instrumentation, we created a library called offsets-tracker.
does this mean that in non-stripped binaries, we could retrieve, store, and access the offset data without needing to do this loop?
I also wonder if there are ways to optimize this data structure, maybe something we could look into if it saves a significant amount of time
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.
Yes, I agree. this loop can probably be skipped for non-stripped binaries.
Also +1 for creating a better data structure.
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.
Leaving just one comment to make sure that this donation is safe from the legal perspective.
I am approving as I think that this PR is too big to process it in a regular way. I suggest merging it as it is. People can always look at this PR and add comments. We may address comments as separate PRs |
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.
As discussed at SIG meeting , we should be good to merge this .
Co-authored-by: Robert Pająk <[email protected]>
Define the CODEOWNERS file as owned by the project maintainers and all else owned by the approvers. This define the required reviews for modification of the owned files.
Check the GitHub actions for updates weekly.
* Remove extra paren from link in README * Fix license link
Co-authored-by: Robert Pająk <[email protected]>
Merge upstream main, add changelog and make small fixes
This PR contains a copy of all the files in the https://github.com/keyval-dev/opentelemetry-go-instrumentation repository