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 traceectl to tracee #4396

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Conversation

ShohamBit
Copy link
Collaborator

@ShohamBit ShohamBit commented Nov 25, 2024

Description

This PR introduces traceectl, a new CLI tool for interacting with Tracee. It implements basic commands for communication with Tracee via gRPC.

Key Changes

  • Added traceectl CLI tool.
  • Implemented commands for the new CLI:
    • version
    • metrics
    • stream
    • event

bb46978 add policy support to stream, and documented
b8db1e4 fix lint issues
914e3cf fix format issues
b5621e3 move traceectl docs to separte section, refactor traceectl docs
b91674e add makefile for traceectl
03e5820 remove invalid test for output
4bc7c92 fix server flag test and error handeling
876bc9c Add test pkg and mock server for traceectl
5729337 update go.mod and go.sum
5d70de4 add config to traceectl
2b81488 change event command to support new format of tracectl
8a941c0 add support for metrics command
c58a785 added printer pkg
e7aae97 added flags pkg
e55c120 fix version runtime issue
d6e9416 refactor stream command
611b224 refactor traceectl code to be more mantainable
161ebc6 refactor the client pkg
4862d94 refactor metrics command
9e6076b Add traceectl to tracee

611b224 refactor traceectl code to be more mantainable

refactor traceectl flags
refactor version commnad
refactor root to align to the new code
remove formater and replace with printer
create diffrent file for geting and running commands

Testing

Please go over the docs and test it

Related Issues

Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

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

Please see comments below.
In addition, please add documentation to traceectl.
As part of the documentation, please also refer to the way the user should start tracee "daemon" (e.g. using NONE output and setting the grpc server address)

cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/client/client.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/client/client.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/JSONFormatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/JSONFormatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/TableFormatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/formatter/formatter.go Outdated Show resolved Hide resolved
cmd/traceectl/pkg/cmd/printer/printer.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
@ShohamBit
Copy link
Collaborator Author

What do you think about adding a flag to traceectl version command called short for a short version instead of all the info we get, or the exact offset making the long flag and the short version the default?

@geyslan
Copy link
Member

geyslan commented Nov 28, 2024

What do you think about adding a flag to traceectl version command called short for a short version instead of all the info we get, or the exact offset making the long flag and the short version the default?

I believe we wouldn't bother with it. When it's from a released version, it's already short.

@geyslan
Copy link
Member

geyslan commented Dec 3, 2024

Gonna through this tomorrow. 👍🏻

@ShohamBit ShohamBit force-pushed the traceectl branch 2 times, most recently from 64b8a32 to 21986f0 Compare December 4, 2024 10:30
Copy link
Collaborator Author

@ShohamBit ShohamBit left a comment

Choose a reason for hiding this comment

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

Looks great to me, maybe go over the documentation and review it once more

@geyslan
Copy link
Member

geyslan commented Dec 4, 2024

@ShohamBit @yanivagman what do you think about splitting this? Since we already have a working stream command, we could open a PR with just the base root and stream commands to establish a foundation for the upcoming new commands (each added in separate PRs). This approach would make both implementation and review more manageable.

@ShohamBit
Copy link
Collaborator Author

Hey @geyslan, great thinking, let's discuss this over with @yanivagman

Copy link
Collaborator

@yanivagman yanivagman left a comment

Choose a reason for hiding this comment

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

First pass...

cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
cmd/traceectl/cmd/event.go Outdated Show resolved Hide resolved
docs/docs/traceectl/commands/version.md Outdated Show resolved Hide resolved
docs/docs/traceectl/flags/format.md Outdated Show resolved Hide resolved
docs/docs/traceectl/flags/server.md Outdated Show resolved Hide resolved
docs/docs/traceectl/index.md Outdated Show resolved Hide resolved
docs/docs/traceectl/index.md Outdated Show resolved Hide resolved
@ShohamBit ShohamBit force-pushed the traceectl branch 2 times, most recently from dd19b43 to 2159616 Compare December 8, 2024 11:45
@ShohamBit ShohamBit changed the title Add Traceectl to Tracee add traceectl to tracee Dec 8, 2024
@yanivagman yanivagman linked an issue Dec 12, 2024 that may be closed by this pull request
8 tasks
@ShohamBit ShohamBit requested a review from yanivagman December 30, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add New CLI: traceectl
3 participants