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

[Improvement]: Head and tail args for the log command #1600

Open
jonaro00 opened this issue Jan 31, 2024 · 11 comments
Open

[Improvement]: Head and tail args for the log command #1600

jonaro00 opened this issue Jan 31, 2024 · 11 comments
Assignees
Labels
Contribution Wanted The community is welcome to collaborate on this issue Good First Issue Good for newcomers S-Accepted This will be worked on T-Improvement Improvement or addition to existing features

Comments

@jonaro00
Copy link
Member

jonaro00 commented Jan 31, 2024

Describe the improvement

A deployment can produce many thousands of log lines, and cargo shuttle log fetches them all. This can produce very big responses when only a fraction of the log lines are needed.

Add --head N and --tail N args to the log command for getting the first or last N lines. The default behaviour should be to get the last 1000 rows.

An additional flag --all can also be added, which keeps the current behaviour by disabling the default tail value and not setting any query parameter.

Short flags -h, -t and -a can also be added.


The steps required include:

  • Adding the fields to the protobuf LogsRequest and query parameter to the deployer endpoints
  • Adding args in the CLI and setting the proper query flags when making a log request
  • Modifying the logger to accept the new options and add them to the underlying SQL query

This issue is open to contribution. Comment if you want to work on it. Feel free to ask for help and guidance here or in our Discord.

@jonaro00 jonaro00 added T-Improvement Improvement or addition to existing features Good First Issue Good for newcomers Contribution Wanted The community is welcome to collaborate on this issue S-Accepted This will be worked on labels Jan 31, 2024
@biplab5464
Copy link
Contributor

is anyone is working in the issue
i want to work in this

@jonaro00
Copy link
Member Author

jonaro00 commented Feb 9, 2024

@biplab5464 All yours. Thanks for showing interest.

@biplab5464
Copy link
Contributor

can you give me little hint where to start

@jonaro00
Copy link
Member Author

jonaro00 commented Feb 9, 2024

You can either start by adding the arguments in cargo-shuttle/src/args, and passing them into the functions that eventually call the log endpoints, or you can start by adding query parameters to deployer's two log endpoints, and pass them on to the gRPC call to logger (requires updating the logger's proto file and regenerating the proto code).

@biplab5464
Copy link
Contributor

--head --tail --all are all optional value right

@jonaro00
Copy link
Member Author

Yes

@biplab5464
Copy link
Contributor

currently -h use for help so we have to give some other short name to the head

Command mod_test: Short option names must be unique for each argument, but '-h' is in use by both 'head' and 'help' (call `cmd.disable_help_flag(true)` to remove the auto-generated `--help`)

@jonaro00
Copy link
Member Author

Hmm, yeah then we can probably skip the short args for now.

biplab5464 pushed a commit to biplab5464/shuttle that referenced this issue Feb 11, 2024
@biplab5464
Copy link
Contributor

biplab5464 commented Feb 11, 2024

hey, can you help me, i have added the argument in the function but i am unable to understand how the log is getting fetch and how can get log of specific head and tail
if we can talk over something like discord ?

and can you please review the above code tell me if it need any change

@jonaro00
Copy link
Member Author

The argument definitions are looking good. The parsing to make the arguments mutually exclusive can instead be accomplished with the clap macros.

You can ask in the contributors channel in our discord if you want more help.

@biplab5464
Copy link
Contributor

biplab5464 commented Feb 12, 2024

i will use clap macros for mutual exclusion
okay, Thanks

biplab5464 pushed a commit to biplab5464/shuttle that referenced this issue Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contribution Wanted The community is welcome to collaborate on this issue Good First Issue Good for newcomers S-Accepted This will be worked on T-Improvement Improvement or addition to existing features
Projects
None yet
Development

No branches or pull requests

2 participants